| 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-debug-as debug | 5 // Flags: --expose-wasm --expose-debug-as debug |
| 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 Debug = debug.Debug | 10 Debug = debug.Debug |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 var builder = new WasmModuleBuilder(); | 47 var builder = new WasmModuleBuilder(); |
| 48 | 48 |
| 49 // wasm_1 calls wasm_2 on offset 2. | 49 // wasm_1 calls wasm_2 on offset 2. |
| 50 // wasm_2 calls call_debugger on offset 1. | 50 // wasm_2 calls call_debugger on offset 1. |
| 51 | 51 |
| 52 builder.addImport("func", kSig_v_v); | 52 builder.addImport("func", kSig_v_v); |
| 53 | 53 |
| 54 builder.addFunction("wasm_1", kSig_v_v) | 54 builder.addFunction("wasm_1", kSig_v_v) |
| 55 .addBody([kExprNop, kExprCallFunction, 2]) | 55 .addBody([kExprNop, kExprCallFunction, kArity0, 1]) |
| 56 .exportAs("main"); | 56 .exportAs("main"); |
| 57 | 57 |
| 58 builder.addFunction("wasm_2", kSig_v_v) | 58 builder.addFunction("wasm_2", kSig_v_v) |
| 59 .addBody([kExprCallFunction, 0]); | 59 .addBody([kExprCallImport, kArity0, 0]); |
| 60 | 60 |
| 61 function call_debugger() { | 61 function call_debugger() { |
| 62 debugger; | 62 debugger; |
| 63 } | 63 } |
| 64 | 64 |
| 65 var module = builder.instantiate({func: call_debugger}); | 65 var module = builder.instantiate({func: call_debugger}); |
| 66 | 66 |
| 67 (function testFrameInspection() { | 67 (function testFrameInspection() { |
| 68 Debug.setListener(listener); | 68 Debug.setListener(listener); |
| 69 module.exports.main(); | 69 module.exports.main(); |
| 70 Debug.setListener(null); | 70 Debug.setListener(null); |
| 71 | 71 |
| 72 assertEquals(1, break_count); | 72 assertEquals(1, break_count); |
| 73 if (exception) throw exception; | 73 if (exception) throw exception; |
| 74 })(); | 74 })(); |
| OLD | NEW |