Index: test/inspector/debugger/wasm-stack.js |
diff --git a/test/inspector/debugger/asm-js-stack.js b/test/inspector/debugger/wasm-stack.js |
similarity index 65% |
copy from test/inspector/debugger/asm-js-stack.js |
copy to test/inspector/debugger/wasm-stack.js |
index 37db088ba19a710ee9fcb9652923b138ab7239bd..22fdded3e1bfd45e6d33bd8a661353ae89c822f8 100644 |
--- a/test/inspector/debugger/asm-js-stack.js |
+++ b/test/inspector/debugger/wasm-stack.js |
@@ -2,34 +2,46 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// Flags: --validate-asm |
- |
-function testFunction() { |
- function generateAsmJs(stdlib, foreign, heap) { |
- 'use asm'; |
- var debugger_fun = foreign.call_debugger; |
- function callDebugger() { |
- debugger_fun(); |
- } |
- function redirectFun() { |
- callDebugger(); |
- } |
- return redirectFun; |
- } |
+// Flags: --expose-wasm test/mjsunit/wasm/wasm-constants.js test/mjsunit/wasm/wasm-module-builder.js |
+ |
+var builder = new WasmModuleBuilder(); |
+ |
+var imported_idx = builder.addImport("func", kSig_v_v); |
+ |
+var call_imported_idx = builder.addFunction("main", kSig_v_v) |
+ .addBody([kExprCallFunction, imported_idx]) |
+ .index; |
+ |
+builder.addFunction("main", kSig_v_v) |
+ .addBody([kExprCallFunction, call_imported_idx]) |
+ .exportAs("main"); |
+var module_bytes = builder.toArray(); |
+ |
+function testFunction(bytes) { |
function call_debugger() { |
debugger; |
} |
- var fun = generateAsmJs(this, {'call_debugger': call_debugger}, undefined); |
- fun(); |
+ var buffer = new ArrayBuffer(bytes.length); |
+ var view = new Uint8Array(buffer); |
+ for (var i = 0; i < bytes.length; i++) { |
+ view[i] = bytes[i] | 0; |
+ } |
+ |
+ var module = new WebAssembly.Module(buffer); |
+ var instance = new WebAssembly.Instance(module, {func: call_debugger}); |
+ |
+ instance.exports.main(); |
} |
InspectorTest.addScript(testFunction.toString()); |
Protocol.Debugger.enable(); |
Protocol.Debugger.oncePaused().then(handleDebuggerPaused); |
-Protocol.Runtime.evaluate({'expression': 'testFunction()'}); |
+InspectorTest.log('Running testFunction with generated WASM bytes...'); |
+Protocol.Runtime.evaluate( |
+ {'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'}); |
function locationToString(callFrame) { |
var res = {functionName: callFrame.functionName}; |