Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 load("test/mjsunit/wasm/wasm-constants.js"); | |
| 6 load("test/mjsunit/wasm/wasm-module-builder.js"); | |
| 7 | |
| 8 (function AddTest() { | |
| 9 let builder = new WasmModuleBuilder(); | |
| 10 | |
| 11 builder.addFunction("main", kSig_i_v) | |
| 12 .addBody([ | |
| 13 kExprBlock, kWasmStmt, | |
| 14 kExprI64Const, 0, | |
| 15 kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10, | |
|
Mircea Trofin
2017/01/18 21:01:56
mind adding a comment explaining what's with these
Eric Holk
2017/01/18 21:20:50
Done.
| |
| 16 kExprI64Add, | |
| 17 kExprI64Eqz, | |
| 18 kExprBrIf, 0, | |
| 19 kExprI32Const, 0, | |
| 20 kExprReturn, | |
| 21 kExprEnd, | |
| 22 kExprI32Const, 0 | |
| 23 ]) | |
| 24 .exportFunc(); | |
| 25 let module = builder.instantiate(); | |
| 26 assertEquals(0, module.exports.main()); | |
| 27 })(); | |
| 28 | |
| 29 (function SubTest() { | |
| 30 let builder = new WasmModuleBuilder(); | |
| 31 | |
| 32 builder.addFunction("main", kSig_i_v) | |
| 33 .addBody([ | |
| 34 kExprBlock, kWasmStmt, | |
| 35 kExprI64Const, 0, | |
| 36 kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10, | |
| 37 kExprI64Sub, | |
| 38 kExprI64Eqz, | |
| 39 kExprBrIf, 0, | |
| 40 kExprI32Const, 0, | |
| 41 kExprReturn, | |
| 42 kExprEnd, | |
| 43 kExprI32Const, 0 | |
| 44 ]) | |
| 45 .exportFunc(); | |
| 46 let module = builder.instantiate(); | |
| 47 assertEquals(0, module.exports.main()); | |
| 48 })(); | |
| OLD | NEW |