blob: b4c78359fa080e5dd24287b370ced9856c0def98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
setJitCompilerOption("ic.force-megamorphic", 1);
function testAddToIntermediate() {
var C = Object.create(null);
var B = Object.create(C);
var A = Object.create(B);
C.x = 1;
for (var i = 0; i < 50; i++) {
assertEq(A.x, i <= 45 ? 1 : 0);
if (i === 45) {
B.x = 0;
}
}
}
for (var i = 0; i < 5; i++) {
testAddToIntermediate();
}
function testAddToReceiver() {
var C = Object.create(null);
var B = Object.create(C);
var A = Object.create(B);
C.x = 1;
for (var i = 0; i < 50; i++) {
assertEq(A.x, i <= 45 ? 1 : 0);
if (i === 45) {
A.x = 0;
}
}
}
for (var i = 0; i < 5; i++) {
testAddToReceiver();
}
function testDelete() {
var C = Object.create(null);
var B = Object.create(C);
var A = Object.create(B);
C.x = 1;
for (var i = 0; i < 50; i++) {
assertEq(A.x, i <= 45 ? 1 : undefined);
if (i === 45) {
delete C.x;
}
}
}
for (var i = 0; i < 5; i++) {
testDelete();
}
function testDataToAccessor() {
var C = Object.create(null);
var B = Object.create(C);
var A = Object.create(B);
C.x = 1;
for (var i = 0; i < 50; i++) {
assertEq(A.x, i <= 45 ? 1 : 7);
if (i === 45) {
Object.defineProperty(C, "x", {get: () => 7});
}
}
}
for (var i = 0; i < 5; i++) {
testDataToAccessor();
}
function testProtoChange() {
var C = Object.create(null);
var B = Object.create(C);
var A = Object.create(B);
C.x = 1;
for (var i = 0; i < 50; i++) {
assertEq(A.x, i <= 45 ? 1 : 8);
if (i === 45) {
Object.setPrototypeOf(B, {a: 0, b: 1, x: 8});
}
}
}
for (var i = 0; i < 5; i++) {
testProtoChange();
}
|