| 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 | 5 // Flags: --expose-wasm |
| 6 | 6 |
| 7 let {session, contextGroup, Protocol} = InspectorTest.start('Tests call stack in
wasm scripts'); |
| 8 |
| 7 utils.load('test/mjsunit/wasm/wasm-constants.js'); | 9 utils.load('test/mjsunit/wasm/wasm-constants.js'); |
| 8 utils.load('test/mjsunit/wasm/wasm-module-builder.js'); | 10 utils.load('test/mjsunit/wasm/wasm-module-builder.js'); |
| 9 | 11 |
| 10 var builder = new WasmModuleBuilder(); | 12 var builder = new WasmModuleBuilder(); |
| 11 | 13 |
| 12 var imported_idx = builder.addImport("mode", "func", kSig_v_v); | 14 var imported_idx = builder.addImport("mode", "func", kSig_v_v); |
| 13 | 15 |
| 14 var call_imported_idx = builder.addFunction('call_func', kSig_v_v) | 16 var call_imported_idx = builder.addFunction('call_func', kSig_v_v) |
| 15 .addBody([kExprCallFunction, imported_idx]) | 17 .addBody([kExprCallFunction, imported_idx]) |
| 16 .index; | 18 .index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 for (var i = 0; i < bytes.length; i++) { | 35 for (var i = 0; i < bytes.length; i++) { |
| 34 view[i] = bytes[i] | 0; | 36 view[i] = bytes[i] | 0; |
| 35 } | 37 } |
| 36 | 38 |
| 37 var module = new WebAssembly.Module(buffer); | 39 var module = new WebAssembly.Module(buffer); |
| 38 var instance = new WebAssembly.Instance(module, {mode: {func: call_debugger}})
; | 40 var instance = new WebAssembly.Instance(module, {mode: {func: call_debugger}})
; |
| 39 | 41 |
| 40 instance.exports.main(); | 42 instance.exports.main(); |
| 41 } | 43 } |
| 42 | 44 |
| 43 InspectorTest.addScript(testFunction.toString()); | 45 contextGroup.addScript(testFunction.toString()); |
| 44 | 46 |
| 45 Protocol.Debugger.enable(); | 47 Protocol.Debugger.enable(); |
| 46 Protocol.Debugger.onPaused(handleDebuggerPaused); | 48 Protocol.Debugger.onPaused(handleDebuggerPaused); |
| 47 InspectorTest.log('Running testFunction with generated WASM bytes...'); | 49 InspectorTest.log('Running testFunction with generated WASM bytes...'); |
| 48 Protocol.Runtime.evaluate( | 50 Protocol.Runtime.evaluate( |
| 49 {'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'}); | 51 {'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'}); |
| 50 | 52 |
| 51 function locationToString(callFrame) { | 53 function locationToString(callFrame) { |
| 52 var res = {functionName: callFrame.functionName}; | 54 var res = {functionName: callFrame.functionName}; |
| 53 for (var attr in callFrame.functionLocation) { | 55 for (var attr in callFrame.functionLocation) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 { | 89 { |
| 88 InspectorTest.log( | 90 InspectorTest.log( |
| 89 'Result of evaluate (' + response.result.result.type + '):'); | 91 'Result of evaluate (' + response.result.result.type + '):'); |
| 90 var result_lines = response.result.result.value.split('\n'); | 92 var result_lines = response.result.result.value.split('\n'); |
| 91 // Skip the second line, containing the 'evaluate' position. | 93 // Skip the second line, containing the 'evaluate' position. |
| 92 result_lines[1] = ' -- skipped --'; | 94 result_lines[1] = ' -- skipped --'; |
| 93 InspectorTest.log(result_lines.join('\n')); | 95 InspectorTest.log(result_lines.join('\n')); |
| 94 InspectorTest.log('Finished!'); | 96 InspectorTest.log('Finished!'); |
| 95 InspectorTest.completeTest(); | 97 InspectorTest.completeTest(); |
| 96 } | 98 } |
| OLD | NEW |