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 function assertWasm(expected, func, ffi) { | 7 function assertWasm(expected, func, ffi) { |
8 print("Testing " + func.name + "..."); | 8 print("Testing " + func.name + "..."); |
9 assertEquals(expected, Wasm.instantiateModuleFromAsm( | 9 assertEquals(expected, Wasm.instantiateModuleFromAsm( |
10 func.toString(), ffi).caller()); | 10 func.toString(), ffi).caller()); |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 u0xffffffff: u0xffffffff, | 1486 u0xffffffff: u0xffffffff, |
1487 u0x80000000: u0x80000000, | 1487 u0x80000000: u0x80000000, |
1488 u0x87654321: u0x87654321, | 1488 u0x87654321: u0x87654321, |
1489 }; | 1489 }; |
1490 } | 1490 } |
1491 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString()); | 1491 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString()); |
1492 assertEquals(0xffffffff, wasm.u0xffffffff()); | 1492 assertEquals(0xffffffff, wasm.u0xffffffff()); |
1493 assertEquals(0x80000000, wasm.u0x80000000()); | 1493 assertEquals(0x80000000, wasm.u0x80000000()); |
1494 assertEquals(0x87654321, wasm.u0x87654321()); | 1494 assertEquals(0x87654321, wasm.u0x87654321()); |
1495 })(); | 1495 })(); |
| 1496 |
| 1497 (function SubtractDebug() { |
| 1498 function asmModule() { |
| 1499 "use asm"; |
| 1500 function main(x) { |
| 1501 x = x|0; |
| 1502 return (x - 0)|0; |
| 1503 } |
| 1504 return {main:main}; |
| 1505 } |
| 1506 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString()); |
| 1507 assertEquals(-1, wasm.main(-1)); |
| 1508 })(); |
OLD | NEW |