OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-wasm --expose-gc | 5 // Flags: --expose-wasm --expose-gc |
6 | 6 |
7 load("test/mjsunit/wasm/wasm-constants.js"); | 7 load("test/mjsunit/wasm/wasm-constants.js"); |
8 load("test/mjsunit/wasm/wasm-module-builder.js"); | 8 load("test/mjsunit/wasm/wasm-module-builder.js"); |
9 | 9 |
10 function makeFFI(func, t) { | 10 function makeFFI(func, t) { |
11 var builder = new WasmModuleBuilder(); | 11 var builder = new WasmModuleBuilder(); |
12 | 12 |
13 var sig_index = builder.addSignature([t,t,t,t,t,t,t,t,t,t,t]); | 13 var sig_index = builder.addSignature([t,t,t,t,t,t,t,t,t,t,t]); |
14 builder.addImport("func", sig_index); | 14 builder.addImport("func", sig_index); |
15 // Try to create a frame with lots of spilled values and parameters | 15 // Try to create a frame with lots of spilled values and parameters |
16 // on the stack to try to catch GC bugs in the reference maps for | 16 // on the stack to try to catch GC bugs in the reference maps for |
17 // the different parts of the stack. | 17 // the different parts of the stack. |
18 builder.addFunction("main", sig_index) | 18 builder.addFunction("main", sig_index) |
19 .addBody([ | 19 .addBody([ |
20 kExprCallImport, 0, // -- | |
21 kExprGetLocal, 0, // -- | 20 kExprGetLocal, 0, // -- |
22 kExprGetLocal, 1, // -- | 21 kExprGetLocal, 1, // -- |
23 kExprGetLocal, 2, // -- | 22 kExprGetLocal, 2, // -- |
24 kExprGetLocal, 3, // -- | 23 kExprGetLocal, 3, // -- |
25 kExprGetLocal, 4, // -- | 24 kExprGetLocal, 4, // -- |
26 kExprGetLocal, 5, // -- | 25 kExprGetLocal, 5, // -- |
27 kExprGetLocal, 6, // -- | 26 kExprGetLocal, 6, // -- |
28 kExprGetLocal, 7, // -- | 27 kExprGetLocal, 7, // -- |
29 kExprGetLocal, 8, // -- | 28 kExprGetLocal, 8, // -- |
30 kExprGetLocal, 9, // -- | 29 kExprGetLocal, 9, // -- |
31 kExprCallImport, 0, // -- | 30 kExprCallImport, 10, 0, // -- |
32 kExprGetLocal, 0, // -- | 31 kExprGetLocal, 0, // -- |
33 kExprGetLocal, 1, // -- | 32 kExprGetLocal, 1, // -- |
34 kExprGetLocal, 2, // -- | 33 kExprGetLocal, 2, // -- |
35 kExprGetLocal, 3, // -- | 34 kExprGetLocal, 3, // -- |
36 kExprGetLocal, 4, // -- | 35 kExprGetLocal, 4, // -- |
37 kExprGetLocal, 5, // -- | 36 kExprGetLocal, 5, // -- |
38 kExprGetLocal, 6, // -- | 37 kExprGetLocal, 6, // -- |
39 kExprGetLocal, 7, // -- | 38 kExprGetLocal, 7, // -- |
40 kExprGetLocal, 8, // -- | 39 kExprGetLocal, 8, // -- |
41 kExprGetLocal, 9 // -- | 40 kExprGetLocal, 9, // -- |
| 41 kExprCallImport, 10, 0 // -- |
42 ]) // -- | 42 ]) // -- |
43 .exportFunc(); | 43 .exportFunc(); |
44 | 44 |
45 return builder.instantiate({func: func}).exports.main; | 45 return builder.instantiate({func: func}).exports.main; |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 function print10(a, b, c, d, e, f, g, h, i) { | 49 function print10(a, b, c, d, e, f, g, h, i) { |
50 print(a + ",", b + ",", c + ",", d + ",", e + ",", f + ",", g + ",", h + ",",
i); | 50 print(a + ",", b + ",", c + ",", d + ",", e + ",", f + ",", g + ",", h + ",",
i); |
51 gc(); | 51 gc(); |
(...skipping 13 matching lines...) Expand all Loading... |
65 main(i - 1, i, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8); | 65 main(i - 1, i, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8); |
66 } | 66 } |
67 })(); | 67 })(); |
68 | 68 |
69 (function I32Test() { | 69 (function I32Test() { |
70 var main = makeFFI(print10, kAstF64); | 70 var main = makeFFI(print10, kAstF64); |
71 for (var i = 1; i < 2e+80; i *= -1137) { | 71 for (var i = 1; i < 2e+80; i *= -1137) { |
72 main(i - 1, i, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8); | 72 main(i - 1, i, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8); |
73 } | 73 } |
74 })(); | 74 })(); |
OLD | NEW |