| 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 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 var builder = new WasmModuleBuilder(); | 10 var builder = new WasmModuleBuilder(); |
| 11 | 11 |
| 12 var imported_idx = builder.addImport("func", kSig_v_v); | 12 var imported_idx = builder.addImport("xxx", "func", kSig_v_v); |
| 13 | 13 |
| 14 var call_imported_idx = builder.addFunction("call_func", kSig_v_v) | 14 var call_imported_idx = builder.addFunction("call_func", kSig_v_v) |
| 15 .addBody([kExprCallFunction, imported_idx]) | 15 .addBody([kExprCallFunction, imported_idx]) |
| 16 .index; | 16 .index; |
| 17 | 17 |
| 18 var sig_index = builder.addType(kSig_v_v); | 18 var sig_index = builder.addType(kSig_v_v); |
| 19 | 19 |
| 20 builder.addFunction('main', kSig_v_v) | 20 builder.addFunction('main', kSig_v_v) |
| 21 .addBody([ | 21 .addBody([ |
| 22 kExprBlock, kAstStmt, kExprI32Const, 0, kExprCallIndirect, sig_index, | 22 kExprBlock, kAstStmt, kExprI32Const, 0, kExprCallIndirect, sig_index, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 debugger; | 33 debugger; |
| 34 } | 34 } |
| 35 | 35 |
| 36 var buffer = new ArrayBuffer(bytes.length); | 36 var buffer = new ArrayBuffer(bytes.length); |
| 37 var view = new Uint8Array(buffer); | 37 var view = new Uint8Array(buffer); |
| 38 for (var i = 0; i < bytes.length; i++) { | 38 for (var i = 0; i < bytes.length; i++) { |
| 39 view[i] = bytes[i] | 0; | 39 view[i] = bytes[i] | 0; |
| 40 } | 40 } |
| 41 | 41 |
| 42 var module = new WebAssembly.Module(buffer); | 42 var module = new WebAssembly.Module(buffer); |
| 43 var instance = new WebAssembly.Instance(module, {func: call_debugger}); | 43 var instance = new WebAssembly.Instance(module, {xxx: {func: call_debugger}}); |
| 44 | 44 |
| 45 instance.exports.main(); | 45 instance.exports.main(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 InspectorTest.addScript(testFunction.toString()); | 48 InspectorTest.addScript(testFunction.toString()); |
| 49 InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); | 49 InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); |
| 50 | 50 |
| 51 Protocol.Debugger.enable(); | 51 Protocol.Debugger.enable(); |
| 52 Protocol.Debugger.onPaused(handleDebuggerPaused); | 52 Protocol.Debugger.onPaused(handleDebuggerPaused); |
| 53 InspectorTest.log('Check that inspector gets disassembled wasm code'); | 53 InspectorTest.log('Check that inspector gets disassembled wasm code'); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 70 .getScriptSource({scriptId: frames[frameId].location.scriptId}) | 70 .getScriptSource({scriptId: frames[frameId].location.scriptId}) |
| 71 .then(dumpSourceLine.bind(null, frameId)) | 71 .then(dumpSourceLine.bind(null, frameId)) |
| 72 .then(() => next(frameId + 1)); | 72 .then(() => next(frameId + 1)); |
| 73 } | 73 } |
| 74 function finished() { | 74 function finished() { |
| 75 InspectorTest.log('Finished.'); | 75 InspectorTest.log('Finished.'); |
| 76 InspectorTest.completeTest(); | 76 InspectorTest.completeTest(); |
| 77 } | 77 } |
| 78 next(0).then(finished); | 78 next(0).then(finished); |
| 79 } | 79 } |
| OLD | NEW |