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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
setJitCompilerOption("baseline.warmup.trigger", 10);
setJitCompilerOption("ion.warmup.trigger", 30);
var i;
// Check that an entry frame is always aligned properly.
function entryFrame_1() {
assertJitStackInvariants();
}
// Check rectifier frames are keeping the same alignment.
function rectifierFrame_verify(a, b, c, d) {
assertJitStackInvariants();
}
function rectifierFrame_1(i) {
rectifierFrame_verify();
}
function rectifierFrame_2(i) {
rectifierFrame_verify(i);
}
function rectifierFrame_3(i) {
rectifierFrame_verify(i, i);
}
function rectifierFrame_4(i) {
rectifierFrame_verify(i, i, i);
}
// Check that an ion frame size is always aligned properly.
function gen_ionFrameSize(x, y, name) {
var locals = (new Array(x)).fill(0).map((v, i) => i);
var args = (new Array(y)).fill(0).map((v, i) => i);
return new Function("i",
locals.map(i => "var l% = i + %;\n".replace(/%/g, i)).join("")
+ name + "(" + args.map(i => "l%".replace("%", i)).join(", ") + ");\n"
+ "return " + locals.map(i => "l%".replace("%", i)).join(" + ") + ";\n"
);
}
var ionFrameSize_0 = gen_ionFrameSize(30, 0, "assertJitStackInvariants");
var ionFrameSize_1 = gen_ionFrameSize(31, 0, "assertJitStackInvariants");
var ionFrameSize_2 = gen_ionFrameSize(32, 0, "assertJitStackInvariants");
var ionFrameSize_3 = gen_ionFrameSize(33, 0, "assertJitStackInvariants");
function ionFrameSize_callee_verify(a, b, c, d) {
assertJitStackInvariants();
}
var ionFrameSize_args = [];
for (var l = 0; l < 4; l++) {
ionFrameSize_args[l] = [];
for (var a = 0; a < 4; a++)
ionFrameSize_args[l][a] = gen_ionFrameSize(30 + l, a, "ionFrameSize_callee_verify");;
}
// Check ion frames during function apply calls with the argument vector.
function ionFrame_funApply_0() {
assertJitStackInvariants.apply(this, arguments);
}
function ionFrame_funApply_1() {
ionFrame_funApply_0.apply(this, arguments);
}
// Check ion frames during function apply calls with an array of arguments.
function ionFrame_funApply_2() {
var arr = Array.apply(Array, arguments);
assertJitStackInvariants.apply(this, arr);
}
function ionFrame_funApply_3() {
var arr = Array.apply(Array, arguments);
ionFrame_funApply_2.apply(this, arr);
}
// Check ion frames during function .call calls.
function ionFrame_funCall_0() {
assertJitStackInvariants.call(this);
}
function ionFrame_funCall_1(a) {
assertJitStackInvariants.call(this, a);
}
function ionFrame_funCall_2(a, b) {
assertJitStackInvariants.call(this, a, b);
}
function ionFrame_funCall_3(a, b, c) {
assertJitStackInvariants.call(this, a, b, c);
}
function ionFrame_funCall_x0() {
ionFrame_funCall_0.call(this);
}
function ionFrame_funCall_x1(a) {
ionFrame_funCall_1.call(this, a);
}
function ionFrame_funCall_x2(a, b) {
ionFrame_funCall_2.call(this, a, b);
}
function ionFrame_funCall_x3(a, b, c) {
ionFrame_funCall_3.call(this, a, b, c);
}
// Check ion frames during spread calls.
function ionFrame_spreadCall_0() {
var arr = Array.apply(Array, arguments);
assertJitStackInvariants(...arr);
}
function ionFrame_spreadCall_1() {
var arr = Array.apply(Array, arguments);
ionFrame_spreadCall_0(...arr);
}
for (i = 0; i < 40; i++) {
entryFrame_1();
entryFrame_1(0);
entryFrame_1(0, 1);
rectifierFrame_1(i);
rectifierFrame_2(i);
rectifierFrame_3(i);
rectifierFrame_4(i);
ionFrameSize_0(i);
ionFrameSize_1(i);
ionFrameSize_2(i);
ionFrameSize_3(i);
for (var l = 0; l < 4; l++)
for (var a = 0; a < 4; a++)
ionFrameSize_args[l][a](i);
ionFrame_funApply_0();
ionFrame_funApply_0(1);
ionFrame_funApply_0(1, 2);
ionFrame_funApply_0(1, 2, 3);
ionFrame_funApply_1();
ionFrame_funApply_1(1);
ionFrame_funApply_1(1, 2);
ionFrame_funApply_1(1, 2, 3);
ionFrame_funApply_2();
ionFrame_funApply_2(1);
ionFrame_funApply_2(1, 2);
ionFrame_funApply_2(1, 2, 3);
ionFrame_funApply_3();
ionFrame_funApply_3(1);
ionFrame_funApply_3(1, 2);
ionFrame_funApply_3(1, 2, 3);
ionFrame_funCall_0();
ionFrame_funCall_1(1);
ionFrame_funCall_2(1, 2);
ionFrame_funCall_3(1, 2, 3);
ionFrame_funCall_x0();
ionFrame_funCall_x1(1);
ionFrame_funCall_x2(1, 2);
ionFrame_funCall_x3(1, 2, 3);
ionFrame_spreadCall_0();
ionFrame_spreadCall_0(1);
ionFrame_spreadCall_0(1, 2);
ionFrame_spreadCall_0(1, 2, 3);
ionFrame_spreadCall_1();
ionFrame_spreadCall_1(1);
ionFrame_spreadCall_1(1, 2);
ionFrame_spreadCall_1(1, 2, 3);
}
|