OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 | 5 // Flags: --expose-wasm |
6 | 6 |
7 load("test/mjsunit/wasm/wasm-constants.js"); | 7 load("test/mjsunit/wasm/wasm-constants.js"); |
8 | 8 |
9 function testCallFFI(func, check) { | 9 function testCallFFI(func, check) { |
10 var kBodySize = 6; | 10 var kBodySize = 6; |
(...skipping 20 matching lines...) Expand all Loading... |
31 // main body | 31 // main body |
32 kExprCallFunction, 0, // -- | 32 kExprCallFunction, 0, // -- |
33 kExprGetLocal, 0, // -- | 33 kExprGetLocal, 0, // -- |
34 kExprGetLocal, 1, // -- | 34 kExprGetLocal, 1, // -- |
35 // names | 35 // names |
36 kDeclEnd, | 36 kDeclEnd, |
37 'f', 'u', 'n', 0, // -- | 37 'f', 'u', 'n', 0, // -- |
38 'm', 'a', 'i', 'n', 0 // -- | 38 'm', 'a', 'i', 'n', 0 // -- |
39 ); | 39 ); |
40 | 40 |
41 var module = WASM.instantiateModule(data, ffi); | 41 var module = _WASMEXP_.instantiateModule(data, ffi); |
42 | 42 |
43 assertEquals("function", typeof module.main); | 43 assertEquals("function", typeof module.main); |
44 | 44 |
45 for (var i = 0; i < 100000; i += 10003) { | 45 for (var i = 0; i < 100000; i += 10003) { |
46 var a = 22.5 + i, b = 10.5 + i; | 46 var a = 22.5 + i, b = 10.5 + i; |
47 var r = module.main(a, b); | 47 var r = module.main(a, b); |
48 check(r, a, b); | 48 check(r, a, b); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 kExprCallFunction, 0, // -- | 229 kExprCallFunction, 0, // -- |
230 kExprGetLocal, 0, // -- | 230 kExprGetLocal, 0, // -- |
231 kExprGetLocal, 1, // -- | 231 kExprGetLocal, 1, // -- |
232 kExprI8Const, 99, // -- | 232 kExprI8Const, 99, // -- |
233 // names | 233 // names |
234 kDeclEnd, | 234 kDeclEnd, |
235 'f', 'u', 'n', 0, // -- | 235 'f', 'u', 'n', 0, // -- |
236 'm', 'a', 'i', 'n', 0 // -- | 236 'm', 'a', 'i', 'n', 0 // -- |
237 ); | 237 ); |
238 | 238 |
239 var module = WASM.instantiateModule(data, ffi); | 239 var module = _WASMEXP_.instantiateModule(data, ffi); |
240 | 240 |
241 assertEquals("function", typeof module.main); | 241 assertEquals("function", typeof module.main); |
242 | 242 |
243 print("testCallBinopVoid", type); | 243 print("testCallBinopVoid", type); |
244 | 244 |
245 for (var i = 0; i < 100000; i += 10003.1) { | 245 for (var i = 0; i < 100000; i += 10003.1) { |
246 var a = 22.5 + i, b = 10.5 + i; | 246 var a = 22.5 + i, b = 10.5 + i; |
247 var r = module.main(a, b); | 247 var r = module.main(a, b); |
248 assertEquals(99, r); | 248 assertEquals(99, r); |
249 assertEquals(2, passed_length); | 249 assertEquals(2, passed_length); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 kExprCallFunction, 0, // -- | 313 kExprCallFunction, 0, // -- |
314 kExprI8Const, 97, // -- | 314 kExprI8Const, 97, // -- |
315 kExprCallFunction, 1, // -- | 315 kExprCallFunction, 1, // -- |
316 kExprGetLocal, 0, // -- | 316 kExprGetLocal, 0, // -- |
317 // names | 317 // names |
318 kDeclEnd, | 318 kDeclEnd, |
319 'p', 'r', 'i', 'n', 't', 0, // -- | 319 'p', 'r', 'i', 'n', 't', 0, // -- |
320 'm', 'a', 'i', 'n', 0 // -- | 320 'm', 'a', 'i', 'n', 0 // -- |
321 ); | 321 ); |
322 | 322 |
323 var module = WASM.instantiateModule(data, ffi); | 323 var module = _WASMEXP_.instantiateModule(data, ffi); |
324 | 324 |
325 assertEquals("function", typeof module.main); | 325 assertEquals("function", typeof module.main); |
326 | 326 |
327 for (var i = -9; i < 900; i += 6.125) { | 327 for (var i = -9; i < 900; i += 6.125) { |
328 module.main(i); | 328 module.main(i); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 testCallPrint(); | 332 testCallPrint(); |
333 testCallPrint(); | 333 testCallPrint(); |
OLD | NEW |