| 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 how wasm scri
ps report the source'); |
| 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("xxx", "func", kSig_v_v); | 14 var imported_idx = builder.addImport("xxx", "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 21 matching lines...) Expand all Loading... |
| 38 for (var i = 0; i < bytes.length; i++) { | 40 for (var i = 0; i < bytes.length; i++) { |
| 39 view[i] = bytes[i] | 0; | 41 view[i] = bytes[i] | 0; |
| 40 } | 42 } |
| 41 | 43 |
| 42 var module = new WebAssembly.Module(buffer); | 44 var module = new WebAssembly.Module(buffer); |
| 43 var instance = new WebAssembly.Instance(module, {xxx: {func: call_debugger}}); | 45 var instance = new WebAssembly.Instance(module, {xxx: {func: call_debugger}}); |
| 44 | 46 |
| 45 instance.exports.main(); | 47 instance.exports.main(); |
| 46 } | 48 } |
| 47 | 49 |
| 48 InspectorTest.addScript(testFunction.toString()); | 50 contextGroup.addScript(testFunction.toString()); |
| 49 InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); | 51 contextGroup.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); |
| 50 | 52 |
| 51 Protocol.Debugger.enable(); | 53 Protocol.Debugger.enable(); |
| 52 Protocol.Debugger.onPaused(handleDebuggerPaused); | 54 Protocol.Debugger.onPaused(handleDebuggerPaused); |
| 53 InspectorTest.log('Check that inspector gets disassembled wasm code'); | 55 InspectorTest.log('Check that inspector gets disassembled wasm code'); |
| 54 Protocol.Runtime.evaluate({'expression': 'testFunction(module_bytes)'}); | 56 Protocol.Runtime.evaluate({'expression': 'testFunction(module_bytes)'}); |
| 55 | 57 |
| 56 function handleDebuggerPaused(message) { | 58 function handleDebuggerPaused(message) { |
| 57 InspectorTest.log('Paused on debugger!'); | 59 InspectorTest.log('Paused on debugger!'); |
| 58 var frames = message.params.callFrames; | 60 var frames = message.params.callFrames; |
| 59 InspectorTest.log('Number of frames: ' + frames.length); | 61 InspectorTest.log('Number of frames: ' + frames.length); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 70 .getScriptSource({scriptId: frames[frameId].location.scriptId}) | 72 .getScriptSource({scriptId: frames[frameId].location.scriptId}) |
| 71 .then(dumpSourceLine.bind(null, frameId)) | 73 .then(dumpSourceLine.bind(null, frameId)) |
| 72 .then(() => next(frameId + 1)); | 74 .then(() => next(frameId + 1)); |
| 73 } | 75 } |
| 74 function finished() { | 76 function finished() { |
| 75 InspectorTest.log('Finished.'); | 77 InspectorTest.log('Finished.'); |
| 76 InspectorTest.completeTest(); | 78 InspectorTest.completeTest(); |
| 77 } | 79 } |
| 78 next(0).then(finished); | 80 next(0).then(finished); |
| 79 } | 81 } |
| OLD | NEW |