diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2020-10-15 20:17:08 +0200 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2020-10-18 20:16:47 +0200 |
commit | a1d639ba5de4ff34e34fb575fbb6cc1d41ec3cce (patch) | |
tree | abc7d41c12f1495b1208fa4449cb2508c92c5e85 /deps/v8/test/inspector | |
parent | 089d654dd85f8e548597329f60a41d6029260caa (diff) | |
download | node-new-a1d639ba5de4ff34e34fb575fbb6cc1d41ec3cce.tar.gz |
deps: update V8 to 8.6.395
PR-URL: https://github.com/nodejs/node/pull/35415
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector')
110 files changed, 2881 insertions, 1120 deletions
diff --git a/deps/v8/test/inspector/BUILD.gn b/deps/v8/test/inspector/BUILD.gn index eb8c8f0863..94e6f29752 100644 --- a/deps/v8/test/inspector/BUILD.gn +++ b/deps/v8/test/inspector/BUILD.gn @@ -28,9 +28,7 @@ v8_executable("inspector-test") { "//build/win:default_exe_manifest", ] - data_deps = [ - "../../tools:v8_testrunner", - ] + data_deps = [ "../../tools:v8_testrunner" ] data = [ "console/", @@ -46,6 +44,7 @@ v8_executable("inspector-test") { "sessions/", "testcfg.py", "type-profiler/", + "wasm-inspector-test.js", ] cflags = [] diff --git a/deps/v8/test/inspector/cpu-profiler/coverage-block.js b/deps/v8/test/inspector/cpu-profiler/coverage-block.js index 565fb5dbc6..5dbd6ae819 100644 --- a/deps/v8/test/inspector/cpu-profiler/coverage-block.js +++ b/deps/v8/test/inspector/cpu-profiler/coverage-block.js @@ -4,6 +4,7 @@ // Flags: --allow-natives-syntax --no-always-opt --opt // Flags: --no-stress-flush-bytecode +// Flags: --no-stress-incremental-marking var source = ` diff --git a/deps/v8/test/inspector/cpu-profiler/coverage.js b/deps/v8/test/inspector/cpu-profiler/coverage.js index 0ea0cceb93..02b9897100 100644 --- a/deps/v8/test/inspector/cpu-profiler/coverage.js +++ b/deps/v8/test/inspector/cpu-profiler/coverage.js @@ -4,6 +4,7 @@ // Flags: --allow-natives-syntax --no-always-opt --opt // Flags: --no-stress-flush-bytecode +// Flags: --no-stress-incremental-marking var source = ` diff --git a/deps/v8/test/inspector/debugger/es6-module-script-parsed-expected.txt b/deps/v8/test/inspector/debugger/es6-module-script-parsed-expected.txt index f91ce03b90..5237615496 100644 --- a/deps/v8/test/inspector/debugger/es6-module-script-parsed-expected.txt +++ b/deps/v8/test/inspector/debugger/es6-module-script-parsed-expected.txt @@ -4,6 +4,7 @@ Running test: testLoadedModulesOnDebuggerEnable { method : Debugger.scriptParsed params : { + embedderName : module1.js endColumn : 1 endLine : 3 executionContextId : <executionContextId> @@ -25,6 +26,7 @@ Running test: testScriptEventsWhenDebuggerIsEnabled { method : Debugger.scriptParsed params : { + embedderName : module2.js endColumn : 1 endLine : 3 executionContextId : <executionContextId> @@ -44,6 +46,7 @@ Running test: testScriptEventsWhenDebuggerIsEnabled { method : Debugger.scriptFailedToParse params : { + embedderName : module-with-syntax-error-2.js endColumn : 1 endLine : 0 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/eval-without-codegen-expected.txt b/deps/v8/test/inspector/debugger/eval-without-codegen-expected.txt index d2c1e21b1f..03bfcad2ad 100644 --- a/deps/v8/test/inspector/debugger/eval-without-codegen-expected.txt +++ b/deps/v8/test/inspector/debugger/eval-without-codegen-expected.txt @@ -31,6 +31,104 @@ Running test: testEvaluatePaused } } +Running test: testEvaluateUnsafeEval +{ + id : <messageId> + result : { + result : { + description : 2 + type : number + value : 2 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 2 + type : number + value : 2 + } + } +} + +Running test: testEvaluateUnsafeEvalDisableBypass +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + className : EvalError + description : EvalError: Code generation from strings disallowed for this context at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 0 + scriptId : <scriptId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 0 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + text : Uncaught + } + result : { + className : EvalError + description : EvalError: Code generation from strings disallowed for this context at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object + } + } +} +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + className : EvalError + description : EvalError: Code generation from strings disallowed for this context at new Function (<anonymous>) at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 0 + scriptId : <scriptId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 0 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + text : Uncaught + } + result : { + className : EvalError + description : EvalError: Code generation from strings disallowed for this context at new Function (<anonymous>) at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object + } + } +} + Running test: testCallFunctionOn { id : <messageId> diff --git a/deps/v8/test/inspector/debugger/eval-without-codegen.js b/deps/v8/test/inspector/debugger/eval-without-codegen.js index f7db46136d..a6a67b167e 100644 --- a/deps/v8/test/inspector/debugger/eval-without-codegen.js +++ b/deps/v8/test/inspector/debugger/eval-without-codegen.js @@ -36,6 +36,24 @@ InspectorTest.runAsyncTestSuite([ await Protocol.Debugger.resume(); }, + async function testEvaluateUnsafeEval() { + contextGroup.addScript(`inspector.setAllowCodeGenerationFromStrings(false);`); + await Protocol.Debugger.onceScriptParsed(); + InspectorTest.logMessage( + await Protocol.Runtime.evaluate({expression: 'eval("1+1")'})); + InspectorTest.logMessage( + await Protocol.Runtime.evaluate({expression: 'new Function("return 1+1")()'})); + }, + + async function testEvaluateUnsafeEvalDisableBypass() { + contextGroup.addScript(`inspector.setAllowCodeGenerationFromStrings(false);`); + await Protocol.Debugger.onceScriptParsed(); + InspectorTest.logMessage( + await Protocol.Runtime.evaluate({expression: 'eval("1+1")', allowUnsafeEvalBlockedByCSP: false})); + InspectorTest.logMessage( + await Protocol.Runtime.evaluate({expression: 'new Function("return 1+1")()', allowUnsafeEvalBlockedByCSP: false})); + }, + async function testCallFunctionOn() { await contextGroup.addScript(`inspector.setAllowCodeGenerationFromStrings(false);`); const globalObject = await Protocol.Runtime.evaluate({expression: 'this'}); diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt index 359282b851..b92951747c 100644 --- a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt @@ -108,14 +108,14 @@ Running test: testConsoleLog functionName : eval lineNumber : 0 scriptId : <scriptId> - url : + url : } [1] : { columnNumber : 0 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -232,7 +232,7 @@ ReleaseObject with invalid params. { error : { code : -32602 - data : objectId: string value expected + data : Failed to deserialize params.objectId - BINDINGS: mandatory field missing at <some position> message : Invalid parameters } id : <messageId> @@ -299,7 +299,7 @@ ReleaseObjectGroup with invalid params { error : { code : -32602 - data : objectGroup: string value expected + data : Failed to deserialize params.objectGroup - BINDINGS: mandatory field missing at <some position> message : Invalid parameters } id : <messageId> @@ -327,7 +327,7 @@ Running test: testCallFrameIdTypeError { error : { code : -32602 - data : callFrameId: string value expected + data : Failed to deserialize params.callFrameId - BINDINGS: string value expected at <some position> message : Invalid parameters } id : <messageId> @@ -347,7 +347,7 @@ Running test: testNullExpression { error : { code : -32602 - data : expression: string value expected + data : Failed to deserialize params.expression - BINDINGS: string value expected at <some position> message : Invalid parameters } id : <messageId> diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js index e0cc5344b7..e3cc285d2f 100644 --- a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js @@ -66,7 +66,7 @@ const {Protocol} = InspectorTest.start( async function testReleaseObjectInvalid() { const releaseObjectResult = await Protocol.Runtime.releaseObject({}); InspectorTest.log('ReleaseObject with invalid params.'); - InspectorTest.logMessage(releaseObjectResult); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(releaseObjectResult)); }, async function testObjectGroups() { await Protocol.Runtime.evaluate({ expression: 'var a = {x:3};', callFrameId }); @@ -89,7 +89,7 @@ const {Protocol} = InspectorTest.start( async function testReleaseObjectGroupInvalid() { const releaseObjectGroupResult = await Protocol.Runtime.releaseObjectGroup({}); InspectorTest.log('ReleaseObjectGroup with invalid params'); - InspectorTest.logMessage(releaseObjectGroupResult); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(releaseObjectGroupResult)); }, async function testEvaluateSyntaxError() { const result = await Protocol.Debugger.evaluateOnCallFrame({ expression: `[]]`, callFrameId }); @@ -101,7 +101,7 @@ const {Protocol} = InspectorTest.start( }, async function testCallFrameIdTypeError() { const result = await Protocol.Debugger.evaluateOnCallFrame({ expression: `console.log(42)`, callFrameId: {} }); - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); }, async function testCallFrameIdInvalidInput() { InspectorTest.log('Testing evaluateOnCallFrame with non-existent callFrameId'); @@ -115,7 +115,7 @@ const {Protocol} = InspectorTest.start( async function evalAndLog(expression, callFrameId, returnByValue) { const result = await Protocol.Debugger.evaluateOnCallFrame({ expression, callFrameId, returnByValue }); - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); } // Helper function that calls a function on all objects with ids in objectIds, then returns diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt index 374507cbea..78c650dd8c 100644 --- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt @@ -2,6 +2,7 @@ getPossibleBreakpoints should not crash during lazy compilation (crbug.com/71533 { method : Debugger.scriptFailedToParse params : { + embedderName : endColumn : 23 endLine : 2 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt b/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt index ad655f5dba..b7e4877145 100644 --- a/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt +++ b/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt @@ -87,3 +87,5 @@ Running test: testArrayBufferWithBrokenUintCtor [[Int8Array]] own object undefined [[Uint8Array]] own object undefined __proto__ own object undefined +Internal properties + [[IsDetached]] boolean false diff --git a/deps/v8/test/inspector/debugger/limit-size-of-collected-scripts.js b/deps/v8/test/inspector/debugger/limit-size-of-collected-scripts.js index e9969e5f62..e8f196aec2 100644 --- a/deps/v8/test/inspector/debugger/limit-size-of-collected-scripts.js +++ b/deps/v8/test/inspector/debugger/limit-size-of-collected-scripts.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --no-stress-incremental-marking + let {session, contextGroup, Protocol} = InspectorTest.start( 'Checks that inspector does not retain old collected scripts.\n'); diff --git a/deps/v8/test/inspector/debugger/not-hold-promises.js b/deps/v8/test/inspector/debugger/not-hold-promises.js index 815b618bfe..5ad54627ea 100644 --- a/deps/v8/test/inspector/debugger/not-hold-promises.js +++ b/deps/v8/test/inspector/debugger/not-hold-promises.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --no-stress-incremental-marking + let {session, contextGroup, Protocol} = InspectorTest.start('Tests that we don\'t hold promises.'); diff --git a/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt b/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt index bdeb37bccf..be4e104424 100644 --- a/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt +++ b/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt @@ -40,24 +40,24 @@ expression: Object(BigInt(2)) Running test: promise expression: Promise.resolve(42) { - name : [[PromiseStatus]] + name : [[PromiseState]] type : string value : fulfilled } { - name : [[PromiseValue]] + name : [[PromiseResult]] type : number value : 42 } expression: new Promise(() => undefined) { - name : [[PromiseStatus]] + name : [[PromiseState]] type : string value : pending } { - name : [[PromiseValue]] + name : [[PromiseResult]] type : undefined value : undefined } @@ -66,7 +66,7 @@ expression: new Promise(() => undefined) Running test: generatorObject expression: (function* foo() { yield 1 })() { - name : [[GeneratorStatus]] + name : [[GeneratorState]] type : string value : suspended } @@ -249,12 +249,12 @@ expression: ({}) Running test: overridenArrayGetter expression: Promise.resolve(42) { - name : [[PromiseStatus]] + name : [[PromiseState]] type : string value : fulfilled } { - name : [[PromiseValue]] + name : [[PromiseResult]] type : number value : 42 } diff --git a/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt b/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt index a4ff85895e..9e26f2bdd4 100644 --- a/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt +++ b/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt @@ -3,6 +3,7 @@ Check script with url: { method : Debugger.scriptParsed params : { + embedderName : prefix://url endColumn : 16 endLine : 0 executionContextId : <executionContextId> @@ -23,6 +24,7 @@ Check script with sourceURL comment: { method : Debugger.scriptParsed params : { + embedderName : prefix://url endColumn : 37 endLine : 0 executionContextId : <executionContextId> @@ -43,6 +45,7 @@ Check script failed to parse: { method : Debugger.scriptFailedToParse params : { + embedderName : prefix://url endColumn : 15 endLine : 0 executionContextId : <executionContextId> @@ -62,6 +65,7 @@ Check script failed to parse with sourceURL comment: { method : Debugger.scriptFailedToParse params : { + embedderName : prefix://url endColumn : 36 endLine : 0 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt b/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt index 789221a27f..1a81a8b5ea 100644 --- a/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt +++ b/deps/v8/test/inspector/debugger/script-on-after-compile-expected.txt @@ -4,6 +4,7 @@ scriptParsed scriptSource : function foo1(){}//# sourceURL=oneline.js<nl> } { + embedderName : endColumn : 0 endLine : 1 executionContextId : <executionContextId> @@ -24,6 +25,7 @@ scriptParsed scriptSource : function foo2(){}//# sourceURL=oneline-without-nl.js } { + embedderName : endColumn : 52 endLine : 0 executionContextId : <executionContextId> @@ -44,6 +46,7 @@ scriptParsed scriptSource : function foo3(){}<nl>//# sourceURL=twoline.js<nl> } { + embedderName : endColumn : 0 endLine : 2 executionContextId : <executionContextId> @@ -64,6 +67,7 @@ scriptParsed scriptSource : function foo4(){}<nl><nl>//# sourceURL=threeline.js<nl> } { + embedderName : endColumn : 0 endLine : 3 executionContextId : <executionContextId> @@ -84,6 +88,7 @@ scriptParsed scriptSource : function foo5(){}//# sourceMappingURL=oneline-map<nl> } { + embedderName : endColumn : 0 endLine : 1 executionContextId : <executionContextId> @@ -104,6 +109,7 @@ scriptParsed scriptSource : function foo6(){}//# sourceMappingURL=oneline-without-nl-map } { + embedderName : endColumn : 60 endLine : 0 executionContextId : <executionContextId> @@ -124,6 +130,7 @@ scriptParsed scriptSource : function foo7(){}<nl>//# sourceMappingURL=twoline-map<nl> } { + embedderName : endColumn : 0 endLine : 2 executionContextId : <executionContextId> @@ -144,6 +151,7 @@ scriptParsed scriptSource : function foo8(){}<nl><nl>//# sourceMappingURL=threeline-map<nl> } { + embedderName : endColumn : 0 endLine : 3 executionContextId : <executionContextId> @@ -164,6 +172,7 @@ scriptParsed scriptSource : function foo9(){}//# sourceMappingURL=source-mapping-url-map<nl>//# sourceURL=source-url.js } { + embedderName : endColumn : 27 endLine : 1 executionContextId : <executionContextId> @@ -184,6 +193,7 @@ scriptParsed scriptSource : function foo10(){}//# sourceURL=source-url.js<nl>//# sourceMappingURL=source-mapping-url-map } { + embedderName : endColumn : 43 endLine : 1 executionContextId : <executionContextId> @@ -204,6 +214,7 @@ scriptParsed scriptSource : function foo11(){}<nl>//# sourceURL=end1.js } { + embedderName : endColumn : 21 endLine : 1 executionContextId : <executionContextId> @@ -224,6 +235,7 @@ scriptParsed scriptSource : function foo12(){}<nl>//# sourceURL=end2.js } { + embedderName : endColumn : 22 endLine : 1 executionContextId : <executionContextId> @@ -244,6 +256,7 @@ scriptParsed scriptSource : function foo13(){} } { + embedderName : endColumn : 18 endLine : 0 executionContextId : <executionContextId> @@ -264,6 +277,7 @@ scriptParsed scriptSource : function foo15(){}; eval("function foo14(){}//# sourceURL=eval.js")//# sourceURL=eval-wrapper.js } { + embedderName : endColumn : 96 endLine : 0 executionContextId : <executionContextId> @@ -284,6 +298,7 @@ scriptParsed scriptSource : function foo14(){}//# sourceURL=eval.js } { + embedderName : endColumn : 39 endLine : 0 executionContextId : <executionContextId> @@ -304,6 +319,7 @@ scriptParsed scriptSource : function foo16(){}<nl> } { + embedderName : endColumn : 0 endLine : 1 executionContextId : <executionContextId> @@ -324,6 +340,7 @@ scriptParsed scriptSource : function foo17(){}<nl><nl> } { + embedderName : endColumn : 0 endLine : 2 executionContextId : <executionContextId> @@ -344,6 +361,7 @@ scriptParsed scriptSource : function foo18(){}<nl><nl><nl> } { + embedderName : endColumn : 0 endLine : 3 executionContextId : <executionContextId> @@ -364,6 +382,7 @@ scriptParsed scriptSource : function foo19(){}<nl><nl><nl><nl> } { + embedderName : endColumn : 0 endLine : 4 executionContextId : <executionContextId> @@ -384,6 +403,7 @@ scriptParsed scriptSource : function foo1(){}//# sourceURL=oneline.js<nl> } { + embedderName : endColumn : 0 endLine : 1 executionContextId : <executionContextId> @@ -404,6 +424,7 @@ scriptParsed scriptSource : function foo2(){}//# sourceURL=oneline-without-nl.js } { + embedderName : endColumn : 52 endLine : 0 executionContextId : <executionContextId> @@ -424,6 +445,7 @@ scriptParsed scriptSource : function foo3(){}<nl>//# sourceURL=twoline.js<nl> } { + embedderName : endColumn : 0 endLine : 2 executionContextId : <executionContextId> @@ -444,6 +466,7 @@ scriptParsed scriptSource : function foo4(){}<nl><nl>//# sourceURL=threeline.js<nl> } { + embedderName : endColumn : 0 endLine : 3 executionContextId : <executionContextId> @@ -464,6 +487,7 @@ scriptParsed scriptSource : function foo5(){}//# sourceMappingURL=oneline-map<nl> } { + embedderName : endColumn : 0 endLine : 1 executionContextId : <executionContextId> @@ -484,6 +508,7 @@ scriptParsed scriptSource : function foo6(){}//# sourceMappingURL=oneline-without-nl-map } { + embedderName : endColumn : 60 endLine : 0 executionContextId : <executionContextId> @@ -504,6 +529,7 @@ scriptParsed scriptSource : function foo7(){}<nl>//# sourceMappingURL=twoline-map<nl> } { + embedderName : endColumn : 0 endLine : 2 executionContextId : <executionContextId> @@ -524,6 +550,7 @@ scriptParsed scriptSource : function foo8(){}<nl><nl>//# sourceMappingURL=threeline-map<nl> } { + embedderName : endColumn : 0 endLine : 3 executionContextId : <executionContextId> @@ -544,6 +571,7 @@ scriptParsed scriptSource : function foo9(){}//# sourceMappingURL=source-mapping-url-map<nl>//# sourceURL=source-url.js } { + embedderName : endColumn : 27 endLine : 1 executionContextId : <executionContextId> @@ -564,6 +592,7 @@ scriptParsed scriptSource : function foo10(){}//# sourceURL=source-url.js<nl>//# sourceMappingURL=source-mapping-url-map } { + embedderName : endColumn : 43 endLine : 1 executionContextId : <executionContextId> @@ -584,6 +613,7 @@ scriptParsed scriptSource : function foo11(){}<nl>//# sourceURL=end1.js } { + embedderName : endColumn : 21 endLine : 1 executionContextId : <executionContextId> @@ -604,6 +634,7 @@ scriptParsed scriptSource : function foo12(){}<nl>//# sourceURL=end2.js } { + embedderName : endColumn : 22 endLine : 1 executionContextId : <executionContextId> @@ -624,6 +655,7 @@ scriptParsed scriptSource : function foo13(){} } { + embedderName : endColumn : 18 endLine : 0 executionContextId : <executionContextId> @@ -644,6 +676,7 @@ scriptParsed scriptSource : function foo15(){}; eval("function foo14(){}//# sourceURL=eval.js")//# sourceURL=eval-wrapper.js } { + embedderName : endColumn : 96 endLine : 0 executionContextId : <executionContextId> @@ -664,6 +697,7 @@ scriptParsed scriptSource : function foo14(){}//# sourceURL=eval.js } { + embedderName : endColumn : 39 endLine : 0 executionContextId : <executionContextId> @@ -695,6 +729,7 @@ scriptFailedToParse scriptSource : {a:2:<nl>//# sourceURL=http://a.js } { + embedderName : endColumn : 25 endLine : 1 executionContextId : <executionContextId> @@ -714,6 +749,7 @@ scriptFailedToParse scriptSource : }//# sourceURL=failed.js<nl>//# sourceMappingURL=failed-map } { + embedderName : endColumn : 31 endLine : 1 executionContextId : <executionContextId> @@ -733,6 +769,7 @@ scriptParsed scriptSource : function foo16(){}<nl> } { + embedderName : endColumn : 0 endLine : 1 executionContextId : <executionContextId> @@ -753,6 +790,7 @@ scriptParsed scriptSource : function foo17(){}<nl><nl> } { + embedderName : endColumn : 0 endLine : 2 executionContextId : <executionContextId> @@ -773,6 +811,7 @@ scriptParsed scriptSource : function foo18(){}<nl><nl><nl> } { + embedderName : endColumn : 0 endLine : 3 executionContextId : <executionContextId> @@ -793,6 +832,7 @@ scriptParsed scriptSource : function foo19(){}<nl><nl><nl><nl> } { + embedderName : endColumn : 0 endLine : 4 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/script-on-after-compile.js b/deps/v8/test/inspector/debugger/script-on-after-compile.js index b37bfddf44..dddc2dc717 100644 --- a/deps/v8/test/inspector/debugger/script-on-after-compile.js +++ b/deps/v8/test/inspector/debugger/script-on-after-compile.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --no-stress-incremental-marking + let {session, contextGroup, Protocol} = InspectorTest.start("Checks that inspector correctly process compiled scripts"); function addScripts() { diff --git a/deps/v8/test/inspector/debugger/script-origin-stack-expected.txt b/deps/v8/test/inspector/debugger/script-origin-stack-expected.txt index f03a2ee524..9d46107de0 100644 --- a/deps/v8/test/inspector/debugger/script-origin-stack-expected.txt +++ b/deps/v8/test/inspector/debugger/script-origin-stack-expected.txt @@ -2,6 +2,7 @@ Debugger.scriptParsed.stackTrace should contain only one frame { method : Debugger.scriptParsed params : { + embedderName : endColumn : 0 endLine : 0 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate-expected.txt b/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate-expected.txt index 9fa4fd4f6f..c89a99a9db 100644 --- a/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate-expected.txt +++ b/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate-expected.txt @@ -3,6 +3,7 @@ Runtime.evaluate with valid expression { method : Debugger.scriptParsed params : { + embedderName : endColumn : 29 endLine : 0 executionContextId : <executionContextId> @@ -23,6 +24,7 @@ Runtime.evaluate with syntax error { method : Debugger.scriptFailedToParse params : { + embedderName : endColumn : 39 endLine : 0 executionContextId : <executionContextId> @@ -42,6 +44,7 @@ Runtime.callFunctionOn with valid functionDeclaration { method : Debugger.scriptParsed params : { + embedderName : endColumn : 18 endLine : 0 executionContextId : <executionContextId> @@ -62,6 +65,7 @@ Runtime.callFunctionOn with syntax error { method : Debugger.scriptFailedToParse params : { + embedderName : endColumn : 3 endLine : 0 executionContextId : <executionContextId> @@ -81,6 +85,7 @@ Runtime.compileScript with valid expression { method : Debugger.scriptParsed params : { + embedderName : compile-script.js endColumn : 4 endLine : 0 executionContextId : <executionContextId> @@ -101,6 +106,7 @@ Runtime.compileScript with syntax error { method : Debugger.scriptFailedToParse params : { + embedderName : compile-script-syntax-error.js endColumn : 1 endLine : 0 executionContextId : <executionContextId> @@ -121,6 +127,7 @@ Runtime.evaluate compiled script with stack trace { method : Debugger.scriptParsed params : { + embedderName : endColumn : 8 endLine : 0 executionContextId : <executionContextId> @@ -140,6 +147,7 @@ Runtime.evaluate compiled script with stack trace { method : Debugger.scriptParsed params : { + embedderName : endColumn : 39 endLine : 4 executionContextId : <executionContextId> @@ -170,6 +178,7 @@ Runtime.evaluate compiled script with stack trace { method : Debugger.scriptParsed params : { + embedderName : endColumn : 4 endLine : 0 executionContextId : <executionContextId> @@ -201,6 +210,7 @@ Runtime.evaluate compile script error with stack trace { method : Debugger.scriptParsed params : { + embedderName : endColumn : 12 endLine : 0 executionContextId : <executionContextId> @@ -220,6 +230,7 @@ Runtime.evaluate compile script error with stack trace { method : Debugger.scriptParsed params : { + embedderName : endColumn : 48 endLine : 4 executionContextId : <executionContextId> @@ -250,6 +261,7 @@ Runtime.evaluate compile script error with stack trace { method : Debugger.scriptFailedToParse params : { + embedderName : endColumn : 3 endLine : 0 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt b/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt index a4c012d368..ae01b16893 100644 --- a/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt +++ b/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt @@ -1,5 +1,6 @@ Tests scripts hasing { + embedderName : foo1.js endColumn : 1 endLine : 0 executionContextId : <executionContextId> @@ -16,6 +17,7 @@ Tests scripts hasing url : foo1.js } { + embedderName : foo2.js endColumn : 3 endLine : 0 executionContextId : <executionContextId> @@ -32,6 +34,7 @@ Tests scripts hasing url : foo2.js } { + embedderName : foo3.js endColumn : 8106 endLine : 0 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt index 26017349ef..02bfe0d80c 100644 --- a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt +++ b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt @@ -3,5 +3,5 @@ setBreakpointByUrl error: undefined setBreakpoint error: { "code": -32602, "message": "Invalid parameters", - "data": "location: object expected" + "data": "Failed to deserialize params.location - BINDINGS: mandatory field missing at <some position>" } diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js index 84541be37d..5af1085c87 100644 --- a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js +++ b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js @@ -8,12 +8,14 @@ Protocol.Debugger.setBreakpointByUrl({ url: "http://example.com", lineNumber: 10 function didSetBreakpointByUrlBeforeEnable(message) { - InspectorTest.log("setBreakpointByUrl error: " + JSON.stringify(message.error, null, 2)); + InspectorTest.log("setBreakpointByUrl error: " + JSON.stringify( + InspectorTest.trimErrorMessage(message).error, null, 2)); Protocol.Debugger.setBreakpoint().then(didSetBreakpointBeforeEnable); } function didSetBreakpointBeforeEnable(message) { - InspectorTest.log("setBreakpoint error: " + JSON.stringify(message.error, null, 2)); + InspectorTest.log("setBreakpoint error: " + JSON.stringify( + InspectorTest.trimErrorMessage(message).error, null, 2)); InspectorTest.completeTest(); } diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-breaks-on-first-breakable-location-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-breaks-on-first-breakable-location-expected.txt new file mode 100644 index 0000000000..5f7fa80a97 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-breaks-on-first-breakable-location-expected.txt @@ -0,0 +1,13 @@ +Tests if breakpoint set is first breakable location +Set breakpoint outside of any function: (0, 0). +Setting breakpoint for id: 3 at 0, 0. +No breakable location inside a function was found +Set breakpoint adds a breakpoint at (8, 1). +Set breakpoint at a breakable location: (4, 17). +Setting breakpoint for id: 3 at 4, 17. +Location match for (4, 17). +Initial location is expected to be breakable: true. +Set breakpoint at non-breakable location: (7, 0). +Setting breakpoint for id: 3 at 7, 0. +Location match for (7, 2). +Initial location is expected to be breakable: false.
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-breaks-on-first-breakable-location.js b/deps/v8/test/inspector/debugger/set-breakpoint-breaks-on-first-breakable-location.js new file mode 100644 index 0000000000..fba1710c05 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-breaks-on-first-breakable-location.js @@ -0,0 +1,111 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests if breakpoint set is first breakable location'); + +const source = ` +// Add a comment to test a break location that is +// outside of a function. +function foo() { + return Promise.resolve(); +} +function boo() { + return Promise.resolve().then(() => 42); +}`; + +contextGroup.addScript(source); +Protocol.Debugger.enable(); + +runTest() + .catch(reason => InspectorTest.log(`Failed: ${reason}.`)) + .then(InspectorTest.completeTest); + +async function runTest() { + const {params: script} = await Protocol.Debugger.onceScriptParsed(); + await checkSetBreakpointForScript(script.scriptId); +} + +async function checkSetBreakpointForScript(scriptId) { + // If we try to set a breakpoint that is outside of any function, + // setBreakpoint will find the first breakable location outside of any + // functions. If there is none, then it sets a breakpoint at the end of the + // script. + InspectorTest.log('Set breakpoint outside of any function: (0, 0).'); + await checkSetBreakpointIsFirstBreakableLocation(scriptId, 0, 0, undefined); + + // If we try to set a breakpoint that is inside of a function and + // the location is breakable, setBreakpoint is expected to add + // a breakpoint at that location. + InspectorTest.log('Set breakpoint at a breakable location: (4, 17).'); + let breakable = true; + await checkSetBreakpointIsFirstBreakableLocation(scriptId, 4, 17, breakable); + + // If we try to set a breakpoint that is inside of a function and + // the location is not breakable, setBreakpoint is expected to add + // a breakpoint at the next breakable location. + InspectorTest.log('Set breakpoint at non-breakable location: (7, 0).') + breakable = false; + await checkSetBreakpointIsFirstBreakableLocation(scriptId, 7, 0, breakable); +} + +async function checkSetBreakpointIsFirstBreakableLocation( + scriptId, lineNumber, columnNumber, breakable) { + const possibleLocationsMsg = await Protocol.Debugger.getPossibleBreakpoints({ + start: { + lineNumber: lineNumber, + columnNumber: columnNumber, + scriptId: scriptId + }, + end: { + lineNumber: lineNumber + 1, + columnNumber: columnNumber, + scriptId: scriptId + } + }); + const setLocationMsg = + await setBreakpoint(scriptId, lineNumber, columnNumber); + const setLocation = setLocationMsg.result.actualLocation; + + if (possibleLocationsMsg.result.locations.length === 0) { + InspectorTest.log('No breakable location inside a function was found'); + InspectorTest.log(`Set breakpoint adds a breakpoint at (${ + setLocation.lineNumber}, ${setLocation.columnNumber}).`); + return; + } + const possibleLocations = possibleLocationsMsg.result.locations; + + // Check that setting a breakpoint at a line actually + // sets the breakpoint at the first breakable location. + locationIsEqual(setLocation, possibleLocations[0]); + + // Make sure that the selected locations for the test + // are breakable/non breakable as expected. + if (breakable === + (setLocation.lineNumber === lineNumber && + setLocation.columnNumber === columnNumber)) { + InspectorTest.log( + `Initial location is expected to be breakable: ${breakable}.`); + }; +} + +function locationIsEqual(locA, locB) { + if (locA.lineNumber === locB.lineNumber && + locA.columnNumber === locB.columnNumber) { + InspectorTest.log( + `Location match for (${locA.lineNumber}, ${locA.columnNumber}).`); + } +} + +async function setBreakpoint(id, lineNumber, columnNumber) { + InspectorTest.log( + `Setting breakpoint for id: ${id} at ${lineNumber}, ${columnNumber}.`); + const location = { + scriptId: id, + lineNumber: lineNumber, + columnNumber: columnNumber + }; + const msg = await Protocol.Debugger.setBreakpoint({location: location}); + return msg; +} diff --git a/deps/v8/test/inspector/debugger/set-script-source-unchanged-expected.txt b/deps/v8/test/inspector/debugger/set-script-source-unchanged-expected.txt new file mode 100644 index 0000000000..13e3fbcf81 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-script-source-unchanged-expected.txt @@ -0,0 +1 @@ +Check that setScriptSource does not crash when source is unchanged diff --git a/deps/v8/test/inspector/debugger/set-script-source-unchanged.js b/deps/v8/test/inspector/debugger/set-script-source-unchanged.js new file mode 100644 index 0000000000..bef4d8aaa1 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-script-source-unchanged.js @@ -0,0 +1,16 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = + InspectorTest.start('Check that setScriptSource does not crash when source is unchanged'); + +let scriptSource = `function TestExpression() {}`; +contextGroup.addScript(scriptSource); + +(async function test() { + Protocol.Debugger.enable(); + const {params: {scriptId}} = await Protocol.Debugger.onceScriptParsed(); + await Protocol.Debugger.setScriptSource({scriptId, scriptSource}); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/set-variable-value-expected.txt b/deps/v8/test/inspector/debugger/set-variable-value-expected.txt index 33bdfd1706..b50adf7a58 100644 --- a/deps/v8/test/inspector/debugger/set-variable-value-expected.txt +++ b/deps/v8/test/inspector/debugger/set-variable-value-expected.txt @@ -218,7 +218,7 @@ setVariableValue with invalid scopeNumber { error : { code : -32602 - data : scopeNumber: integer value expected + data : Failed to deserialize params.scopeNumber - BINDINGS: int32 value expected at <some position> message : Invalid parameters } id : <messageId> @@ -253,8 +253,8 @@ setVariableValue with invalid objectId { error : { code : -32602 - data : newValue.objectId: string value expected + data : Failed to deserialize params.newValue.objectId - BINDINGS: string value expected at <some position> message : Invalid parameters } id : <messageId> -}
\ No newline at end of file +} diff --git a/deps/v8/test/inspector/debugger/set-variable-value.js b/deps/v8/test/inspector/debugger/set-variable-value.js index 48bde89fbf..a9c08a84c7 100644 --- a/deps/v8/test/inspector/debugger/set-variable-value.js +++ b/deps/v8/test/inspector/debugger/set-variable-value.js @@ -66,24 +66,24 @@ const { contextGroup, Protocol } = InspectorTest.start( async function testInvalidFrame() { let result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId: 'fakeCallFrame' }); InspectorTest.log('setVariableValue with invalid callFrameId'); - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); result = await Protocol.Debugger.setVariableValue({ scopeNumber: 'invalidScopeType', variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId }); InspectorTest.log('setVariableValue with invalid scopeNumber') - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); result = await Protocol.Debugger.setVariableValue({ scopeNumber: 1000, variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId }); InspectorTest.log('setVariableValue with invalid scopeNumber'); InspectorTest.logMessage(result); result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'FakeObjectName', newValue: { unserializableValue: 'NaN' }, callFrameId }); InspectorTest.log('setVariableValue with invalid variableName'); - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); }, async function testNewValueErrors() { let result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { unserializableValue: 'not unserializable value' }, callFrameId }); InspectorTest.log('setVariableValue with invalid unserializableValue'); - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { objectId: 2000 }, callFrameId }); InspectorTest.log('setVariableValue with invalid objectId'); - InspectorTest.logMessage(result); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(result)); } ]); diff --git a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt deleted file mode 100644 index 454d319639..0000000000 --- a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -Tests side-effect-free evaluation with coverage enabled -Paused on 'debugger;' -f() returns 1 diff --git a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js deleted file mode 100644 index ffa8645228..0000000000 --- a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2020 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation with coverage enabled'); - -contextGroup.addScript(` -function testFunction() -{ - var o = 0; - function f() { return 1; } - function g() { o = 2; return o; } - f,g; - debugger; -} -//# sourceURL=foo.js`); - -// Side effect free call should not result in EvalError when coverage -// is enabled: -Protocol.Profiler.enable() -Protocol.Profiler.startPreciseCoverage({callCount: true, detailed: true}) - -Protocol.Debugger.enable(); - -Protocol.Debugger.oncePaused().then(debuggerPaused); - -Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); - -var topFrameId; - -function debuggerPaused(messageObject) -{ - InspectorTest.log("Paused on 'debugger;'"); - - topFrameId = messageObject.params.callFrames[0].callFrameId; - Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "f()", throwOnSideEffect: true}).then(evaluatedFirst); -} - -function evaluatedFirst(response) -{ - InspectorTest.log("f() returns " + response.result.result.value); - InspectorTest.completeTest(); -} diff --git a/deps/v8/test/inspector/debugger/stepping-with-skiplist-expected.txt b/deps/v8/test/inspector/debugger/stepping-with-skiplist-expected.txt new file mode 100644 index 0000000000..10a668ee30 --- /dev/null +++ b/deps/v8/test/inspector/debugger/stepping-with-skiplist-expected.txt @@ -0,0 +1,111 @@ +Tests that stepOver and stepInto correctly handle skipLists. +Test: Stepping over without skip list +Testing stepOver with skipList: [] +test: 1:2 +test: 2:10 +test: 3:12 +test: 4:2 +test: 5:4 +test: 7:10 +test: 8:2 +test: 9:13 +Test: Stepping over with skip list +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":4,"columnNumber":0}},{"scriptId":"3","start":{"lineNumber":8,"columnNumber":0},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +test: 4:2 +test: 5:4 +test: 7:10 +test: 9:13 +Test: Stepping over start location is inclusive +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":8,"columnNumber":2},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +test: 2:10 +test: 3:12 +test: 4:2 +test: 5:4 +test: 7:10 +test: 9:13 +Test: Stepping over end location is exclusive +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":8,"columnNumber":2}}] +test: 1:2 +test: 8:2 +test: 9:13 +Test: Stepping into without skip list +Testing stepInto with skipList: [] +test: 1:2 +test: 2:10 +test: 3:12 +test: 4:2 +test: 5:4 +test: 7:10 +test: 8:2 +add: 1:12 +add: 2:13 +test: 9:13 +Test: Stepping into with skip list, while call itself is skipped +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":1,"columnNumber":0},"end":{"lineNumber":2,"columnNumber":0}},{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +add: 2:13 +test: 9:13 +Test: Stepping into start location is inclusive +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":2,"columnNumber":13},"end":{"lineNumber":3,"columnNumber":0}}] +test: 1:2 +test: 2:10 +test: 3:12 +test: 4:2 +test: 5:4 +test: 7:10 +test: 8:2 +add: 1:12 +test: 9:13 +Test: Stepping into end location is exclusive +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":1,"columnNumber":0},"end":{"lineNumber":2,"columnNumber":13}}] +test: 1:2 +test: 2:10 +test: 3:12 +test: 4:2 +test: 5:4 +test: 7:10 +test: 8:2 +add: 2:13 +test: 9:13 +Test: start position has invalid column number +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":2,"columnNumber":-1},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +Position missing 'column' or 'column' < 0. +Test: start position has invalid line number +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":-1,"columnNumber":0},"end":{"lineNumber":2,"columnNumber":0}}] +test: 1:2 +Position missing 'line' or 'line' < 0. +Test: end position smaller than start position +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":4,"columnNumber":0},"end":{"lineNumber":2,"columnNumber":0}}] +test: 1:2 +Input positions array is not sorted or contains duplicate values. +Test: skip list is not maximally merged +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":4,"columnNumber":0}},{"scriptId":"3","start":{"lineNumber":4,"columnNumber":0},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +Input positions array is not sorted or contains duplicate values. +Test: skip list is not sorted +Testing stepOver with skipList: [{"scriptId":"3","start":{"lineNumber":8,"columnNumber":0},"end":{"lineNumber":9,"columnNumber":0}},{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":4,"columnNumber":0}}] +test: 1:2 +Input positions array is not sorted or contains duplicate values. +Test: start position has invalid column number +Testing stepInto with skipList: [{"scriptId":"3","start":{"lineNumber":2,"columnNumber":-1},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +Position missing 'column' or 'column' < 0. +Test: start position has invalid line number +Testing stepInto with skipList: [{"scriptId":"3","start":{"lineNumber":-1,"columnNumber":0},"end":{"lineNumber":2,"columnNumber":0}}] +test: 1:2 +Position missing 'line' or 'line' < 0. +Test: end position smaller than start position +Testing stepInto with skipList: [{"scriptId":"3","start":{"lineNumber":4,"columnNumber":0},"end":{"lineNumber":2,"columnNumber":0}}] +test: 1:2 +Input positions array is not sorted or contains duplicate values. +Test: skip list is not maximally merged +Testing stepInto with skipList: [{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":4,"columnNumber":0}},{"scriptId":"3","start":{"lineNumber":4,"columnNumber":0},"end":{"lineNumber":9,"columnNumber":0}}] +test: 1:2 +Input positions array is not sorted or contains duplicate values. +Test: skip list is not sorted +Testing stepInto with skipList: [{"scriptId":"3","start":{"lineNumber":8,"columnNumber":0},"end":{"lineNumber":9,"columnNumber":0}},{"scriptId":"3","start":{"lineNumber":2,"columnNumber":0},"end":{"lineNumber":4,"columnNumber":0}}] +test: 1:2 +Input positions array is not sorted or contains duplicate values. diff --git a/deps/v8/test/inspector/debugger/stepping-with-skiplist.js b/deps/v8/test/inspector/debugger/stepping-with-skiplist.js new file mode 100644 index 0000000000..1bfc2f4bf2 --- /dev/null +++ b/deps/v8/test/inspector/debugger/stepping-with-skiplist.js @@ -0,0 +1,180 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = InspectorTest.start( + 'Tests that stepOver and stepInto correctly handle skipLists.'); + +function test(input) { + debugger; + var a = 4; + var sum = 0; + if (input > 0) { + sum = a + input; + } + var b = 5; + sum = add(sum, b); + return sum; +} + +function add(a, b) { + var res = a + b; + return res; +} + +contextGroup.addScript(`${test} //# sourceURL=test.js`); +contextGroup.addScript(`${add}`); + +const first_non_debug_line_offset = 2; +const last_line_line_offset = 9; +const function_call_line_offset = 8; +const function_call_column_offset = 2; +const if_case_line_offset = 4; + +const add_first_line_line_offset = 1; +const add_last_line_line_offset = 2; +const add_last_line_column_offset = 13; + +Protocol.Debugger.enable(); +runTest() + .catch(reason => InspectorTest.log(`Failed: ${reason}`)) + .then(InspectorTest.completeTest); + +async function runTest() { + const response = await Protocol.Debugger.onceScriptParsed(2); + const scriptIds = response.map(msg => msg.params.scriptId); + + await checkValidSkipLists(scriptIds[0], scriptIds[1]); + await checkInvalidSkipLists(scriptIds[0]); +} + +async function checkInvalidSkipLists(scriptId) { + const actions = ['stepOver', 'stepInto']; + for (let action of actions) { + InspectorTest.log('Test: start position has invalid column number'); + let skipList = [createLocationRange( + scriptId, first_non_debug_line_offset, -1, last_line_line_offset, 0)]; + await testStep(skipList, action); + + InspectorTest.log('Test: start position has invalid line number'); + skipList = + [createLocationRange(scriptId, -1, 0, first_non_debug_line_offset, 0)]; + await testStep(skipList, action); + + InspectorTest.log('Test: end position smaller than start position'); + skipList = [createLocationRange( + scriptId, if_case_line_offset, 0, first_non_debug_line_offset, 0)]; + await testStep(skipList, action); + + InspectorTest.log('Test: skip list is not maximally merged'); + skipList = [ + createLocationRange( + scriptId, first_non_debug_line_offset, 0, if_case_line_offset, 0), + createLocationRange( + scriptId, if_case_line_offset, 0, last_line_line_offset, 0) + ]; + await testStep(skipList, action); + + InspectorTest.log('Test: skip list is not sorted'); + skipList = [ + createLocationRange( + scriptId, function_call_line_offset, 0, last_line_line_offset, 0), + createLocationRange( + scriptId, first_non_debug_line_offset, 0, if_case_line_offset, 0) + ]; + await testStep(skipList, action); + } +} + +async function checkValidSkipLists(testScriptId, addScriptId) { + InspectorTest.log('Test: Stepping over without skip list'); + await testStep([], 'stepOver'); + + InspectorTest.log('Test: Stepping over with skip list'); + let skipList = [ + createLocationRange( + testScriptId, first_non_debug_line_offset, 0, if_case_line_offset, 0), + createLocationRange( + testScriptId, function_call_line_offset, 0, last_line_line_offset, 0) + ]; + await testStep(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping over start location is inclusive'); + skipList = [createLocationRange( + testScriptId, function_call_line_offset, function_call_column_offset, + last_line_line_offset, 0)]; + await testStep(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping over end location is exclusive'); + skipList = [createLocationRange( + testScriptId, first_non_debug_line_offset, 0, function_call_line_offset, + function_call_column_offset)]; + await testStep(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping into without skip list'); + skipList = []; + await testStep(skipList, 'stepInto'); + + InspectorTest.log( + 'Test: Stepping into with skip list, while call itself is skipped'); + skipList = [ + createLocationRange( + addScriptId, add_first_line_line_offset, 0, add_last_line_line_offset, + 0), + createLocationRange( + testScriptId, first_non_debug_line_offset, 0, + function_call_line_offset + 1, 0), + ]; + await testStep(skipList, 'stepInto'); + + InspectorTest.log('Test: Stepping into start location is inclusive'); + skipList = [ + createLocationRange( + addScriptId, add_last_line_line_offset, add_last_line_column_offset, + add_last_line_line_offset + 1, 0), + ]; + await testStep(skipList, 'stepInto'); + + InspectorTest.log('Test: Stepping into end location is exclusive'); + skipList = [ + createLocationRange( + addScriptId, add_last_line_line_offset - 1, 0, + add_last_line_line_offset, add_last_line_column_offset), + ]; + await testStep(skipList, 'stepInto'); +} + +async function testStep(skipList, stepAction) { + InspectorTest.log( + `Testing ${stepAction} with skipList: ${JSON.stringify(skipList)}`); + Protocol.Runtime.evaluate({expression: 'test(5);'}); + while (true) { + const pausedMsg = await Protocol.Debugger.oncePaused(); + const topCallFrame = pausedMsg.params.callFrames[0]; + printCallFrame(topCallFrame); + if (topCallFrame.location.lineNumber == last_line_line_offset) break; + + const stepOverMsg = await Protocol.Debugger[stepAction]({skipList}); + if (stepOverMsg.error) { + InspectorTest.log(stepOverMsg.error.message); + Protocol.Debugger.resume(); + return; + } + } + await Protocol.Debugger.resume(); +} + +function createLocationRange( + scriptId, startLine, startColumn, endLine, endColumn) { + return { + scriptId: scriptId, + start: {lineNumber: startLine, columnNumber: startColumn}, + end: {lineNumber: endLine, columnNumber: endColumn} + } +} + +function printCallFrame(frame) { + InspectorTest.log( + frame.functionName + ': ' + frame.location.lineNumber + ':' + + frame.location.columnNumber); +} diff --git a/deps/v8/test/inspector/debugger/tdz-modules-scopes-expected.txt b/deps/v8/test/inspector/debugger/tdz-modules-scopes-expected.txt new file mode 100644 index 0000000000..3dff1b026d --- /dev/null +++ b/deps/v8/test/inspector/debugger/tdz-modules-scopes-expected.txt @@ -0,0 +1,45 @@ +Test module scope with variables in TDZ. +Debug break + Scope type: module + moduleLet : undefined + moduleConst : undefined + exportedModuleLet : undefined + exportedModuleConst : undefined +Debug break + Scope type: local + Scope type: module + exportedModuleLet : undefined + exportedModuleConst : undefined +Debug break + Scope type: module + moduleLet : 3 + moduleConst : 4 + exportedModuleLet : 1 + exportedModuleConst : 2 +Debug break + Scope type: local + Scope type: module + exportedModuleLet : 1 + exportedModuleConst : 2 +Debug break + Scope type: module + exportedModuleLet : 1 + exportedModuleConst : 2 + moduleLet : undefined + moduleConst : undefined +Debug break + Scope type: local + Scope type: module + exportedModuleLet : 1 + exportedModuleConst : 2 +Debug break + Scope type: module + exportedModuleLet : 1 + exportedModuleConst : 2 + moduleLet : 5 + moduleConst : 6 +Debug break + Scope type: local + Scope type: module + exportedModuleLet : 1 + exportedModuleConst : 2 diff --git a/deps/v8/test/inspector/debugger/tdz-modules-scopes.js b/deps/v8/test/inspector/debugger/tdz-modules-scopes.js new file mode 100644 index 0000000000..4c40ff2d38 --- /dev/null +++ b/deps/v8/test/inspector/debugger/tdz-modules-scopes.js @@ -0,0 +1,52 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-stress-opt --no-always-opt + +let {session, contextGroup, Protocol} = + InspectorTest.start('Test module scope with variables in TDZ.'); + + +Protocol.Debugger.enable(); + +contextGroup.addModule(` +debugger; +(function() { debugger })(); +let moduleLet = 3; +const moduleConst = 4; +export let exportedModuleLet = 1; +export const exportedModuleConst = 2; +export default 42 +debugger; +(function() { debugger })(); +`, "module1"); + +contextGroup.addModule(` +debugger; +(function() { debugger })(); +import { exportedModuleLet, exportedModuleConst } from 'module1'; +let moduleLet = 5; +const moduleConst = 6; +debugger; +(function() { debugger })(); +`, "module2"); + +(async function() { +for (let i =0; i < 8; i++) { + let message = await Protocol.Debugger.oncePaused(); + let scopeChain = message.params.callFrames[0].scopeChain; + let evalScopeObjectIds = []; + InspectorTest.log("Debug break"); + for (let scope of scopeChain) { + if (scope.type == "global") continue; + InspectorTest.log(` Scope type: ${scope.type}`); + let { result: { result: locals }} = await Protocol.Runtime.getProperties({ "objectId" : scope.object.objectId }); + for (let local of locals) { + InspectorTest.log(` ${local.name} : ${local.value.value}`); + } + } + await Protocol.Debugger.resume(); +} +InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/tdz-scopes-expected.txt b/deps/v8/test/inspector/debugger/tdz-scopes-expected.txt new file mode 100644 index 0000000000..af2150aab3 --- /dev/null +++ b/deps/v8/test/inspector/debugger/tdz-scopes-expected.txt @@ -0,0 +1,53 @@ +Test scopes with variables in TDZ. +Debug break + Scope type: block + blockLet : undefined + blockConst : undefined + contextBlockLet : undefined + contextBlockConst : undefined + Scope type: script + scriptLet : undefined + scriptConst : undefined +Debug break + Scope type: local + Scope type: block + contextBlockLet : undefined + contextBlockConst : undefined + Scope type: script + scriptLet : undefined + scriptConst : undefined +Debug break + Scope type: block + blockLet : 1 + blockConst : 2 + contextBlockLet : 3 + contextBlockConst : 4 + Scope type: script + scriptLet : undefined + scriptConst : undefined +Debug break + Scope type: local + Scope type: block + contextBlockLet : 3 + contextBlockConst : 4 + Scope type: script + scriptLet : undefined + scriptConst : undefined +Debug break + Scope type: script + scriptLet : undefined + scriptConst : undefined +Debug break + Scope type: local + Scope type: script + scriptLet : undefined + scriptConst : undefined +Debug break + Scope type: script + scriptLet : 1 + scriptConst : 2 +Debug break + Scope type: local + Scope type: script + scriptLet : 1 + scriptConst : 2 diff --git a/deps/v8/test/inspector/debugger/tdz-scopes.js b/deps/v8/test/inspector/debugger/tdz-scopes.js new file mode 100644 index 0000000000..9d12f4a380 --- /dev/null +++ b/deps/v8/test/inspector/debugger/tdz-scopes.js @@ -0,0 +1,50 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-stress-opt --no-always-opt + +let {session, contextGroup, Protocol} = + InspectorTest.start('Test scopes with variables in TDZ.'); + + +Protocol.Debugger.enable(); + +contextGroup.addScript(` +{ + debugger; + (function() { debugger })(); + let blockLet = 1; + const blockConst = 2; + let contextBlockLet = 3; + let contextBlockConst = 4; + _ => contextBlockConst + contextBlockLet; + debugger; + (function() { debugger })(); +} +debugger; +(function() { debugger })(); +let scriptLet = 1; +const scriptConst = 2; +debugger; +(function() { debugger })(); +`); + +(async function() { +for (let i =0; i < 8; i++) { + let message = await Protocol.Debugger.oncePaused(); + let scopeChain = message.params.callFrames[0].scopeChain; + let evalScopeObjectIds = []; + InspectorTest.log("Debug break"); + for (let scope of scopeChain) { + if (scope.type == "global") continue; + InspectorTest.log(` Scope type: ${scope.type}`); + let { result: { result: locals }} = await Protocol.Runtime.getProperties({ "objectId" : scope.object.objectId }); + for (let local of locals) { + InspectorTest.log(` ${local.name} : ${local.value.value}`); + } + } + await Protocol.Debugger.resume(); +} +InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/wasm-breakpoint-reset-on-debugger-restart.js b/deps/v8/test/inspector/debugger/wasm-breakpoint-reset-on-debugger-restart.js index 116f048dc3..f964eb0668 100644 --- a/deps/v8/test/inspector/debugger/wasm-breakpoint-reset-on-debugger-restart.js +++ b/deps/v8/test/inspector/debugger/wasm-breakpoint-reset-on-debugger-restart.js @@ -2,30 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + const {session, contextGroup, Protocol} = InspectorTest.start( 'Test that breakpoints do not survive a restart of the debugger.'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - const builder = new WasmModuleBuilder(); const func = builder.addFunction('func', kSig_v_v).addBody([kExprNop]).exportFunc(); -const module_bytes = JSON.stringify(builder.toArray()); - -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); -} -contextGroup.addScript(instantiate.toString()); +const module_bytes = builder.toArray(); Protocol.Debugger.onPaused(async msg => { await session.logSourceLocation(msg.params.callFrames[0].location); @@ -36,8 +24,7 @@ Protocol.Debugger.onPaused(async msg => { await Protocol.Debugger.enable(); InspectorTest.log('Instantiating.'); // Spawn asynchronously: - Protocol.Runtime.evaluate( - {'expression': `const instance = instantiate(${module_bytes});`}); + WasmInspectorTest.instantiate(module_bytes); InspectorTest.log( 'Waiting for wasm script (ignoring first non-wasm script).'); const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2); diff --git a/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt b/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt deleted file mode 100644 index 9b22d614e8..0000000000 --- a/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -Tests that cloning a module notifies the debugger -Got URL: wasm://wasm/cae8f226 -Got URL: wasm://wasm/cae8f226 -Got URL: wasm://wasm/cae8f226 -Done! diff --git a/deps/v8/test/inspector/debugger/wasm-clone-module.js b/deps/v8/test/inspector/debugger/wasm-clone-module.js deleted file mode 100644 index ac027a2f8b..0000000000 --- a/deps/v8/test/inspector/debugger/wasm-clone-module.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2019 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -let {session, contextGroup, Protocol} = - InspectorTest.start('Tests that cloning a module notifies the debugger'); - -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); -builder.addFunction('f', kSig_v_v).addBody([]).exportAs('f'); -let moduleBytes = JSON.stringify(builder.toArray()); - -contextGroup.addScript(` - function test(moduleBytes) { - let wireBytes = new Uint8Array(moduleBytes); - let module = new WebAssembly.Module(wireBytes.buffer); - let serialized = %SerializeWasmModule(module); - let module2 = %DeserializeWasmModule(serialized, wireBytes); - let module3 = %CloneWasmModule(module); - } -`); - -let scriptsSeen = 0; - -Protocol.Debugger.onScriptParsed(msg => { - let url = msg.params.url; - if (url.startsWith('wasm://')) { - InspectorTest.log(`Got URL: ${url}`); - if (++scriptsSeen == 3) { - InspectorTest.log('Done!'); - InspectorTest.completeTest(); - } - } -}); - -Protocol.Debugger.enable(); -Protocol.Runtime.evaluate({expression: `test(${moduleBytes});`}); diff --git a/deps/v8/test/inspector/debugger/wasm-debug-command-expected.txt b/deps/v8/test/inspector/debugger/wasm-debug-command-expected.txt index cd4c9fbd4a..c8b9f18e7b 100644 --- a/deps/v8/test/inspector/debugger/wasm-debug-command-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-debug-command-expected.txt @@ -1,8 +1,6 @@ Tests debug command for wasm -Installing code and global variable. -Calling instantiate function. Waiting for wasm scripts to be parsed. -Ignoring script with url v8://test/callInstantiate +Ignoring script with url v8://test/instantiate Got wasm script: wasm://wasm/7d022e0e paused No 1 Script wasm://wasm/7d022e0e byte offset 35: Wasm opcode 0x20 diff --git a/deps/v8/test/inspector/debugger/wasm-debug-command.js b/deps/v8/test/inspector/debugger/wasm-debug-command.js index 672631bca2..c30a067d8e 100644 --- a/deps/v8/test/inspector/debugger/wasm-debug-command.js +++ b/deps/v8/test/inspector/debugger/wasm-debug-command.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests debug command for wasm'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let builder = new WasmModuleBuilder(); // wasm_A @@ -22,21 +22,6 @@ builder.addFunction('wasm_A', kSig_i_i) let module_bytes = builder.toArray(); -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - -let evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - let breakCount; Protocol.Debugger.onPaused(async message => { @@ -44,7 +29,7 @@ Protocol.Debugger.onPaused(async message => { InspectorTest.log("paused No " + breakCount); var frames = message.params.callFrames; await session.logSourceLocation(frames[0].location); - let action= 'resume'; + let action = 'resume'; InspectorTest.log('Debugger.' + action) await Protocol.Debugger[action](); }) @@ -62,12 +47,8 @@ function test() { breakCount = 0; breakpointId = 0; await Protocol.Debugger.enable(); - InspectorTest.log('Installing code and global variable.'); - await evalWithUrl('var instance;\n' + instantiate.toString(), 'setup'); - InspectorTest.log('Calling instantiate function.'); - evalWithUrl( - 'instantiate(' + JSON.stringify(module_bytes) + ')', 'callInstantiate'); - const scriptId = await waitForWasmScript(); + WasmInspectorTest.instantiate(module_bytes); + await waitForWasmScript(); await Protocol.Runtime.evaluate({ expression: 'test()', includeCommandLineAPI: true}); InspectorTest.log('exports.main returned!'); InspectorTest.log('Finished!'); diff --git a/deps/v8/test/inspector/debugger/wasm-debug-evaluate.js b/deps/v8/test/inspector/debugger/wasm-debug-evaluate.js index e9776ce81e..b1b8f57e1f 100644 --- a/deps/v8/test/inspector/debugger/wasm-debug-evaluate.js +++ b/deps/v8/test/inspector/debugger/wasm-debug-evaluate.js @@ -4,23 +4,11 @@ // Flags: --expose-wasm --wasm-expose-debug-eval +utils.load('test/inspector/wasm-inspector-test.js'); + const {session, contextGroup, Protocol} = InspectorTest.start('Tests wasm debug-evaluate'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); -} -contextGroup.addScript(instantiate.toString()); - function printFailure(message) { if (!message.result) { InspectorTest.logMessage(message); @@ -54,9 +42,7 @@ async function runTest(testName, breakLine, debuggeeBytes, snippetBytes) { handleDebuggerPaused.bind(null, snippetBytes)); InspectorTest.log('Test: ' + testName); const scriptListener = getWasmScript(); - const module = JSON.stringify(debuggeeBytes); - await Protocol.Runtime.evaluate( - {'expression': `const instance = instantiate(${module})`}); + await WasmInspectorTest.instantiate(debuggeeBytes); const script = await scriptListener; const msg = await Protocol.Debugger.setBreakpoint({ 'location': { diff --git a/deps/v8/test/inspector/debugger/wasm-anyref-global-expected.txt b/deps/v8/test/inspector/debugger/wasm-externref-global-expected.txt index c0b889121b..9984f24ac2 100644 --- a/deps/v8/test/inspector/debugger/wasm-anyref-global-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-externref-global-expected.txt @@ -1,4 +1,4 @@ -Test wasm scope information with anyref globals +Test wasm scope information with externref globals Waiting for wasm script to be parsed. Setting breakpoint in wasm. Running main. diff --git a/deps/v8/test/inspector/debugger/wasm-anyref-global.js b/deps/v8/test/inspector/debugger/wasm-externref-global.js index bf64649afb..76df24804f 100644 --- a/deps/v8/test/inspector/debugger/wasm-anyref-global.js +++ b/deps/v8/test/inspector/debugger/wasm-externref-global.js @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --experimental-wasm-anyref +// Flags: --experimental-wasm-reftypes + +utils.load('test/inspector/wasm-inspector-test.js'); let {session, contextGroup, Protocol} = - InspectorTest.start('Test wasm scope information with anyref globals'); + InspectorTest.start('Test wasm scope information with externref globals'); (async function() { try { - utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let builder = new WasmModuleBuilder(); - builder.addImportedGlobal('m', 'global', kWasmAnyRef, false); + builder.addImportedGlobal('m', 'global', kWasmExternRef, false); let func = builder.addFunction('func', kSig_v_v) .addBody([ kExprGlobalGet, 0, // diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets-expected.txt b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets-expected.txt index 7a970415a0..ee8bba2f64 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets-expected.txt @@ -1,8 +1,7 @@ Tests breakable locations in wasm Running testFunction... -Script nr 0 parsed. URL: v8://test/setup -Script nr 1 parsed. URL: v8://test/runTestFunction -Script nr 2 parsed. URL: wasm://wasm/354ada0e +Script nr 0 parsed. URL: v8://test/instantiate +Script nr 1 parsed. URL: wasm://wasm/354ada0e This is a wasm script (nr 0). Querying breakable locations for all wasm scripts now... Requesting all breakable locations in wasm script 0 @@ -53,7 +52,7 @@ Setting at wasm://wasm/354ada0e:0:58 Success! Running wasm code... Missing breakpoints: 10 -Script nr 3 parsed. URL: v8://test/runWasm +Script nr 2 parsed. URL: v8://test/runWasm Stopped at wasm://wasm/354ada0e:0:48 Missing breakpoints: 9 Stopped at wasm://wasm/354ada0e:0:50 diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets.js b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets.js index 86b2dc5aaa..e615a962e0 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets.js +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-byte-offsets.js @@ -4,9 +4,9 @@ // Flags: --expose-wasm -let {session, contextGroup, Protocol} = InspectorTest.start('Tests breakable locations in wasm'); +utils.load('test/inspector/wasm-inspector-test.js'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +let {session, contextGroup, Protocol} = InspectorTest.start('Tests breakable locations in wasm'); var builder = new WasmModuleBuilder(); @@ -32,36 +32,17 @@ builder.addFunction('main', kSig_v_i) var module_bytes = builder.toArray(); -function testFunction(bytes) { - 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); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - -var evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - -var setupCode = testFunction.toString() + ';\nvar module_bytes = ' + - JSON.stringify(module_bytes) + ';\nvar instance;'; - Protocol.Debugger.enable(); Protocol.Debugger.onScriptParsed(handleScriptParsed); async function runTest() { InspectorTest.log('Running testFunction...'); - await evalWithUrl(setupCode, 'setup'); - await evalWithUrl('testFunction(module_bytes)', 'runTestFunction'); + await WasmInspectorTest.instantiate(module_bytes); await getBreakableLocationsForAllWasmScripts(); await setAllBreakableLocations(); InspectorTest.log('Running wasm code...'); // Begin executing code: - var promise = evalWithUrl('instance.exports.main(1)', 'runWasm'); + var promise = WasmInspectorTest.evalWithUrl('instance.exports.main(1)', 'runWasm'); await waitForAllPauses(); // Code should now complete await promise; diff --git a/deps/v8/test/inspector/debugger/wasm-global-names.js b/deps/v8/test/inspector/debugger/wasm-global-names.js index 70e6b0f8dd..b6009bc8e7 100644 --- a/deps/v8/test/inspector/debugger/wasm-global-names.js +++ b/deps/v8/test/inspector/debugger/wasm-global-names.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Test wasm global names'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let builder = new WasmModuleBuilder(); builder.addImportedGlobal('module_name', 'imported_global', kWasmI32, false); let func = builder.addFunction('func', kSig_v_i) diff --git a/deps/v8/test/inspector/debugger/wasm-imports.js b/deps/v8/test/inspector/debugger/wasm-imports.js index 2efa7fdcbb..822064921f 100644 --- a/deps/v8/test/inspector/debugger/wasm-imports.js +++ b/deps/v8/test/inspector/debugger/wasm-imports.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -let {session, contextGroup, Protocol} = InspectorTest.start('Tests imports in wasm'); +utils.load('test/inspector/wasm-inspector-test.js'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +let {session, contextGroup, Protocol} = InspectorTest.start('Tests imports in wasm'); // Build two modules A and B. A defines function func, which contains a // breakpoint. This function is then imported by B and called via main. The @@ -36,21 +36,18 @@ function instantiate(bytes, imp) { instances.push(new WebAssembly.Instance(module, imp)); } -var evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - session.setupScriptMap(); // Main promise chain: Protocol.Debugger.enable() .then(() => InspectorTest.log('Installing code and global variable.')) .then( - () => evalWithUrl( + () => WasmInspectorTest.evalWithUrl( 'var instances = [];\n' + instantiate.toString(), 'setup')) .then(() => InspectorTest.log('Calling instantiate function for module A.')) .then( () => - (evalWithUrl( + (WasmInspectorTest.evalWithUrl( 'instantiate(' + JSON.stringify(module_a_bytes) + ')', 'instantiateA'), 0)) @@ -66,13 +63,13 @@ Protocol.Debugger.enable() .then(() => InspectorTest.log('Calling instantiate function for module B.')) .then( () => - (evalWithUrl( + (WasmInspectorTest.evalWithUrl( 'instantiate(' + JSON.stringify(module_b_bytes) + ', {imp: {f: instances[0].exports.func}})', 'instantiateB'), 0)) .then(() => InspectorTest.log('Calling main function on module B.')) - .then(() => evalWithUrl('instances[1].exports.main()', 'runWasm')) + .then(() => WasmInspectorTest.evalWithUrl('instances[1].exports.main()', 'runWasm')) .then(() => InspectorTest.log('exports.main returned.')) .then(() => InspectorTest.log('Finished.')) .then(InspectorTest.completeTest); @@ -89,7 +86,7 @@ Protocol.Debugger.oncePaused() .then( () => InspectorTest.log( 'Getting current stack trace via "new Error().stack".')) - .then(() => evalWithUrl('new Error().stack', 'getStack')) + .then(() => WasmInspectorTest.evalWithUrl('new Error().stack', 'getStack')) .then(msg => InspectorTest.log(msg.result.result.value)) .then(Protocol.Debugger.resume); diff --git a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt index ed457e29c4..3afdf5a85b 100644 --- a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt @@ -1,103 +1,102 @@ Test inspecting register values in Liftoff. -Installing instantiate function. Testing i32. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] -Paused at offset 50; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] -Paused at offset 52; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] -Paused at offset 54; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] -Paused at offset 56; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] -Paused at offset 58; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] -Paused at offset 60; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] -Paused at offset 62; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] -Paused at offset 64; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] -Paused at offset 66; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] -Paused at offset 68; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] -Paused at offset 70; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] -Paused at offset 71; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] -Paused at offset 72; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] -Paused at offset 73; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] -Paused at offset 74; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] -Paused at offset 75; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] -Paused at offset 76; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] -Paused at offset 77; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] +Paused at offset 48; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] +Paused at offset 50; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] +Paused at offset 52; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] +Paused at offset 54; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] +Paused at offset 56; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] +Paused at offset 58; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] +Paused at offset 60; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] +Paused at offset 62; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] +Paused at offset 64; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] +Paused at offset 66; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] +Paused at offset 68; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +Paused at offset 69; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] +Paused at offset 70; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] +Paused at offset 71; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] +Paused at offset 72; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] +Paused at offset 73; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] +Paused at offset 74; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] +Paused at offset 75; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] +Paused at offset 76; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] +Paused at offset 77; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] main returned. Testing i64. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] -Paused at offset 50; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] -Paused at offset 52; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] -Paused at offset 54; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] -Paused at offset 56; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] -Paused at offset 58; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] -Paused at offset 60; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] -Paused at offset 62; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] -Paused at offset 64; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] -Paused at offset 66; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] -Paused at offset 68; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] -Paused at offset 70; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] -Paused at offset 71; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] -Paused at offset 72; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] -Paused at offset 73; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] -Paused at offset 74; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] -Paused at offset 75; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] -Paused at offset 76; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] -Paused at offset 77; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] +Paused at offset 48; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] +Paused at offset 50; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] +Paused at offset 52; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] +Paused at offset 54; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] +Paused at offset 56; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] +Paused at offset 58; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] +Paused at offset 60; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] +Paused at offset 62; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] +Paused at offset 64; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] +Paused at offset 66; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] +Paused at offset 68; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +Paused at offset 69; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] +Paused at offset 70; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] +Paused at offset 71; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] +Paused at offset 72; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] +Paused at offset 73; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] +Paused at offset 74; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] +Paused at offset 75; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] +Paused at offset 76; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] +Paused at offset 77; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] main returned. Testing f32. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] -Paused at offset 50; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] -Paused at offset 52; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] -Paused at offset 54; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] -Paused at offset 56; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] -Paused at offset 58; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] -Paused at offset 60; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] -Paused at offset 62; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] -Paused at offset 64; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] -Paused at offset 66; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] -Paused at offset 68; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] -Paused at offset 70; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] -Paused at offset 71; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] -Paused at offset 72; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] -Paused at offset 73; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] -Paused at offset 74; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] -Paused at offset 75; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] -Paused at offset 76; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] -Paused at offset 77; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] +Paused at offset 48; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] +Paused at offset 50; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] +Paused at offset 52; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] +Paused at offset 54; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] +Paused at offset 56; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] +Paused at offset 58; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] +Paused at offset 60; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] +Paused at offset 62; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] +Paused at offset 64; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] +Paused at offset 66; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] +Paused at offset 68; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +Paused at offset 69; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] +Paused at offset 70; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] +Paused at offset 71; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] +Paused at offset 72; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] +Paused at offset 73; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] +Paused at offset 74; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] +Paused at offset 75; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] +Paused at offset 76; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] +Paused at offset 77; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] main returned. Testing f64. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] -Paused at offset 50; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] -Paused at offset 52; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] -Paused at offset 54; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] -Paused at offset 56; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] -Paused at offset 58; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] -Paused at offset 60; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] -Paused at offset 62; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] -Paused at offset 64; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] -Paused at offset 66; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] -Paused at offset 68; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] -Paused at offset 70; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] -Paused at offset 71; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] -Paused at offset 72; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] -Paused at offset 73; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] -Paused at offset 74; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] -Paused at offset 75; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] -Paused at offset 76; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] -Paused at offset 77; locals: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] +Paused at offset 48; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [] +Paused at offset 50; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0] +Paused at offset 52; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1] +Paused at offset 54; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2] +Paused at offset 56; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3] +Paused at offset 58; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4] +Paused at offset 60; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5] +Paused at offset 62; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6] +Paused at offset 64; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7] +Paused at offset 66; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8] +Paused at offset 68; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +Paused at offset 69; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17] +Paused at offset 70; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24] +Paused at offset 71; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30] +Paused at offset 72; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 4, 35] +Paused at offset 73; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 3, 39] +Paused at offset 74; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 2, 42] +Paused at offset 75; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 1, 44] +Paused at offset 76; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [0, 45] +Paused at offset 77; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; wasm-expression-stack: [45] main returned. Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js index 1d5863157d..829b9b5bfe 100644 --- a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js +++ b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js @@ -5,7 +5,7 @@ const {session, contextGroup, Protocol} = InspectorTest.start('Test inspecting register values in Liftoff.'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +utils.load('test/inspector/wasm-inspector-test.js'); const num_locals = 10; const configs = { @@ -15,20 +15,6 @@ const configs = { f64: {type: kWasmF64, add: kExprF64Add, from_i32: kExprF64SConvertI32} }; -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); -} - -const evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - Protocol.Debugger.onPaused(async msg => { let loc = msg.params.callFrames[0].location; let line = [`Paused at offset ${loc.columnNumber}`]; @@ -38,17 +24,9 @@ Protocol.Debugger.onPaused(async msg => { if (scope.type == 'module') continue; var scope_properties = await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); - if (scope.type == 'local') { - for (var value of scope_properties.result.result) { - let msg = await Protocol.Runtime.getProperties( - {objectId: value.value.objectId}); - let str = msg.result.result.map(elem => elem.value.value).join(', '); - line.push(`${value.name}: [${str}]`); - } - } else { - let str = scope_properties.result.result.map(elem => elem.value.value).join(', '); - line.push(`${scope.type}: [${str}]`); - } + let str = scope_properties.result.result.map( + elem => WasmInspectorTest.getWasmValue(elem.value)).join(', '); + line.push(`${scope.type}: [${str}]`); } InspectorTest.log(line.join('; ')); Protocol.Debugger.resume(); @@ -92,9 +70,7 @@ async function testConfig(config) { const [module_bytes, breakpoints] = buildModuleBytes(config); const instance_name = `instance_${config}`; // Spawn asynchronously: - let instantiate_code = evalWithUrl( - `const ${instance_name} = instantiate(${JSON.stringify(module_bytes)});`, - 'instantiate'); + WasmInspectorTest.instantiate(module_bytes, instance_name); InspectorTest.log('Waiting for wasm script.'); const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2); InspectorTest.log(`Setting ${breakpoints.length} breakpoints.`); @@ -108,14 +84,12 @@ async function testConfig(config) { }); } InspectorTest.log('Calling main.'); - await evalWithUrl(`${instance_name}.exports.main()`, `run_${config}`); + await WasmInspectorTest.evalWithUrl(`${instance_name}.exports.main()`, `run_${config}`); InspectorTest.log('main returned.'); } (async function test() { await Protocol.Debugger.enable(); - InspectorTest.log('Installing instantiate function.'); - await evalWithUrl(instantiate, 'install_instantiate'); for (let config in configs) { await testConfig(config); } diff --git a/deps/v8/test/inspector/debugger/wasm-memory-names.js b/deps/v8/test/inspector/debugger/wasm-memory-names.js index 769b0f200c..955e8ab233 100644 --- a/deps/v8/test/inspector/debugger/wasm-memory-names.js +++ b/deps/v8/test/inspector/debugger/wasm-memory-names.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Test wasm memory names'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let func; // No name memory. @@ -62,6 +62,7 @@ async function logMemoryName(msg, Protocol) { })).result.result; for (let prop of moduleObjectProps) { + if (prop.name == 'instance') continue; InspectorTest.log(`name: ${prop.name}`); } } diff --git a/deps/v8/test/inspector/debugger/wasm-regress-10957-expected.txt b/deps/v8/test/inspector/debugger/wasm-regress-10957-expected.txt new file mode 100644 index 0000000000..7a932feca1 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-regress-10957-expected.txt @@ -0,0 +1,4 @@ +Regress 10957 +Instantiate +Finished! +7 diff --git a/deps/v8/test/inspector/debugger/wasm-regress-10957.js b/deps/v8/test/inspector/debugger/wasm-regress-10957.js new file mode 100644 index 0000000000..a2d465b88d --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-regress-10957.js @@ -0,0 +1,70 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +utils.load('test/mjsunit/wasm/wasm-module-builder.js'); + +let {session, contextGroup, Protocol} = InspectorTest.start('Regress 10957'); + +var builder = new WasmModuleBuilder(); +let pause = builder.addImport('imports', 'pause', kSig_v_v); +let sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +let f = builder.addFunction('f', sig) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 3, + kExprLocalGet, 4, + kExprLocalGet, 5, + kExprLocalGet, 6, + kExprI32Add, + kExprI32Add, + kExprI32Add, + kExprI32Add, + kExprI32Add, + kExprI32Add, + ]); + +builder.addFunction('main', kSig_i_v) + .addBody([ + kExprCallFunction, pause, + kExprI32Const, 1, + kExprI32Const, 1, + kExprI32Const, 1, + kExprI32Const, 1, + kExprI32Const, 1, + kExprI32Const, 1, + kExprI32Const, 1, + kExprCallFunction, f.index]) + .exportFunc(); + +var module_bytes = builder.toArray(); + +function instantiate(bytes, imports) { + var buffer = new ArrayBuffer(bytes.length); + var view = new Uint8Array(buffer); + for (var i = 0; i < bytes.length; ++i) { + view[i] = bytes[i] | 0; + } + const module = new WebAssembly.Module(buffer); + return new WebAssembly.Instance(module, imports); +} + +(async function Regress10957() { + await Protocol.Debugger.enable(); + InspectorTest.log('Instantiate'); + const code = + `let instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }}); + instance.exports.main(); + `; + Protocol.Runtime.evaluate({'expression': code}).then(message => + InspectorTest.logMessage(message.result.result.value)); + await Protocol.Debugger.oncePaused(); + Protocol.Debugger.resume(); + + InspectorTest.log('Finished!'); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/wasm-remove-breakpoint-expected.txt b/deps/v8/test/inspector/debugger/wasm-remove-breakpoint-expected.txt index 42e0535d22..3ec87ed63c 100644 --- a/deps/v8/test/inspector/debugger/wasm-remove-breakpoint-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-remove-breakpoint-expected.txt @@ -1,8 +1,7 @@ Tests remove breakpoint from wasm scripts. -Installing code and global variable. Calling instantiate function. Waiting for wasm scripts to be parsed. -Ignoring script with url v8://test/callInstantiate +Ignoring script with url v8://test/instantiate Got wasm script: wasm://wasm/7d022e0e Setting breakpoint on line 3 of wasm function { @@ -10,10 +9,9 @@ Setting breakpoint on line 3 of wasm function lineNumber : 0 scriptId : <scriptId> } -BreakpointId: 4:0:39:6 paused No 1 Script wasm://wasm/7d022e0e byte offset 39: Wasm opcode 0x6b -Remove breakpoint with breakpointId: 4:0:39:6 +Remove breakpoint Debugger.resume exports.main returned! Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-remove-breakpoint.js b/deps/v8/test/inspector/debugger/wasm-remove-breakpoint.js index bfbf79af3a..3abbaae6d2 100644 --- a/deps/v8/test/inspector/debugger/wasm-remove-breakpoint.js +++ b/deps/v8/test/inspector/debugger/wasm-remove-breakpoint.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests remove breakpoint from wasm scripts.'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let builder = new WasmModuleBuilder(); // wasm_A @@ -22,21 +22,6 @@ let func = builder.addFunction('wasm_A', kSig_i_i) let module_bytes = builder.toArray(); -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - -let evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - let breakCount = 0; let breakpointId = 0; @@ -46,7 +31,7 @@ Protocol.Debugger.onPaused(async message => { var frames = message.params.callFrames; await session.logSourceLocation(frames[0].location); if (breakCount == 1) { - InspectorTest.log('Remove breakpoint with breakpointId: ' + breakpointId); + InspectorTest.log('Remove breakpoint'); await Protocol.Debugger.removeBreakpoint({breakpointId}); } let action= 'resume'; @@ -63,11 +48,8 @@ function test() { (async function Test() { await Protocol.Debugger.enable(); - InspectorTest.log('Installing code and global variable.'); - await evalWithUrl('var instance;\n' + instantiate.toString(), 'setup'); InspectorTest.log('Calling instantiate function.'); - evalWithUrl( - 'instantiate(' + JSON.stringify(module_bytes) + ')', 'callInstantiate'); + WasmInspectorTest.instantiate(module_bytes); const scriptId = await waitForWasmScript(); InspectorTest.log( 'Setting breakpoint on line 3 of wasm function'); @@ -75,7 +57,6 @@ function test() { {'location': {'scriptId': scriptId, 'lineNumber': 0, 'columnNumber': func.body_offset + 4}}); printFailure(msg); InspectorTest.logMessage(msg.result.actualLocation); - InspectorTest.logMessage('BreakpointId: '+ msg.result.breakpointId); breakpointId = msg.result.breakpointId; await Protocol.Runtime.evaluate({ expression: 'test()' }); await Protocol.Runtime.evaluate({ expression: 'test()' }); diff --git a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js index a9a096d65b..f2b2f983e2 100644 --- a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js +++ b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks resetting context group with wasm.'); +utils.load('test/inspector/wasm-inspector-test.js'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +InspectorTest.log('Checks resetting context group with wasm.'); var builder = new WasmModuleBuilder(); @@ -22,18 +22,6 @@ builder.addFunction('wasm_func', kSig_i_i) var module_bytes = builder.toArray(); -function instantiate(bytes) { - 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); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - var contextGroup1 = new InspectorTest.ContextGroup(); var session1 = contextGroup1.connect(); session1.setupScriptMap(); @@ -47,10 +35,10 @@ session2.setupScriptMap(); await session2.Protocol.Debugger.enable(); session1.Protocol.Runtime.evaluate({ - expression: `var instance;(${instantiate.toString()})(${JSON.stringify(module_bytes)})`}); + expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`}); session2.Protocol.Runtime.evaluate({ - expression: `var instance;(${instantiate.toString()})(${JSON.stringify(module_bytes)})`}); + expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`}); contextGroup2.reset(); diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt index 0b91c1a904..49a4cd0291 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt @@ -4,363 +4,589 @@ Waiting for wasm script to be parsed. Got wasm script! Setting breakpoint on first instruction of second function { - columnNumber : 69 + columnNumber : 143 lineNumber : 0 scriptId : <scriptId> } Paused: -Script wasm://wasm/d374ef0a byte offset 69: Wasm opcode 0x41 +Script wasm://wasm/e7879e16 byte offset 143: Wasm opcode 0x41 Scope: -at func (0:69): +at func (0:143): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 4 (number), "var1": 0 (number), "i64_local": 0 (number), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 4 (i32) + var1: 0 (i32) + i64_local: 0 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 71: Wasm opcode 0x21 +Script wasm://wasm/e7879e16 byte offset 145: Wasm opcode 0x21 Scope: -at func (0:71): +at func (0:145): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 4 (number), "var1": 0 (number), "i64_local": 0 (number), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 4 (i32) + var1: 0 (i32) + i64_local: 0 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 11 (number) -at call_func (0:58): + 0: 11 (i32) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 73: Wasm opcode 0x41 +Script wasm://wasm/e7879e16 byte offset 147: Wasm opcode 0x41 Scope: -at func (0:73): +at func (0:147): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 0 (number), "i64_local": 0 (number), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 0 (i32) + i64_local: 0 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 75: Wasm opcode 0x21 +Script wasm://wasm/e7879e16 byte offset 149: Wasm opcode 0x21 Scope: -at func (0:75): +at func (0:149): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 0 (number), "i64_local": 0 (number), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 0 (i32) + i64_local: 0 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 47 (number) -at call_func (0:58): + 0: 47 (i32) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 77: Wasm opcode 0x42 +Script wasm://wasm/e7879e16 byte offset 151: Wasm opcode 0x42 Scope: -at func (0:77): +at func (0:151): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": 0 (number), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: 0 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 88: Wasm opcode 0x21 +Script wasm://wasm/e7879e16 byte offset 162: Wasm opcode 0x21 Scope: -at func (0:88): +at func (0:162): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": 0 (number), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: 0 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 9223372036854775807 (string) -at call_func (0:58): + 0: 9223372036854775807 (i64) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 90: Wasm opcode 0x42 +Script wasm://wasm/e7879e16 byte offset 164: Wasm opcode 0x42 Scope: -at func (0:90): +at func (0:164): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": 9223372036854775807 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: 9223372036854775807 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 101: Wasm opcode 0x21 +Script wasm://wasm/e7879e16 byte offset 175: Wasm opcode 0x21 Scope: -at func (0:101): +at func (0:175): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": 9223372036854775807 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: 9223372036854775807 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: -9223372036854775808 (string) -at call_func (0:58): + 0: -9223372036854775808 (i64) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 103: Wasm opcode 0x41 +Script wasm://wasm/e7879e16 byte offset 177: Wasm opcode 0x41 Scope: -at func (0:103): +at func (0:177): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 105: Wasm opcode 0xb8 +Script wasm://wasm/e7879e16 byte offset 179: Wasm opcode 0xb8 Scope: -at func (0:105): +at func (0:179): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 1 (number) -at call_func (0:58): + 0: 1 (i32) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 106: Wasm opcode 0x41 +Script wasm://wasm/e7879e16 byte offset 180: Wasm opcode 0x41 Scope: -at func (0:106): +at func (0:180): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 1 (number) -at call_func (0:58): + 0: 1 (f64) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 108: Wasm opcode 0xb8 +Script wasm://wasm/e7879e16 byte offset 182: Wasm opcode 0xb8 Scope: -at func (0:108): +at func (0:182): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 1 (number) - 1: 7 (number) -at call_func (0:58): + 0: 1 (f64) + 1: 7 (i32) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 109: Wasm opcode 0xa3 +Script wasm://wasm/e7879e16 byte offset 183: Wasm opcode 0xa3 Scope: -at func (0:109): +at func (0:183): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 1 (number) - 1: 7 (number) -at call_func (0:58): + 0: 1 (f64) + 1: 7 (f64) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 110: Wasm opcode 0x21 +Script wasm://wasm/e7879e16 byte offset 184: Wasm opcode 0x21 Scope: -at func (0:110): +at func (0:184): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0 (f64) - scope (wasm-expression-stack): - 0: 0.14285714285714285 (number) -at call_func (0:58): + 0: 0.14285714285714285 (f64) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 112: Wasm opcode 0x41 +Script wasm://wasm/e7879e16 byte offset 186: Wasm opcode 0x41 Scope: -at func (0:112): +at func (0:186): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0.14285714285714285 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0.14285714285714285 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 114: Wasm opcode 0x24 +Script wasm://wasm/e7879e16 byte offset 188: Wasm opcode 0x24 Scope: -at func (0:114): +at func (0:188): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0.14285714285714285 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0.14285714285714285 (f64) - scope (wasm-expression-stack): - 0: 15 (number) -at call_func (0:58): + 0: 15 (i32) +at call_func (0:132): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 116: Wasm opcode 0x0b +Script wasm://wasm/e7879e16 byte offset 190: Wasm opcode 0x0b Scope: -at func (0:116): +at func (0:190): - scope (module): - globals: "global0": 15 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 15 (i32) - scope (local): - locals: "0": 0 (number), "i32Arg": 11 (number), "var1": 47 (number), "i64_local": -9223372036854775808 (string), "unicodeā¼f64": 0.14285714285714285 (number) + 0: 0 (f64) + i32Arg: 11 (i32) + var1: 47 (i32) + i64_local: -9223372036854775808 (i64) + unicodeā¼f64: 0.14285714285714285 (f64) - scope (wasm-expression-stack): -at call_func (0:58): +at call_func (0:132): - scope (module): - globals: "global0": 15 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 15 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/d374ef0a byte offset 60: Wasm opcode 0x0b +Script wasm://wasm/e7879e16 byte offset 134: Wasm opcode 0x0b Scope: -at call_func (0:60): +at call_func (0:134): - scope (module): - globals: "global0": 15 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, call_func: function 0() { [native code] } + globals: "exported_global": 15 (i32) - scope (local): - locals: "var0": 4 (number), "var1": 7.199999809265137 (number) + var0: 4 (i32) + var1: 7.199999809265137 (f32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -instance.exports.main(4)# +instance.exports.main(4) Scope: -at (anonymous) (0:24): +at (anonymous) (1:31): - scope (global): -- skipped globals diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff-expected.txt b/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff-expected.txt index 8f853c8cb5..a421af0fdd 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff-expected.txt @@ -1,229 +1,353 @@ Test retrieving scope information from compiled Liftoff frames -Installing instantiate code. -Waiting for wasm script to be parsed. Calling instantiate function. +Waiting for wasm script to be parsed. Got wasm script! Setting breakpoint on line 2 (first instruction) of third function { - columnNumber : 85 + columnNumber : 159 lineNumber : 0 scriptId : <scriptId> } Paused: -Script wasm://wasm/c4eb034a byte offset 85: Wasm opcode 0x20 +Script wasm://wasm/7f06385e byte offset 159: Wasm opcode 0x20 Scope: -at C (interpreted) (0:85): +at C (interpreted) (0:159): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "i32_arg": 42 (number), "i32_local": 0 (number) + i32_arg: 42 (i32) + i32_local: 0 (i32) - scope (wasm-expression-stack): -at B (liftoff) (0:76): +at B (liftoff) (0:150): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) -at A (liftoff) (0:54): + 0: 42 (i32) + 1: 3 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 87: Wasm opcode 0x24 +Script wasm://wasm/7f06385e byte offset 161: Wasm opcode 0x24 Scope: -at C (interpreted) (0:87): +at C (interpreted) (0:161): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "i32_arg": 42 (number), "i32_local": 0 (number) + i32_arg: 42 (i32) + i32_local: 0 (i32) - scope (wasm-expression-stack): - 0: 42 (number) -at B (liftoff) (0:76): + 0: 42 (i32) +at B (liftoff) (0:150): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) -at A (liftoff) (0:54): + 0: 42 (i32) + 1: 3 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 0 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 0 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 89: Wasm opcode 0x41 +Script wasm://wasm/7f06385e byte offset 163: Wasm opcode 0x41 Scope: -at C (interpreted) (0:89): +at C (interpreted) (0:163): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "i32_arg": 42 (number), "i32_local": 0 (number) + i32_arg: 42 (i32) + i32_local: 0 (i32) - scope (wasm-expression-stack): -at B (liftoff) (0:76): +at B (liftoff) (0:150): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) -at A (liftoff) (0:54): + 0: 42 (i32) + 1: 3 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 91: Wasm opcode 0x21 +Script wasm://wasm/7f06385e byte offset 165: Wasm opcode 0x21 Scope: -at C (interpreted) (0:91): +at C (interpreted) (0:165): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "i32_arg": 42 (number), "i32_local": 0 (number) + i32_arg: 42 (i32) + i32_local: 0 (i32) - scope (wasm-expression-stack): - 0: 47 (number) -at B (liftoff) (0:76): + 0: 47 (i32) +at B (liftoff) (0:150): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) -at A (liftoff) (0:54): + 0: 42 (i32) + 1: 3 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 93: Wasm opcode 0x0b +Script wasm://wasm/7f06385e byte offset 167: Wasm opcode 0x0b Scope: -at C (interpreted) (0:93): +at C (interpreted) (0:167): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "i32_arg": 42 (number), "i32_local": 47 (number) + i32_arg: 42 (i32) + i32_local: 47 (i32) - scope (wasm-expression-stack): -at B (liftoff) (0:76): +at B (liftoff) (0:150): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) -at A (liftoff) (0:54): + 0: 42 (i32) + 1: 3 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 78: Wasm opcode 0x1a +Script wasm://wasm/7f06385e byte offset 152: Wasm opcode 0x1a Scope: -at B (liftoff) (0:78): +at B (liftoff) (0:152): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) -at A (liftoff) (0:54): + 0: 42 (i32) + 1: 3 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 79: Wasm opcode 0x1a +Script wasm://wasm/7f06385e byte offset 153: Wasm opcode 0x1a Scope: -at B (liftoff) (0:79): +at B (liftoff) (0:153): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): - 0: 42 (number) -at A (liftoff) (0:54): + 0: 42 (i32) +at A (liftoff) (0:128): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 80: Wasm opcode 0x0b +Script wasm://wasm/7f06385e byte offset 154: Wasm opcode 0x0b Scope: -at B (liftoff) (0:80): +at B (liftoff) (0:154): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "0": 0 (number), "i32_arg": 42 (number), "i32_local": 0 (number), "f32_local": 7.199999809265137 (number), "var5": 0 (number) + 0: 0 (f32) + i32_arg: 42 (i32) + i32_local: 0 (i32) + f32_local: 7.199999809265137 (f32) + var5: 0 (f32) - scope (wasm-expression-stack): -at A (liftoff) (0:54): +at A (liftoff) (0:128): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -Script wasm://wasm/c4eb034a byte offset 56: Wasm opcode 0x0b +Script wasm://wasm/7f06385e byte offset 130: Wasm opcode 0x0b Scope: -at A (liftoff) (0:56): +at A (liftoff) (0:130): - scope (module): - globals: "global0": 42 (number) + instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) + exported_memory: Uint8Array(65536) + function tables: + exported_table: js_func: function js_func() { [native code] }, anonymous: function () { [native code] }, A (liftoff): function 0() { [native code] } + globals: "exported_global": 42 (i32) - scope (local): - locals: "var0": 42 (number) + var0: 42 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): - scope (global): -- skipped globals Paused: -instance.exports.main(42)# +instance.exports.main(42) Scope: -at (anonymous) (0:25): +at (anonymous) (1:31): - scope (global): -- skipped globals diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff.js b/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff.js index df0aa575d3..845c93ca86 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff.js +++ b/deps/v8/test/inspector/debugger/wasm-scope-info-liftoff.js @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --experimental-wasm-type-reflection + +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start( 'Test retrieving scope information from compiled Liftoff frames'); session.setupScriptMap(); Protocol.Debugger.enable(); Protocol.Debugger.onPaused(printPauseLocationsAndContinue); -let evaluate = code => Protocol.Runtime.evaluate({expression: code}); - let breakpointLocation = -1; (async function test() { @@ -26,7 +28,7 @@ let breakpointLocation = -1; InspectorTest.logMessage(breakpoint.result.actualLocation); // Now run the wasm code. - await evaluate('instance.exports.main(42)'); + await WasmInspectorTest.evalWithUrl('instance.exports.main(42)', 'runWasm'); InspectorTest.log('exports.main returned. Test finished.'); InspectorTest.completeTest(); })(); @@ -51,7 +53,7 @@ async function printPauseLocationsAndContinue(msg) { } var properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); - await dumpScopeProperties(properties); + await WasmInspectorTest.dumpScopeProperties(properties); } } InspectorTest.log(); @@ -59,11 +61,11 @@ async function printPauseLocationsAndContinue(msg) { } async function instantiateWasm() { - utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); - // Also add a global, so we have some global scope. - builder.addGlobal(kWasmI32, true); + // Add a global, memory and exports to populate the module scope. + builder.addGlobal(kWasmI32, true).exportAs('exported_global'); + builder.addMemory(1,1).exportMemoryAs('exported_memory'); + builder.addTable(kWasmAnyFunc, 3).exportAs('exported_table'); // Add two functions without breakpoint, to check that locals and operand // stack values are shown correctly in Liftoff code. @@ -71,7 +73,7 @@ async function instantiateWasm() { // function B. // Function B has a local with a constant value (not using a register), the // parameter will be held in a register. - builder.addFunction('A (liftoff)', kSig_v_i) + const main = builder.addFunction('A (liftoff)', kSig_v_i) .addBody([ // Call function 'B', forwarding param 0. kExprLocalGet, 0, kExprCallFunction, 1 @@ -103,24 +105,26 @@ async function instantiateWasm() { kExprI32Const, 47, kExprLocalSet, 1, ]); + // Append function to table to test function table output. + builder.appendToTable([main.index]); + var module_bytes = builder.toArray(); breakpointLocation = func.body_offset; - function instantiate(bytes) { - 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); - return new WebAssembly.Instance(module); + function addWasmJSToTable() { + // Create WasmJS functions to test the function tables output. + const js_func = function js_func() { return 7; }; + const wasmjs_func = new WebAssembly.Function({parameters:[], results:['i32']}, js_func); + const wasmjs_anonymous_func = new WebAssembly.Function({parameters:[], results:['i32']}, _ => 7); + + instance.exports.exported_table.set(0, wasmjs_func); + instance.exports.exported_table.set(1, wasmjs_anonymous_func); } - InspectorTest.log('Installing instantiate code.'); - await evaluate(instantiate.toString()); InspectorTest.log('Calling instantiate function.'); - evaluate('var instance = instantiate(' + JSON.stringify(module_bytes) + ');'); + await WasmInspectorTest.instantiate(module_bytes); + await WasmInspectorTest.evalWithUrl(`(${addWasmJSToTable})()`, 'populateTable'); } function printIfFailure(message) { @@ -143,23 +147,3 @@ async function waitForWasmScripts() { } return wasm_script_ids; } - -async function getScopeValues(value) { - if (value.type == 'object') { - let msg = await Protocol.Runtime.getProperties({objectId: value.objectId}); - printIfFailure(msg); - const printProperty = function(elem) { - return `"${elem.name}": ${elem.value.value} (${elem.value.type})`; - } - return msg.result.result.map(printProperty).join(', '); - } - return value.value + ' (' + value.type + ')'; -} - -async function dumpScopeProperties(message) { - printIfFailure(message); - for (var value of message.result.result) { - var value_str = await getScopeValues(value.value); - InspectorTest.log(' ' + value.name + ': ' + value_str); - } -} diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info.js b/deps/v8/test/inspector/debugger/wasm-scope-info.js index 69e6f70165..7731e6b587 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info.js +++ b/deps/v8/test/inspector/debugger/wasm-scope-info.js @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --experimental-wasm-type-reflection + +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start( 'Test retrieving scope information when pausing in wasm functions'); session.setupScriptMap(); Protocol.Debugger.enable(); Protocol.Debugger.onPaused(printPauseLocationsAndContinue); -let evaluate = code => Protocol.Runtime.evaluate({expression: code}); - let breakpointLocation = undefined; // Will be set by {instantiateWasm}. (async function test() { @@ -31,7 +33,7 @@ let breakpointLocation = undefined; // Will be set by {instantiateWasm}. InspectorTest.logMessage(breakpoint.result.actualLocation); // Now run the wasm code. - await evaluate('instance.exports.main(4)'); + await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm'); InspectorTest.log('exports.main returned. Test finished.'); InspectorTest.completeTest(); })(); @@ -56,7 +58,7 @@ async function printPauseLocationsAndContinue(msg) { } var properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); - await dumpScopeProperties(properties); + await WasmInspectorTest.dumpScopeProperties(properties); } } InspectorTest.log(); @@ -64,15 +66,15 @@ async function printPauseLocationsAndContinue(msg) { } async function instantiateWasm() { - utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); - // Also add a global, so we have some global scope. - builder.addGlobal(kWasmI32, true); + // Add a global, memory and exports to populate the module scope. + builder.addGlobal(kWasmI32, true).exportAs('exported_global'); + builder.addMemory(1,1).exportMemoryAs('exported_memory'); + builder.addTable(kWasmAnyFunc, 3).exportAs('exported_table'); // Add a function without breakpoint, to check that locals are shown // correctly in compiled code. - builder.addFunction('call_func', kSig_v_i).addLocals({f32_count: 1}).addBody([ + const main = builder.addFunction('call_func', kSig_v_i).addLocals({f32_count: 1}).addBody([ // Set local 1 to 7.2. ...wasmF32Const(7.2), kExprLocalSet, 1, // Call function 'func', forwarding param 0. @@ -80,7 +82,7 @@ async function instantiateWasm() { ]).exportAs('main'); // A second function which will be stepped through. - let func = builder.addFunction('func', kSig_v_i) + const func = builder.addFunction('func', kSig_v_i) .addLocals( {i32_count: 1, i64_count: 1, f64_count: 3}, ['i32Arg', undefined, 'i64_local', 'unicodeā¼f64', '0', '0']) @@ -103,22 +105,25 @@ async function instantiateWasm() { kExprI32Const, 15, kExprGlobalSet, 0, ]); + // Append function to table to test function table output. + builder.appendToTable([main.index]); + let moduleBytes = builder.toArray(); breakpointLocation = func.body_offset; - function instantiate(bytes) { - var buffer = new ArrayBuffer(bytes.length); - var view = new Uint8Array(buffer); - for (var i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } + function addWasmJSToTable() { + // Create WasmJS functions to test the function tables output. + const js_func = function js_func() { return 7; }; + const wasmjs_func = new WebAssembly.Function({parameters:[], results:['i32']}, js_func); + const wasmjs_anonymous_func = new WebAssembly.Function({parameters:[], results:['i32']}, _ => 7); - var module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); + instance.exports.exported_table.set(0, wasmjs_func); + instance.exports.exported_table.set(1, wasmjs_anonymous_func); } InspectorTest.log('Calling instantiate function.'); - evaluate(`var instance = (${instantiate})(${JSON.stringify(moduleBytes)})`); + await WasmInspectorTest.instantiate(moduleBytes); + await WasmInspectorTest.evalWithUrl(`(${addWasmJSToTable})()`, 'populateTable'); } function printIfFailure(message) { @@ -141,23 +146,3 @@ async function waitForWasmScripts() { } return wasm_script_ids; } - -async function getScopeValues(value) { - if (value.type == 'object') { - let msg = await Protocol.Runtime.getProperties({objectId: value.objectId}); - printIfFailure(msg); - const printProperty = function(elem) { - return `"${elem.name}": ${elem.value.value} (${elem.value.type})`; - } - return msg.result.result.map(printProperty).join(', '); - } - return value.value + ' (' + value.type + ')'; -} - -async function dumpScopeProperties(message) { - printIfFailure(message); - for (var value of message.result.result) { - var value_str = await getScopeValues(value.value); - InspectorTest.log(' ' + value.name + ': ' + value_str); - } -} diff --git a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt index 9169a01a89..183d3f9c6c 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt @@ -1,27 +1,27 @@ Tests how wasm scripts are reported Check that each inspector gets a wasm script at module creation time. -Session #1: Script #0 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #0 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #1 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #1 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #2 parsed. URL: wasm://wasm/5e8bdc5a. Script ID: 1, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #2 parsed. URL: wasm://wasm/5e8bdc5a. Script ID: 1, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #3 parsed. URL: wasm://wasm/ba7c35be. Script ID: 2, Source map URL: , debug symbols: EmbeddedDWARF:undefined. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #3 parsed. URL: wasm://wasm/ba7c35be. Script ID: 2, Source map URL: , debug symbols: EmbeddedDWARF:undefined. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #4 parsed. URL: wasm://wasm/1baa71fe. Script ID: 3, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #4 parsed. URL: wasm://wasm/1baa71fe. Script ID: 3, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #5 parsed. URL: wasm://wasm/0f5a61aa. Script ID: 4, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #5 parsed. URL: wasm://wasm/0f5a61aa. Script ID: 4, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #6 parsed. URL: wasm://wasm/2b982afe. Script ID: 5, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #6 parsed. URL: wasm://wasm/2b982afe. Script ID: 5, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #7 parsed. URL: wasm://wasm/63e4f84a. Script ID: 6, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #7 parsed. URL: wasm://wasm/63e4f84a. Script ID: 6, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #8 parsed. URL: wasm://wasm/2c194a36. Script ID: 7, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #8 parsed. URL: wasm://wasm/2c194a36. Script ID: 7, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #9 parsed. URL: wasm://wasm/95e97206. Script ID: 8, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #9 parsed. URL: wasm://wasm/95e97206. Script ID: 8, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #1: Script #10 parsed. URL: wasm://wasm/7ab47392. Script ID: 9, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 -Session #2: Script #10 parsed. URL: wasm://wasm/7ab47392. Script ID: 9, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 0, code offset: 34 +Session #1: Script #0 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 77, code offset: 34 +Session #2: Script #0 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 77, code offset: 34 +Session #1: Script #1 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 77, code offset: 34 +Session #2: Script #1 parsed. URL: wasm://wasm/7b04570e. Script ID: 0, Source map URL: , debug symbols: None:undefined. module begin: 0, module end: 77, code offset: 34 +Session #1: Script #2 parsed. URL: wasm://wasm/21e2f406. Script ID: 1, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 103, code offset: 34 +Session #2: Script #2 parsed. URL: wasm://wasm/21e2f406. Script ID: 1, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 103, code offset: 34 +Session #1: Script #3 parsed. URL: wasm://wasm/ba7c35be. Script ID: 2, Source map URL: , debug symbols: EmbeddedDWARF:undefined. module begin: 0, module end: 96, code offset: 34 +Session #2: Script #3 parsed. URL: wasm://wasm/ba7c35be. Script ID: 2, Source map URL: , debug symbols: EmbeddedDWARF:undefined. module begin: 0, module end: 96, code offset: 34 +Session #1: Script #4 parsed. URL: wasm://wasm/1baa71fe. Script ID: 3, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 100, code offset: 34 +Session #2: Script #4 parsed. URL: wasm://wasm/1baa71fe. Script ID: 3, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 100, code offset: 34 +Session #1: Script #5 parsed. URL: wasm://wasm/c047292e. Script ID: 4, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 126, code offset: 34 +Session #2: Script #5 parsed. URL: wasm://wasm/c047292e. Script ID: 4, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 126, code offset: 34 +Session #1: Script #6 parsed. URL: wasm://wasm/e56b2672. Script ID: 5, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 126, code offset: 34 +Session #2: Script #6 parsed. URL: wasm://wasm/e56b2672. Script ID: 5, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 126, code offset: 34 +Session #1: Script #7 parsed. URL: wasm://wasm/c9614a4e. Script ID: 6, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 122, code offset: 34 +Session #2: Script #7 parsed. URL: wasm://wasm/c9614a4e. Script ID: 6, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 122, code offset: 34 +Session #1: Script #8 parsed. URL: wasm://wasm/639d13c6. Script ID: 7, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 122, code offset: 34 +Session #2: Script #8 parsed. URL: wasm://wasm/639d13c6. Script ID: 7, Source map URL: , debug symbols: ExternalDWARF:abc. module begin: 0, module end: 122, code offset: 34 +Session #1: Script #9 parsed. URL: wasm://wasm/95e97206. Script ID: 8, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 119, code offset: 34 +Session #2: Script #9 parsed. URL: wasm://wasm/95e97206. Script ID: 8, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 119, code offset: 34 +Session #1: Script #10 parsed. URL: wasm://wasm/7ab47392. Script ID: 9, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 119, code offset: 34 +Session #2: Script #10 parsed. URL: wasm://wasm/7ab47392. Script ID: 9, Source map URL: abc, debug symbols: SourceMap:abc. module begin: 0, module end: 119, code offset: 34 Session #1: Source for wasm://wasm/7b04570e: Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] @@ -38,12 +38,12 @@ Session #2: Source for wasm://wasm/7b04570e: Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #1: Source for wasm://wasm/5e8bdc5a: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #1: Source for wasm://wasm/21e2f406: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #2: Source for wasm://wasm/5e8bdc5a: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #2: Source for wasm://wasm/21e2f406: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] Session #1: Source for wasm://wasm/ba7c35be: @@ -62,36 +62,36 @@ Session #2: Source for wasm://wasm/1baa71fe: Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #1: Source for wasm://wasm/0f5a61aa: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #1: Source for wasm://wasm/c047292e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #2: Source for wasm://wasm/0f5a61aa: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #2: Source for wasm://wasm/c047292e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #1: Source for wasm://wasm/2b982afe: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #1: Source for wasm://wasm/e56b2672: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #2: Source for wasm://wasm/2b982afe: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #2: Source for wasm://wasm/e56b2672: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #1: Source for wasm://wasm/63e4f84a: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #1: Source for wasm://wasm/c9614a4e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #2: Source for wasm://wasm/63e4f84a: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #2: Source for wasm://wasm/c9614a4e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #1: Source for wasm://wasm/2c194a36: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #1: Source for wasm://wasm/639d13c6: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] -Session #2: Source for wasm://wasm/2c194a36: -Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 19 14 2e 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Session #2: Source for wasm://wasm/639d13c6: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 18 13 65 78 74 65 72 6e 61 6c 5f 64 65 62 75 67 5f 69 6e 66 6f 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e Imports: [] Exports: [main: function] Session #1: Source for wasm://wasm/95e97206: diff --git a/deps/v8/test/inspector/debugger/wasm-scripts-with-name.js b/deps/v8/test/inspector/debugger/wasm-scripts-with-name.js index 7cf17190c0..846af98371 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts-with-name.js +++ b/deps/v8/test/inspector/debugger/wasm-scripts-with-name.js @@ -4,6 +4,8 @@ // Flags: --expose-wasm +utils.load('test/inspector/wasm-inspector-test.js'); + InspectorTest.log("Tests how wasm scripts are reported with name"); let contextGroup = new InspectorTest.ContextGroup(); @@ -12,8 +14,6 @@ let sessions = [ trackScripts(), ]; -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]); var module_bytes = builder.toArray(); diff --git a/deps/v8/test/inspector/debugger/wasm-scripts.js b/deps/v8/test/inspector/debugger/wasm-scripts.js index e7e158e9d5..0849840abe 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts.js +++ b/deps/v8/test/inspector/debugger/wasm-scripts.js @@ -4,6 +4,8 @@ // Flags: --expose-wasm +utils.load('test/inspector/wasm-inspector-test.js'); + InspectorTest.log("Tests how wasm scripts are reported"); let contextGroup = new InspectorTest.ContextGroup(); @@ -15,8 +17,6 @@ let sessions = [ trackScripts(), ]; -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - // Create module with given custom sections. function createModule(...customSections) { var builder = new WasmModuleBuilder(); @@ -59,7 +59,7 @@ const embeddedDWARFSection = { // Sample external_debug_info section set to "abc". const externalDWARFSection = { - name: '.external_debug_info', + name: 'external_debug_info', value: [3, 97, 98, 99] }; diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-breaks-on-first-breakable-location-expected.txt b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-breaks-on-first-breakable-location-expected.txt new file mode 100644 index 0000000000..f5e94adbe5 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-breaks-on-first-breakable-location-expected.txt @@ -0,0 +1,21 @@ +Tests if breakpoint set is first breakable location +Running test function... +Set breakpoint outside of any function: (0, 0). +Setting breakpoint for id: 4 at 0, 0. +{ + error : { + code : -32000 + message : Could not resolve breakpoint + } + id : <messageId> +} +Set breakpoint could not resolve break location. +Set breakpoint at a breakable location: (0, 40). +Setting breakpoint for id: 4 at 0, 40. +Location match for (0, 40). +Initial location is expected to be breakable: true. +Set breakpoint at non-breakable location: (0, 42). +Setting breakpoint for id: 4 at 0, 42. +Location match for (0, 43). +Initial location is expected to be breakable: false. +Finished!
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-breaks-on-first-breakable-location.js b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-breaks-on-first-breakable-location.js new file mode 100644 index 0000000000..8071e03731 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-breaks-on-first-breakable-location.js @@ -0,0 +1,134 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +utils.load('test/inspector/wasm-inspector-test.js'); + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests if breakpoint set is first breakable location'); + +var builder = new WasmModuleBuilder(); + +// clang-format off +var func_idx = builder.addFunction('helper', kSig_v_v) + .addLocals({ i32_count: 1 }) + .addBody([ + kExprNop, + kExprI32Const, 12, + kExprLocalSet, 0, + ]).index; + +builder.addFunction('main', kSig_v_i) + .addBody([ + kExprLocalGet, 0, + kExprIf, kWasmStmt, + kExprBlock, kWasmStmt, + kExprCallFunction, func_idx, + kExprEnd, + kExprEnd + ]).exportAs('main'); +// clang-format on + +var module_bytes = builder.toArray(); +Protocol.Debugger.enable(); + +runTest() + .catch(reason => InspectorTest.log(`Failed: ${reason}.`)) + .then(InspectorTest.completeTest); + +async function runTest() { + InspectorTest.log('Running test function...'); + WasmInspectorTest.instantiate(module_bytes); + const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); + await checkSetBreakpointForScript(wasmScript.scriptId); + InspectorTest.log('Finished!'); +} + +function printFailure(message) { + if (!message.result) { + InspectorTest.logMessage(message); + } +} + +async function checkSetBreakpointForScript(scriptId) { + // If we try to set a breakpoint that is outside of any function, + // setBreakpoint should not add any breakpoint. + InspectorTest.log('Set breakpoint outside of any function: (0, 0).'); + await checkSetBreakpointIsFirstBreakableLocation(scriptId, 0, 0, undefined); + + // If we try to set a breakpoint that is inside of a function and + // the location is breakable, setBreakpoint is expected to add + // a breakpoint at that location. + InspectorTest.log('Set breakpoint at a breakable location: (0, 40).'); + let breakable = true; + await checkSetBreakpointIsFirstBreakableLocation(scriptId, 0, 40, breakable); + + // If we try to set a breakpoint that is inside of a function and + // the location is not breakable, setBreakpoint is expected to add + // a breakpoint at the next breakable location. + InspectorTest.log('Set breakpoint at non-breakable location: (0, 42).') + breakable = false; + await checkSetBreakpointIsFirstBreakableLocation(scriptId, 0, 42, breakable); +} + +async function checkSetBreakpointIsFirstBreakableLocation( + scriptId, lineNumber, columnNumber, breakable) { + // Choose an arbitrary end column number, as long as a breakable location is + // contained. + const endColumnNumber = columnNumber + 10; + const possibleLocationsMsg = await Protocol.Debugger.getPossibleBreakpoints({ + start: { + lineNumber: lineNumber, + columnNumber: columnNumber, + scriptId: scriptId + }, + end: { + lineNumber: lineNumber, + columnNumber: endColumnNumber, + scriptId: scriptId + } + }); + const possibleLocations = possibleLocationsMsg.result.locations; + + const setLocationMsg = + await setBreakpoint(scriptId, lineNumber, columnNumber); + if (!setLocationMsg.result) { + InspectorTest.log('Set breakpoint could not resolve break location.'); + return; + } + var setLocation = setLocationMsg.result.actualLocation; + + // Check that setting a breakpoint at a line actually + // sets the breakpoint at the first breakable location. + locationIsEqual(setLocation, possibleLocations[0]); + + // Make sure that the selected locations for the test + // are breakable/non breakable as expected. + if (breakable === + (setLocation.lineNumber === lineNumber && + setLocation.columnNumber === columnNumber)) { + InspectorTest.log( + `Initial location is expected to be breakable: ${breakable}.`); + }; +} + +function locationIsEqual(locA, locB) { + if (locA.lineNumber === locB.lineNumber && + locA.columnNumber === locB.columnNumber) { + InspectorTest.log( + `Location match for (${locA.lineNumber}, ${locA.columnNumber}).`); + } +} + +async function setBreakpoint(id, lineNumber, columnNumber) { + InspectorTest.log( + `Setting breakpoint for id: ${id} at ${lineNumber}, ${columnNumber}.`); + const location = { + scriptId: id, + lineNumber: lineNumber, + columnNumber: columnNumber + }; + const msg = await Protocol.Debugger.setBreakpoint({location: location}); + printFailure(msg); + return msg; +} diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff-expected.txt b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff-expected.txt index c85aeeab2e..8dce88c8cf 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff-expected.txt @@ -8,12 +8,14 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 Scope: at wasm_A (0:38): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -31,12 +33,14 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 Scope: at wasm_A (0:39): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -45,8 +49,9 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 Scope: at wasm_B (0:45): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -55,10 +60,11 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 Scope: at wasm_B (0:47): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): - 0: 3 (number) + 0: 3 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -66,8 +72,9 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 Scope: at wasm_B (0:49): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -76,10 +83,11 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 Scope: at wasm_B (0:51): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): - 0: 3 (number) + 0: 3 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -87,11 +95,12 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b Scope: at wasm_B (0:53): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): - 0: 3 (number) - 1: 1 (number) + 0: 3 (i32) + 1: 1 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -99,10 +108,11 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 Scope: at wasm_B (0:54): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 3 (number) + var0: 3 (i32) - scope (wasm-expression-stack): - 0: 2 (number) + 0: 2 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -110,12 +120,14 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 Scope: at wasm_A (0:38): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -124,12 +136,14 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 Scope: at wasm_A (0:39): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -138,8 +152,9 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 Scope: at wasm_B (0:45): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -148,10 +163,11 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 Scope: at wasm_B (0:47): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): - 0: 2 (number) + 0: 2 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -159,8 +175,9 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 Scope: at wasm_B (0:49): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -169,10 +186,11 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 Scope: at wasm_B (0:51): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): - 0: 2 (number) + 0: 2 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -180,11 +198,12 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b Scope: at wasm_B (0:53): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): - 0: 2 (number) - 1: 1 (number) + 0: 2 (i32) + 1: 1 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -192,10 +211,11 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 Scope: at wasm_B (0:54): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 2 (number) + var0: 2 (i32) - scope (wasm-expression-stack): - 0: 1 (number) + 0: 1 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -203,12 +223,14 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 Scope: at wasm_A (0:38): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -217,12 +239,14 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 Scope: at wasm_A (0:39): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -231,8 +255,9 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 Scope: at wasm_B (0:45): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -241,10 +266,11 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 Scope: at wasm_B (0:47): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): - 0: 1 (number) + 0: 1 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -252,8 +278,9 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 Scope: at wasm_B (0:49): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -262,10 +289,11 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 Scope: at wasm_B (0:51): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): - 0: 1 (number) + 0: 1 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -273,11 +301,12 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b Scope: at wasm_B (0:53): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): - 0: 1 (number) - 1: 1 (number) + 0: 1 (i32) + 1: 1 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -285,10 +314,11 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 Scope: at wasm_B (0:54): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 1 (number) + var0: 1 (i32) - scope (wasm-expression-stack): - 0: 0 (number) + 0: 0 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -296,12 +326,14 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 Scope: at wasm_A (0:38): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 0 (number) + var0: 0 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -310,12 +342,14 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 Scope: at wasm_A (0:39): - scope (module): + instance: exports: "main" (Function) - scope (local): - scope (wasm-expression-stack): at wasm_B (0:56): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 0 (number) + var0: 0 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -324,8 +358,9 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 Scope: at wasm_B (0:45): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 0 (number) + var0: 0 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped @@ -334,10 +369,11 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 Scope: at wasm_B (0:47): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 0 (number) + var0: 0 (i32) - scope (wasm-expression-stack): - 0: 0 (number) + 0: 0 (i32) at (anonymous) (0:17): -- skipped Paused: @@ -345,8 +381,9 @@ Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0x0b Scope: at wasm_B (0:61): - scope (module): + instance: exports: "main" (Function) - scope (local): - locals: "var0": 0 (number) + var0: 0 (i32) - scope (wasm-expression-stack): at (anonymous) (0:17): -- skipped diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff.js b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff.js index 8de53c192c..205b6fd604 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff.js +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-liftoff.js @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + const {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping through wasm scripts.'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - const builder = new WasmModuleBuilder(); const func_a = @@ -34,24 +34,8 @@ const func_b = builder.addFunction('wasm_B', kSig_v_i) const module_bytes = builder.toArray(); -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); -} - const getResult = msg => msg.result || InspectorTest.logMessage(msg); -const evalWithUrl = (code, url) => - Protocol.Runtime - .evaluate({'expression': code + '\n//# sourceURL=v8://test/' + url}) - .then(getResult); - function setBreakpoint(offset, scriptId, scriptUrl) { InspectorTest.log( 'Setting breakpoint at offset ' + offset + ' on script ' + scriptUrl); @@ -82,10 +66,7 @@ Protocol.Debugger.onPaused(async msg => { InspectorTest.logObject(' - scope (' + scope.type + '):'); var properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); - for (var value of properties.result.result) { - var value_str = await getScopeValues(value.value); - InspectorTest.log(' ' + value.name + ': ' + value_str); - } + await WasmInspectorTest.dumpScopeProperties(properties); } } @@ -103,24 +84,11 @@ Protocol.Debugger.onPaused(async msg => { Protocol.Debugger.resume(); }); -async function getScopeValues(value) { - if (value.type == 'object') { - let msg = await Protocol.Runtime.getProperties({objectId: value.objectId}); - const printProperty = function(elem) { - return `"${elem.name}": ${elem.value.value} (${elem.value.type})`; - } - return msg.result.result.map(printProperty).join(', '); - } - return value.value + ' (' + value.type + ')'; -} - (async function test() { await Protocol.Debugger.enable(); InspectorTest.log('Instantiating.'); // Spawn asynchronously: - let instantiate_code = 'const instance = (' + instantiate + ')(' + - JSON.stringify(module_bytes) + ');'; - evalWithUrl(instantiate_code, 'instantiate'); + WasmInspectorTest.instantiate(module_bytes); InspectorTest.log( 'Waiting for wasm script (ignoring first non-wasm script).'); // Ignore javascript and full module wasm script, get scripts for functions. @@ -129,7 +97,7 @@ async function getScopeValues(value) { // breakpoint, new ones will be added. await setBreakpoint(func_a.body_offset, wasm_script.scriptId, wasm_script.url); InspectorTest.log('Calling main(4)'); - await evalWithUrl('instance.exports.main(4)', 'runWasm'); + await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm'); InspectorTest.log('exports.main returned!'); InspectorTest.log('Finished!'); InspectorTest.completeTest(); diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js index 0c73cf5dba..33507f97df 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + const {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping through wasm scripts.'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - const builder = new WasmModuleBuilder(); const func_a_idx = @@ -33,24 +33,8 @@ const func_b = builder.addFunction('wasm_B', kSig_v_i) const module_bytes = builder.toArray(); -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); -} - const getResult = msg => msg.result || InspectorTest.logMessage(msg); -const evalWithUrl = (code, url) => - Protocol.Runtime - .evaluate({'expression': code + '\n//# sourceURL=v8://test/' + url}) - .then(getResult); - function setBreakpoint(offset, script) { InspectorTest.log( 'Setting breakpoint at offset ' + offset + ' on script ' + script.url); @@ -73,9 +57,7 @@ Protocol.Debugger.onPaused(pause_msg => { await Protocol.Debugger.enable(); InspectorTest.log('Instantiating.'); // Spawn asynchronously: - let instantiate_code = 'const instance = (' + instantiate + ')(' + - JSON.stringify(module_bytes) + ');'; - evalWithUrl(instantiate_code, 'instantiate'); + WasmInspectorTest.instantiate(module_bytes); InspectorTest.log( 'Waiting for wasm script (ignoring first non-wasm script).'); // Ignore javascript and full module wasm script, get scripts for functions. @@ -84,7 +66,7 @@ Protocol.Debugger.onPaused(pause_msg => { await setBreakpoint(func_b.body_offset + offset, wasm_script); } InspectorTest.log('Calling main(4)'); - await evalWithUrl('instance.exports.main(4)', 'runWasm'); + await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm'); InspectorTest.log('exports.main returned!'); InspectorTest.log('Finished!'); InspectorTest.completeTest(); diff --git a/deps/v8/test/inspector/debugger/wasm-source.js b/deps/v8/test/inspector/debugger/wasm-source.js index 55da49f446..3fd522f8d0 100644 --- a/deps/v8/test/inspector/debugger/wasm-source.js +++ b/deps/v8/test/inspector/debugger/wasm-source.js @@ -4,9 +4,9 @@ // Flags: --expose-wasm -let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scrips report the source'); +utils.load('test/inspector/wasm-inspector-test.js'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scrips report the source'); var builder = new WasmModuleBuilder(); diff --git a/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt b/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt new file mode 100644 index 0000000000..4868b3e3a2 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt @@ -0,0 +1,12 @@ +Tests pausing a running script and stepping +Instantiate +Wait for script +Got wasm script: wasm://wasm/c84b7cde +Run +Expecting to pause at 61 +Paused at offset 61; local: [12]; wasm-expression-stack: [] +Paused at offset 62; local: [12]; wasm-expression-stack: [] +Paused at offset 64; local: [12]; wasm-expression-stack: [12] +Paused at offset 66; local: [12]; wasm-expression-stack: [12, 1] +Paused at offset 67; local: [12]; wasm-expression-stack: [13] +Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-stack-check.js b/deps/v8/test/inspector/debugger/wasm-stack-check.js new file mode 100644 index 0000000000..7963ab27e0 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stack-check.js @@ -0,0 +1,78 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +utils.load('test/inspector/wasm-inspector-test.js'); + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests pausing a running script and stepping'); + +var builder = new WasmModuleBuilder(); + +let pause = builder.addImport('imports', 'pause', kSig_v_v); +let f = builder.addFunction('f', kSig_i_i) + .addBody([ + kExprLocalGet, 0, + kExprI32Const, 1, + kExprI32Add]); +let main = builder.addFunction('main', kSig_i_v) + .addBody([ + kExprCallFunction, pause, + kExprI32Const, 12, kExprCallFunction, f.index]) + .exportFunc(); + +var module_bytes = builder.toArray(); + +function instantiate(bytes, imports) { + var buffer = new ArrayBuffer(bytes.length); + var view = new Uint8Array(buffer); + for (var i = 0; i < bytes.length; ++i) { + view[i] = bytes[i] | 0; + } + const module = new WebAssembly.Module(buffer); + return new WebAssembly.Instance(module, imports); +} + +(async function pauseAndStep() { + await Protocol.Debugger.enable(); + InspectorTest.log('Instantiate'); + const instantiate_code = `var instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }});`; + WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate'); + InspectorTest.log('Wait for script'); + const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); + InspectorTest.log('Got wasm script: ' + wasmScript.url); + + InspectorTest.log('Run'); + Protocol.Runtime.evaluate({expression: 'instance.exports.main()'}); + InspectorTest.log('Expecting to pause at ' + (f.body_offset - 1)); + await waitForPauseAndStep('stepInto'); + await waitForPauseAndStep('stepInto'); + await waitForPauseAndStep('stepInto'); + await waitForPauseAndStep('stepInto'); + await waitForPauseAndStep('resume'); + InspectorTest.log('Finished!'); + InspectorTest.completeTest(); +})(); + +async function waitForPauseAndStep(stepAction) { + const msg = await Protocol.Debugger.oncePaused(); + await inspect(msg.params.callFrames[0]); + Protocol.Debugger[stepAction](); +} + +async function inspect(frame) { + let loc = frame.location; + let line = [`Paused at offset ${loc.columnNumber}`]; + // Inspect only the top wasm frame. + for (var scope of frame.scopeChain) { + if (scope.type == 'module') continue; + var scope_properties = + await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); + let str = scope_properties.result.result.map( + elem => WasmInspectorTest.getWasmValue(elem.value)).join(', '); + line.push(`${scope.type}: [${str}]`); + } + InspectorTest.log(line.join('; ')); +} diff --git a/deps/v8/test/inspector/debugger/wasm-stack.js b/deps/v8/test/inspector/debugger/wasm-stack.js index 0e2ff0fa8e..e5a19e6fe8 100644 --- a/deps/v8/test/inspector/debugger/wasm-stack.js +++ b/deps/v8/test/inspector/debugger/wasm-stack.js @@ -4,9 +4,9 @@ // Flags: --expose-wasm -let {session, contextGroup, Protocol} = InspectorTest.start('Tests call stack in wasm scripts'); +utils.load('test/inspector/wasm-inspector-test.js'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +let {session, contextGroup, Protocol} = InspectorTest.start('Tests call stack in wasm scripts'); var builder = new WasmModuleBuilder(); diff --git a/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt b/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt index 8b0861de10..3424b4e96c 100644 --- a/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt @@ -5,7 +5,11 @@ Paused at: --- 0 --- Script wasm://wasm/a9a86c5e byte offset 46: Wasm opcode 0x6d scope at div (0:46): - locals: "a": 1, "b": 0, "unused": 4711, "local_zero": 0, "local_const_11": 11 + a: 1 + b: 0 + unused: 4711 + local_zero: 0 + local_const_11: 11 --- 1 --- try { instance.exports.#div(1, 0, 4711); // traps (div by zero) @@ -31,7 +35,11 @@ Paused at: --- 0 --- Script wasm://wasm/a9a86c5e byte offset 46: Wasm opcode 0x6d scope at div (0:46): - locals: "a": -2147483648, "b": -1, "unused": 4711, "local_zero": 0, "local_const_11": 11 + a: -2147483648 + b: -1 + unused: 4711 + local_zero: 0 + local_const_11: 11 --- 1 --- try { instance.exports.#div(0x80000000, -1, 4711); // traps (unrepresentable) diff --git a/deps/v8/test/inspector/debugger/wasm-step-after-trap.js b/deps/v8/test/inspector/debugger/wasm-step-after-trap.js index c3f5af6dcf..7d396c5e1c 100644 --- a/deps/v8/test/inspector/debugger/wasm-step-after-trap.js +++ b/deps/v8/test/inspector/debugger/wasm-step-after-trap.js @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + const {session, contextGroup, Protocol} = InspectorTest.start('Test scope inspection and stepping after a trap.'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - const builder = new WasmModuleBuilder(); // Create a function which computes the div of the first two arguments. @@ -23,25 +23,13 @@ builder.addFunction('div', kSig_i_iii) ]) .exportFunc(); -const module_bytes = JSON.stringify(builder.toArray()); - -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module); -} +const module_bytes = builder.toArray(); function getShortLocationString(location) { return `${location.lineNumber}:${location.columnNumber}`; } -let actions = - ['stepInto', 'resume', 'stepInto', 'resume', 'stepInfo', 'resume']; +let actions = ['stepInto', 'resume', 'stepInto', 'resume']; Protocol.Debugger.onPaused(async msg => { InspectorTest.log('Paused at:'); for (let [nr, frame] of msg.params.callFrames.entries()) { @@ -51,6 +39,10 @@ Protocol.Debugger.onPaused(async msg => { } InspectorTest.log('-------------'); let action = actions.shift(); + if (!action) { + InspectorTest.log('ERROR: no more expected action'); + action = 'resume'; + } InspectorTest.log(`-> ${action}`); Protocol.Debugger[action](); }); @@ -69,15 +61,13 @@ function call_div() { } } -contextGroup.addScript(instantiate.toString()); contextGroup.addScript(call_div.toString()); (async function test() { await Protocol.Debugger.enable(); await Protocol.Debugger.setPauseOnExceptions({state: 'all'}); InspectorTest.log('Instantiating.'); - await Protocol.Runtime.evaluate( - {'expression': `const instance = instantiate(${module_bytes});`}); + await WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Calling div function.'); await Protocol.Runtime.evaluate({'expression': 'call_div()'}); InspectorTest.log('Finished.'); @@ -92,11 +82,7 @@ async function printLocalScope(frame) { let properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); for (let value of properties.result.result) { - let msg = await Protocol.Runtime.getProperties( - {objectId: value.value.objectId}); - let prop_str = p => `"${p.name}": ${p.value.value}`; - let value_str = msg.result.result.map(prop_str).join(', '); - InspectorTest.log(` ${value.name}: ${value_str}`); + InspectorTest.log(` ${value.name}: ${value.value.value}`); } } } diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets-expected.txt index 569699ea24..72dd1f9cf6 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets-expected.txt @@ -12,7 +12,7 @@ at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {"0":1024} at (anonymous) (0:17): @@ -24,14 +24,14 @@ at wasm_A (0:39): - scope (module): -- skipped - scope (local): - locals: {"var0":1024} + {"var0":1024} - scope (wasm-expression-stack): {} at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -43,14 +43,14 @@ at wasm_A (0:40): - scope (module): -- skipped - scope (local): - locals: {"var0":1024} + {"var0":1024} - scope (wasm-expression-stack): {} at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -62,7 +62,7 @@ at wasm_B (0:62): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -74,7 +74,7 @@ at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":2} + {"var0":2} - scope (wasm-expression-stack): {"0":1024} at (anonymous) (0:17): @@ -86,7 +86,7 @@ at wasm_B (0:62): - scope (module): -- skipped - scope (local): - locals: {"var0":2} + {"var0":2} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -98,7 +98,7 @@ at wasm_B (0:46): - scope (module): -- skipped - scope (local): - locals: {"var0":2} + {"var0":2} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -110,7 +110,7 @@ at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1024} at (anonymous) (0:17): @@ -122,14 +122,14 @@ at wasm_A (0:39): - scope (module): -- skipped - scope (local): - locals: {"var0":1024} + {"var0":1024} - scope (wasm-expression-stack): {} at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -141,7 +141,7 @@ at wasm_B (0:62): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -153,7 +153,7 @@ at wasm_B (0:46): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -165,7 +165,7 @@ at wasm_B (0:48): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1} at (anonymous) (0:17): @@ -177,7 +177,7 @@ at wasm_B (0:50): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -189,7 +189,7 @@ at wasm_B (0:52): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1} at (anonymous) (0:17): @@ -201,7 +201,7 @@ at wasm_B (0:54): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1,"1":1} at (anonymous) (0:17): @@ -213,7 +213,7 @@ at wasm_B (0:55): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":0} at (anonymous) (0:17): @@ -225,7 +225,7 @@ at wasm_B (0:57): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -237,7 +237,7 @@ at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {"0":1024} at (anonymous) (0:17): @@ -249,14 +249,14 @@ at wasm_A (0:39): - scope (module): -- skipped - scope (local): - locals: {"var0":1024} + {"var0":1024} - scope (wasm-expression-stack): {} at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -268,14 +268,14 @@ at wasm_A (0:40): - scope (module): -- skipped - scope (local): - locals: {"var0":1024} + {"var0":1024} - scope (wasm-expression-stack): {} at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -287,14 +287,14 @@ at wasm_A (0:41): - scope (module): -- skipped - scope (local): - locals: {"var0":1024} + {"var0":1024} - scope (wasm-expression-stack): {} at wasm_B (0:60): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -306,7 +306,7 @@ at wasm_B (0:62): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets.js b/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets.js index 70f73d6cac..b4fdc7ae3e 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-byte-offsets.js @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping through wasm scripts by byte offsets'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); var func_a_idx = @@ -36,28 +36,13 @@ builder.addFunction('wasm_B', kSig_v_i) var module_bytes = builder.toArray(); -function instantiate(bytes) { - 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); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - (async function test() { for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume']) InspectorTest.logProtocolCommandCalls('Debugger.' + action); await Protocol.Debugger.enable(); InspectorTest.log('Setting up global instance variable.'); - Protocol.Runtime.evaluate({ - expression: `var instance;` + - `(${instantiate.toString()})(${JSON.stringify(module_bytes)})` - }); + WasmInspectorTest.instantiate(module_bytes); const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); InspectorTest.log('Got wasm script: ' + wasmScript.url); @@ -113,11 +98,7 @@ async function waitForPauseAndStep(stepAction) { functionDeclaration: 'function() { return this; }', returnByValue: true }); - if (scope.type === 'local') { - InspectorTest.log(` locals: ${JSON.stringify(value.locals)}`); - } else { - InspectorTest.log(` ${JSON.stringify(value)}`); - } + InspectorTest.log(` ${JSON.stringify(value)}`); } } } diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js-expected.txt index 89d64b9513..d4b4552a74 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js-expected.txt @@ -1,8 +1,7 @@ Tests stepping from javascript into wasm -Installing code and global variable. Calling instantiate function. Waiting for wasm scripts to be parsed. -Ignoring script with url v8://test/callInstantiate +Ignoring script with url v8://test/instantiate Got wasm script: wasm://wasm/7d022e0e Setting breakpoint on i32.const { diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js.js b/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js.js index 510c1c0073..1cd0046a98 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-in-from-js.js @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping from javascript into wasm'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let builder = new WasmModuleBuilder(); // wasm_A @@ -21,21 +21,6 @@ let func = builder.addFunction('wasm_A', kSig_i_i) let module_bytes = builder.toArray(); -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - -let evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - Protocol.Debugger.onPaused(async message => { InspectorTest.log('paused'); var frames = message.params.callFrames; @@ -61,11 +46,8 @@ function test() { (async function Test() { await Protocol.Debugger.enable(); - InspectorTest.log('Installing code and global variable.'); - await evalWithUrl('var instance;\n' + instantiate.toString(), 'setup'); InspectorTest.log('Calling instantiate function.'); - evalWithUrl( - 'instantiate(' + JSON.stringify(module_bytes) + ')', 'callInstantiate'); + WasmInspectorTest.instantiate(module_bytes); const scriptId = await waitForWasmScript(); InspectorTest.log('Setting breakpoint on i32.const'); let msg = await Protocol.Debugger.setBreakpoint({ diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-liftoff.js b/deps/v8/test/inspector/debugger/wasm-stepping-liftoff.js index 7ff4f58d87..fa8af06159 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-liftoff.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-liftoff.js @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping through wasm scripts by byte offsets'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); var func_a_idx = @@ -54,28 +54,13 @@ let fact = builder.addFunction('fact', kSig_i_i) var module_bytes = builder.toArray(); -function instantiate(bytes) { - 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); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - (async function test() { for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume']) InspectorTest.logProtocolCommandCalls('Debugger.' + action); await Protocol.Debugger.enable(); InspectorTest.log('Setting up global instance variable.'); - Protocol.Runtime.evaluate({ - expression: `var instance;` + - `(${instantiate.toString()})(${JSON.stringify(module_bytes)})` - }); + WasmInspectorTest.instantiate(module_bytes); const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); InspectorTest.log('Got wasm script: ' + wasmScript.url); diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt new file mode 100644 index 0000000000..61e9037fab --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt @@ -0,0 +1,14 @@ +Tests that Liftoff does not merge opcodes while stepping +Setting breakpoint at offset 33. +Paused at offset 33: [0] +Paused at offset 35: [0, 0] +Paused at offset 36: [0, 1] +Paused at offset 33: [-1] +Paused at offset 35: [-1, -1] +Paused at offset 36: [-1, 0] +Paused at offset 38: [-1] +Paused at offset 33: [13] +Paused at offset 35: [13, 13] +Paused at offset 36: [13, 0] +Paused at offset 38: [13] +Finished. diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js new file mode 100644 index 0000000000..172ea1223d --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js @@ -0,0 +1,65 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +utils.load('test/inspector/wasm-inspector-test.js'); + +let {session, contextGroup, Protocol} = InspectorTest.start( + 'Tests that Liftoff does not merge opcodes while stepping'); +session.setupScriptMap(); + +let builder = new WasmModuleBuilder(); + +// i32.eqz and br_if are usually merged, so we wouldn't see any +// update on the operand stack after i32.eqz. For debugging, +// this is disabled, so we should see the result. +let body = [kExprLocalGet, 0, kExprI32Eqz, kExprBrIf, 0]; +let fun = builder.addFunction('fun', kSig_v_i).addBody(body).exportFunc(); + +let module_bytes = builder.toArray(); + +let wasm_script_id = undefined; +Protocol.Debugger.onPaused(printPauseLocationAndStep); + +(async function test() { + await Protocol.Debugger.enable(); + WasmInspectorTest.instantiate(module_bytes); + [, {params: {scriptId: wasm_script_id}}] = await Protocol.Debugger.onceScriptParsed(2); + + // Set a breakpoint at the beginning of 'fun'. + const offset = fun.body_offset; + InspectorTest.log(`Setting breakpoint at offset ${offset}.`); + let bpmsg = await Protocol.Debugger.setBreakpoint({ + location: {scriptId: wasm_script_id, lineNumber: 0, columnNumber: offset} + }); + + for (let value of [0, -1, 13]) { + await Protocol.Runtime.evaluate( + {expression: `instance.exports.fun(${value})`}); + } + InspectorTest.log('Finished.'); +})().catch(reason => InspectorTest.log(`Failed: ${reason}`)) + .finally(InspectorTest.completeTest); + +async function printPauseLocationAndStep(msg) { + // If we are outside of wasm, continue. + let loc = msg.params.callFrames[0].location; + if (loc.scriptId != wasm_script_id) { + Protocol.Debugger.resume(); + return; + } + + // Inspect only the top wasm frame. + let frame = msg.params.callFrames[0]; + let scopes = {}; + for (let scope of frame.scopeChain) { + if (scope.type == 'module') continue; + let scope_properties = + await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); + scopes[scope.type] = scope_properties.result.result.map( + elem => WasmInspectorTest.getWasmValue(elem.value)); + } + let values = scopes['local'].concat(scopes['wasm-expression-stack']).join(', '); + InspectorTest.log(`Paused at offset ${loc.columnNumber}: [${values}]`); + Protocol.Debugger.stepOver(); +} diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-to-js-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-to-js-expected.txt index 29ea23e14e..37deb683b8 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-to-js-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-to-js-expected.txt @@ -1,8 +1,7 @@ Tests stepping to javascript from wasm -Installing code and global variable. Calling instantiate function. Waiting for wasm scripts to be parsed. -Ignoring script with url v8://test/callInstantiate +Ignoring script with url v8://test/instantiate Got wasm script: wasm://wasm/242f4a16 Setting breakpoint at start of wasm function { diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-to-js.js b/deps/v8/test/inspector/debugger/wasm-stepping-to-js.js index f480e4e567..7ab7599c75 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-to-js.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-to-js.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping to javascript from wasm'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - let builder = new WasmModuleBuilder(); // wasm_A @@ -20,21 +20,6 @@ let func = builder.addFunction('wasm_A', kSig_v_v) let module_bytes = builder.toArray(); -function instantiate(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes[i] | 0; - } - - let module = new WebAssembly.Module(buffer); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - -let evalWithUrl = (code, url) => Protocol.Runtime.evaluate( - {'expression': code + '\n//# sourceURL=v8://test/' + url}); - Protocol.Debugger.onPaused(async message => { InspectorTest.log("paused"); var frames = message.params.callFrames; @@ -78,11 +63,8 @@ function test() { (async function Test() { await Protocol.Debugger.enable(); - InspectorTest.log('Installing code and global variable.'); - await evalWithUrl('var instance;\n' + instantiate.toString(), 'setup'); InspectorTest.log('Calling instantiate function.'); - evalWithUrl( - 'instantiate(' + JSON.stringify(module_bytes) + ')', 'callInstantiate'); + WasmInspectorTest.instantiate(module_bytes); const scriptId = await waitForWasmScript(); InspectorTest.log( 'Setting breakpoint at start of wasm function'); diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-skiplist-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-with-skiplist-expected.txt new file mode 100644 index 0000000000..ce23513810 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-skiplist-expected.txt @@ -0,0 +1,117 @@ +Tests stepping through wasm scripts by byte offsets +Setting up global instance variable +Got wasm script: wasm://wasm/befe41aa +{ + columnNumber : 46 + lineNumber : 0 + scriptId : <scriptId> +} +Test with valid skip lists +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping over without skip list +Testing stepOver with skipList: [] +Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04 +Script wasm://wasm/befe41aa byte offset 50: Wasm opcode 0x20 +Script wasm://wasm/befe41aa byte offset 52: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 54: Wasm opcode 0x6b +Script wasm://wasm/befe41aa byte offset 55: Wasm opcode 0x21 +Script wasm://wasm/befe41aa byte offset 57: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10 +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping over with skip list +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":50}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":60},"end":{"lineNumber":0,"columnNumber":62}}] +Script wasm://wasm/befe41aa byte offset 50: Wasm opcode 0x20 +Script wasm://wasm/befe41aa byte offset 52: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 54: Wasm opcode 0x6b +Script wasm://wasm/befe41aa byte offset 55: Wasm opcode 0x21 +Script wasm://wasm/befe41aa byte offset 57: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping over start location is inclusive +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":61}}] +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping over end location is exclusive +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":49},"end":{"lineNumber":0,"columnNumber":62}}] +Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04 +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping into without skip list +Testing stepInto with skipList: [] +Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04 +Script wasm://wasm/befe41aa byte offset 50: Wasm opcode 0x20 +Script wasm://wasm/befe41aa byte offset 52: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 54: Wasm opcode 0x6b +Script wasm://wasm/befe41aa byte offset 55: Wasm opcode 0x21 +Script wasm://wasm/befe41aa byte offset 57: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10 +Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01 +Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x01 +Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0x0b +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping into with skip list, while call itself is skipped +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":39},"end":{"lineNumber":0,"columnNumber":41}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}}] +Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04 +Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0x0b +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping into start location is inclusive +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":39},"end":{"lineNumber":0,"columnNumber":40}}] +Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04 +Script wasm://wasm/befe41aa byte offset 50: Wasm opcode 0x20 +Script wasm://wasm/befe41aa byte offset 52: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 54: Wasm opcode 0x6b +Script wasm://wasm/befe41aa byte offset 55: Wasm opcode 0x21 +Script wasm://wasm/befe41aa byte offset 57: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10 +Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x01 +Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0x0b +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: Stepping into end location is exclusive +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":38},"end":{"lineNumber":0,"columnNumber":41}}] +Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04 +Script wasm://wasm/befe41aa byte offset 50: Wasm opcode 0x20 +Script wasm://wasm/befe41aa byte offset 52: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 54: Wasm opcode 0x6b +Script wasm://wasm/befe41aa byte offset 55: Wasm opcode 0x21 +Script wasm://wasm/befe41aa byte offset 57: Wasm opcode 0x41 +Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10 +Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0x0b +Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test with invalid skip lists +Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20 +Test: start position has invalid column number +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":-1},"end":{"lineNumber":0,"columnNumber":62}}] +Position missing 'column' or 'column' < 0. +Test: start position has invalid line number +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":-1,"columnNumber":0},"end":{"lineNumber":0,"columnNumber":62}}] +Position missing 'line' or 'line' < 0. +Test: end position smaller than start position +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":62},"end":{"lineNumber":0,"columnNumber":48}}] +Input positions array is not sorted or contains duplicate values. +Test: skip list is not maximally merged +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":50}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}}] +Input positions array is not sorted or contains duplicate values. +Test: skip list is not sorted +Testing stepOver with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":62}}] +Input positions array is not sorted or contains duplicate values. +Test: start position has invalid column number +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":-1},"end":{"lineNumber":0,"columnNumber":62}}] +Position missing 'column' or 'column' < 0. +Test: start position has invalid line number +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":-1,"columnNumber":0},"end":{"lineNumber":0,"columnNumber":62}}] +Position missing 'line' or 'line' < 0. +Test: end position smaller than start position +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":62},"end":{"lineNumber":0,"columnNumber":48}}] +Input positions array is not sorted or contains duplicate values. +Test: skip list is not maximally merged +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":50}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}}] +Input positions array is not sorted or contains duplicate values. +Test: skip list is not sorted +Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":62}}] +Input positions array is not sorted or contains duplicate values. +Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-skiplist.js b/deps/v8/test/inspector/debugger/wasm-stepping-with-skiplist.js new file mode 100644 index 0000000000..0017274ef6 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-skiplist.js @@ -0,0 +1,196 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +utils.load('test/inspector/wasm-inspector-test.js'); + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests stepping through wasm scripts by byte offsets'); +session.setupScriptMap(); + +const builder = new WasmModuleBuilder(); + +const func_a = + builder.addFunction('wasm_A', kSig_v_i).addBody([kExprNop, kExprNop]); +const func_a_idx = func_a.index; + +// wasm_B calls wasm_A <param0> times. +const func_b = builder.addFunction('wasm_B', kSig_v_i) + .addBody([ + // clang-format off + kExprLoop, kWasmStmt, // while + kExprLocalGet, 0, // - + kExprIf, kWasmStmt, // if <param0> != 0 + kExprLocalGet, 0, // - + kExprI32Const, 1, // - + kExprI32Sub, // - + kExprLocalSet, 0, // decrease <param0> + ...wasmI32Const(1024), // some longer i32 const (2 byte imm) + kExprCallFunction, func_a_idx, // - + kExprBr, 1, // continue + kExprEnd, // - + kExprEnd, // break + // clang-format on + ]) + .exportAs('main'); + +const module_bytes = builder.toArray(); +const loop_start_offset = func_b.body_offset + 2; +const loop_body_start_offset = loop_start_offset + 2; +const loop_body_end_offset = loop_body_start_offset + 14; +const if_statement_offset = loop_body_start_offset + 2 +const call_function_offset = loop_body_start_offset + 12; + +const func_a_start_offset = func_a.body_offset; +const func_a_end_offset = func_a_start_offset + 2; + +runTest() + .catch(reason => InspectorTest.log(`Failed: ${reason}`)) + .then(InspectorTest.completeTest); + +async function runTest() { + await Protocol.Debugger.enable(); + InspectorTest.log('Setting up global instance variable'); + WasmInspectorTest.instantiate(module_bytes); + const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); + const scriptId = wasmScript.scriptId; + + InspectorTest.log('Got wasm script: ' + wasmScript.url); + + let bpmsg = await Protocol.Debugger.setBreakpoint({ + location: + {scriptId: scriptId, lineNumber: 0, columnNumber: loop_start_offset} + }); + InspectorTest.logMessage(bpmsg.result.actualLocation); + + await checkValidSkipLists(scriptId); + await checkInvalidSkipLists(scriptId); + + InspectorTest.log('Finished!'); +} + +async function checkValidSkipLists(scriptId) { + InspectorTest.log('Test with valid skip lists'); + Protocol.Runtime.evaluate({expression: 'instance.exports.main(8)'}); + const {params: {callFrames}} = await Protocol.Debugger.oncePaused(); + await session.logSourceLocation(callFrames[0].location); + + InspectorTest.log('Test: Stepping over without skip list'); + let skipList = []; + await stepThroughOneLoopIteration(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping over with skip list'); + skipList = [ + createLocationRange(scriptId, loop_body_start_offset, if_statement_offset), + createLocationRange(scriptId, call_function_offset, loop_body_end_offset) + ]; + await stepThroughOneLoopIteration(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping over start location is inclusive'); + skipList = [ + createLocationRange( + scriptId, loop_body_start_offset, loop_body_end_offset - 1), + ]; + await stepThroughOneLoopIteration(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping over end location is exclusive'); + skipList = [ + createLocationRange( + scriptId, loop_body_start_offset + 1, loop_body_end_offset), + ]; + await stepThroughOneLoopIteration(skipList, 'stepOver'); + + InspectorTest.log('Test: Stepping into without skip list'); + skipList = []; + await stepThroughOneLoopIteration(skipList, 'stepInto'); + + InspectorTest.log( + 'Test: Stepping into with skip list, while call itself is skipped'); + skipList = [ + createLocationRange(scriptId, func_a_start_offset, func_a_end_offset), + createLocationRange(scriptId, if_statement_offset, loop_body_end_offset) + ]; + await stepThroughOneLoopIteration(skipList, 'stepInto'); + + InspectorTest.log('Test: Stepping into start location is inclusive'); + skipList = [ + createLocationRange(scriptId, func_a_start_offset, func_a_end_offset - 1), + ]; + await stepThroughOneLoopIteration(skipList, 'stepInto'); + + InspectorTest.log('Test: Stepping into end location is exclusive'); + skipList = [ + createLocationRange(scriptId, func_a_start_offset - 1, func_a_end_offset), + ]; + await stepThroughOneLoopIteration(skipList, 'stepInto'); + + await Protocol.Debugger.resume(); +} + +async function checkInvalidSkipLists(scriptId) { + InspectorTest.log('Test with invalid skip lists'); + Protocol.Runtime.evaluate({expression: 'instance.exports.main(8)'}); + const {params: {callFrames}} = await Protocol.Debugger.oncePaused(); + await session.logSourceLocation(callFrames[0].location); + + const actions = ['stepOver', 'stepInto']; + for (let action of actions) { + InspectorTest.log('Test: start position has invalid column number'); + let skipList = [ + createLocationRange(scriptId, -1, loop_body_end_offset), + ]; + await stepThroughOneLoopIteration(skipList, action); + + InspectorTest.log('Test: start position has invalid line number'); + skipList = [{ + scriptId: scriptId, + start: {lineNumber: -1, columnNumber: 0}, + end: {lineNumber: 0, columnNumber: loop_body_end_offset} + }]; + await stepThroughOneLoopIteration(skipList, action); + + InspectorTest.log('Test: end position smaller than start position'); + skipList = [createLocationRange( + scriptId, loop_body_end_offset, loop_body_start_offset)]; + await stepThroughOneLoopIteration(skipList, action); + + InspectorTest.log('Test: skip list is not maximally merged'); + skipList = [ + createLocationRange( + scriptId, loop_body_start_offset, if_statement_offset), + createLocationRange(scriptId, if_statement_offset, loop_body_end_offset) + ]; + await stepThroughOneLoopIteration(skipList, action); + + InspectorTest.log('Test: skip list is not sorted'); + skipList = [ + createLocationRange(scriptId, if_statement_offset, loop_body_end_offset), + createLocationRange( + scriptId, loop_body_start_offset, loop_body_end_offset) + ]; + await stepThroughOneLoopIteration(skipList, action); + } +} + +async function stepThroughOneLoopIteration(skipList, stepAction) { + InspectorTest.log( + `Testing ${stepAction} with skipList: ${JSON.stringify(skipList)}`); + let topFrameLocation = -1; + while (topFrameLocation.columnNumber != loop_start_offset) { + const stepOverMsg = await Protocol.Debugger[stepAction]({skipList}); + if (stepOverMsg.error) { + InspectorTest.log(stepOverMsg.error.message); + return; + } + const {params: {callFrames}} = await Protocol.Debugger.oncePaused(); + topFrameLocation = callFrames[0].location; + await session.logSourceLocation(topFrameLocation); + } +} + +function createLocationRange(scriptId, startColumn, endColumn) { + return { + scriptId: scriptId, start: {lineNumber: 0, columnNumber: startColumn}, + end: {lineNumber: 0, columnNumber: endColumn} + } +} diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt index 543e424214..1e58407b5e 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt @@ -1,5 +1,4 @@ Tests stepping through wasm scripts with source maps -Installing code an global variable and instantiate. Got wasm script: wasm://wasm/9b4bf87e Script sourceMapURL: abc Requesting source for wasm://wasm/9b4bf87e... @@ -15,7 +14,7 @@ at wasm_B (0:54): - scope (module): -- skipped - scope (local): - locals: {"var0":4} + {"var0":4} - scope (wasm-expression-stack): {"0":3} at (anonymous) (0:17): @@ -27,7 +26,7 @@ at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -39,13 +38,14 @@ at wasm_A (0:38): - scope (module): -- skipped - scope (local): + {} - scope (wasm-expression-stack): {} at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -57,13 +57,14 @@ at wasm_A (0:39): - scope (module): -- skipped - scope (local): + {} - scope (wasm-expression-stack): {} at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -75,7 +76,7 @@ at wasm_B (0:58): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -87,7 +88,7 @@ at wasm_B (0:54): - scope (module): -- skipped - scope (local): - locals: {"var0":3} + {"var0":3} - scope (wasm-expression-stack): {"0":2} at (anonymous) (0:17): @@ -99,7 +100,7 @@ at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":2} + {"var0":2} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -111,7 +112,7 @@ at wasm_B (0:58): - scope (module): -- skipped - scope (local): - locals: {"var0":2} + {"var0":2} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -123,7 +124,7 @@ at wasm_B (0:54): - scope (module): -- skipped - scope (local): - locals: {"var0":2} + {"var0":2} - scope (wasm-expression-stack): {"0":1} at (anonymous) (0:17): @@ -135,7 +136,7 @@ at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -147,13 +148,14 @@ at wasm_A (0:38): - scope (module): -- skipped - scope (local): + {} - scope (wasm-expression-stack): {} at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -165,7 +167,7 @@ at wasm_B (0:58): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -177,7 +179,7 @@ at wasm_B (0:45): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -189,7 +191,7 @@ at wasm_B (0:47): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1} at (anonymous) (0:17): @@ -201,7 +203,7 @@ at wasm_B (0:49): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -213,7 +215,7 @@ at wasm_B (0:51): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1} at (anonymous) (0:17): @@ -225,7 +227,7 @@ at wasm_B (0:53): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":1,"1":1} at (anonymous) (0:17): @@ -237,7 +239,7 @@ at wasm_B (0:54): - scope (module): -- skipped - scope (local): - locals: {"var0":1} + {"var0":1} - scope (wasm-expression-stack): {"0":0} at (anonymous) (0:17): @@ -249,7 +251,7 @@ at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -261,13 +263,14 @@ at wasm_A (0:38): - scope (module): -- skipped - scope (local): + {} - scope (wasm-expression-stack): {} at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -279,13 +282,14 @@ at wasm_A (0:39): - scope (module): -- skipped - scope (local): + {} - scope (wasm-expression-stack): {} at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -297,13 +301,14 @@ at wasm_A (0:40): - scope (module): -- skipped - scope (local): + {} - scope (wasm-expression-stack): {} at wasm_B (0:56): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): @@ -315,7 +320,7 @@ at wasm_B (0:58): - scope (module): -- skipped - scope (local): - locals: {"var0":0} + {"var0":0} - scope (wasm-expression-stack): {} at (anonymous) (0:17): diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js index b33751e7c6..5c7e514e45 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping through wasm scripts with source maps'); session.setupScriptMap(); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); var func_a_idx = @@ -36,26 +36,12 @@ builder.addCustomSection('sourceMappingURL', [3, 97, 98, 99]); var module_bytes = builder.toArray(); -function instantiate(bytes) { - 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); - // Set global variable. - instance = new WebAssembly.Instance(module); -} - (async function test() { for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume']) InspectorTest.logProtocolCommandCalls('Debugger.' + action); await Protocol.Debugger.enable(); - InspectorTest.log('Installing code an global variable and instantiate.'); - Protocol.Runtime.evaluate({ - expression: `var instance;(${instantiate.toString()})(${JSON.stringify(module_bytes)})`}); + WasmInspectorTest.instantiate(module_bytes); const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); InspectorTest.log('Got wasm script: ' + wasmScript.url); @@ -112,12 +98,7 @@ async function waitForPauseAndStep(stepAction) { returnByValue: true }); - if (scope.type === 'local') { - if (value.locals) - InspectorTest.log(` locals: ${JSON.stringify(value.locals)}`); - } else { - InspectorTest.log(` ${JSON.stringify(value)}`); - } + InspectorTest.log(` ${JSON.stringify(value)}`); } } } diff --git a/deps/v8/test/inspector/debugger/wasm-unnamed-function-names.js b/deps/v8/test/inspector/debugger/wasm-unnamed-function-names.js index fae8d66abc..307bc0f3d6 100644 --- a/deps/v8/test/inspector/debugger/wasm-unnamed-function-names.js +++ b/deps/v8/test/inspector/debugger/wasm-unnamed-function-names.js @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +utils.load('test/inspector/wasm-inspector-test.js'); + let {session, contextGroup, Protocol} = InspectorTest.start('Tests unnamed function in wasm scripts'); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); - var builder = new WasmModuleBuilder(); var imported_idx = builder.addImport('mode', 'import_func', kSig_v_v); diff --git a/deps/v8/test/inspector/heap-profiler/collect-garbage-expected.txt b/deps/v8/test/inspector/heap-profiler/collect-garbage-expected.txt new file mode 100644 index 0000000000..3e5b7ddaf9 --- /dev/null +++ b/deps/v8/test/inspector/heap-profiler/collect-garbage-expected.txt @@ -0,0 +1,4 @@ +Tests collectGarbage. + +Running test: testCollectGarbage +WeakRef state: WeakRef is cleared after GC.
\ No newline at end of file diff --git a/deps/v8/test/inspector/heap-profiler/collect-garbage.js b/deps/v8/test/inspector/heap-profiler/collect-garbage.js new file mode 100644 index 0000000000..58b7b470ad --- /dev/null +++ b/deps/v8/test/inspector/heap-profiler/collect-garbage.js @@ -0,0 +1,30 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-stress-incremental-marking + +let {session, contextGroup, Protocol} = InspectorTest.start( + 'Tests collectGarbage.'); + +contextGroup.addScript(` +function createWeakRef() { + globalThis.weak_ref = new WeakRef(new Array(1000).fill(0)); +} +function getWeakRef() { + if (!globalThis.weak_ref.deref()) return 'WeakRef is cleared after GC.'; + return 'WeakRef is not cleared. GC did not happen?' +} +//# sourceURL=test.js`); + +Protocol.Debugger.enable(); +Protocol.HeapProfiler.enable(); + +InspectorTest.runAsyncTestSuite([ + async function testCollectGarbage() { + await Protocol.Runtime.evaluate({ expression: 'createWeakRef()' }); + await Protocol.HeapProfiler.collectGarbage(); + let weak_ref = await Protocol.Runtime.evaluate({ expression: 'getWeakRef()' }); + InspectorTest.log(`WeakRef state: ${weak_ref.result.result.value}`); + } +]); diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc index b92d269c94..5946418665 100644 --- a/deps/v8/test/inspector/inspector-test.cc +++ b/deps/v8/test/inspector/inspector-test.cc @@ -111,10 +111,11 @@ std::vector<uint16_t> ToVector(const v8_inspector::StringView& string) { class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel { public: FrontendChannelImpl(TaskRunner* task_runner, int context_group_id, - v8::Isolate* isolate, v8::Local<v8::Function> function) + v8::Isolate* isolate, + v8::Local<v8::Function> dispatch_message_callback) : task_runner_(task_runner), context_group_id_(context_group_id), - function_(isolate, function) {} + dispatch_message_callback_(isolate, dispatch_message_callback) {} ~FrontendChannelImpl() override = default; void set_session_id(int session_id) { session_id_ = session_id; } @@ -151,7 +152,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel { v8::Context::Scope context_scope(context); v8::Local<v8::Value> message = ToV8String(data->isolate(), message_); v8::MaybeLocal<v8::Value> result; - result = channel_->function_.Get(data->isolate()) + result = channel_->dispatch_message_callback_.Get(data->isolate()) ->Call(context, context->Global(), 1, &message); } FrontendChannelImpl* channel_; @@ -160,7 +161,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel { TaskRunner* task_runner_; int context_group_id_; - v8::Global<v8::Function> function_; + v8::Global<v8::Function> dispatch_message_callback_; int session_id_; DISALLOW_COPY_AND_ASSIGN(FrontendChannelImpl); }; @@ -636,8 +637,8 @@ std::map<int, std::unique_ptr<FrontendChannelImpl>> UtilsExtension::channels_; class SetTimeoutTask : public TaskRunner::Task { public: SetTimeoutTask(int context_group_id, v8::Isolate* isolate, - v8::Local<v8::Function> function) - : function_(isolate, function), context_group_id_(context_group_id) {} + v8::Local<v8::Function> callback) + : callback_(isolate, callback), context_group_id_(context_group_id) {} ~SetTimeoutTask() override = default; bool is_priority_task() final { return false; } @@ -649,12 +650,12 @@ class SetTimeoutTask : public TaskRunner::Task { v8::Local<v8::Context> context = data->GetContext(context_group_id_); v8::Context::Scope context_scope(context); - v8::Local<v8::Function> function = function_.Get(data->isolate()); + v8::Local<v8::Function> callback = callback_.Get(data->isolate()); v8::MaybeLocal<v8::Value> result; - result = function->Call(context, context->Global(), 0, nullptr); + result = callback->Call(context, context->Global(), 0, nullptr); } - v8::Global<v8::Function> function_; + v8::Global<v8::Function> callback_; int context_group_id_; }; diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status index 61a7f02285..ba2c583625 100644 --- a/deps/v8/test/inspector/inspector.status +++ b/deps/v8/test/inspector/inspector.status @@ -18,7 +18,7 @@ # https://crbug.com/v8/10356 # This test worked in the wasm interpreter, but fails when using Liftoff for # debugging. - 'debugger/wasm-anyref-global': [FAIL], + 'debugger/wasm-externref-global': [FAIL], }], # ALWAYS ############################################################################## @@ -33,7 +33,6 @@ 'debugger/eval-scopes': [PASS, FAIL], 'debugger/scope-skip-variables-with-empty-name': [PASS, FAIL], 'debugger/update-call-frame-scopes': [PASS, FAIL], - 'debugger/side-effect-free-coverage-enabled': [PASS, FAIL], 'debugger/side-effect-free-debug-evaluate': [PASS, FAIL], 'debugger/evaluate-on-call-frame-in-module': [PASS, FAIL], }], # variant != default @@ -92,4 +91,43 @@ '*': [SKIP], # only relevant for mjsunit tests. }], +############################################################################## +['tsan == True', { + # TSan handles SIGPROF incorrectly (https://crbug.com/v8/9869). + 'cpu-profiler/console-profile-wasm': [SKIP], +}], # 'tsan == True' + +############################################################################## +['gc_stress or gc_fuzzer or variant == stress_incremental_marking', { + # Skip tests that fail with GC stress: https://crbug.com/v8/10748 + 'cpu-profiler/coverage': [SKIP], + 'cpu-profiler/coverage-block': [SKIP], + 'debugger/get-possible-breakpoints': [SKIP], + 'debugger/get-possible-breakpoints-array-literal': [SKIP], + 'debugger/get-possible-breakpoints-master': [SKIP], + 'debugger/limit-size-of-collected-scripts': [SKIP], + 'debugger/not-hold-promises': [SKIP], + 'debugger/regression-424142': [SKIP], + 'debugger/return-break-locations': [SKIP], + 'debugger/script-on-after-compile': [SKIP], + 'debugger/set-breakpoint-at-last-line': [SKIP], + 'debugger/set-breakpoint-breaks-on-first-breakable-location': [SKIP], + 'heap-profiler/collect-garbage' : [SKIP], + 'runtime-call-stats/collection': [SKIP], + 'runtime/context-destroyed-on-context-collected': [SKIP], + 'runtime/evaluate-async': [SKIP], + 'runtime/internal-properties-entries': [SKIP], + 'type-profiler/type-profile-start-stop': [SKIP], +}], # gc_stress + +############################################################################## +['variant == stress_js_bg_compile_wasm_code_gc', { + # Skip tests that fail with GC stress: https://crbug.com/v8/10748 + 'debugger/wasm-debug-command': [SKIP], + 'debugger/wasm-global-names': [SKIP], + 'debugger/wasm-set-breakpoint-liftoff': [SKIP], + 'debugger/wasm-source': [SKIP], + 'debugger/wasm-stepping-with-skiplist': [SKIP], +}], # stress_js_bg_compile_wasm_code_gc + ] diff --git a/deps/v8/test/inspector/protocol-test.js b/deps/v8/test/inspector/protocol-test.js index 3b514ab538..5f115ae91f 100644 --- a/deps/v8/test/inspector/protocol-test.js +++ b/deps/v8/test/inspector/protocol-test.js @@ -129,6 +129,14 @@ InspectorTest.decodeBase64 = function(base64) { return bytes; } +InspectorTest.trimErrorMessage = function(message) { + if (!message.error || !message.error.data) + return message; + message.error.data = message.error.data.replace(/at position \d+/, + 'at <some position>'); + return message; +} + InspectorTest.ContextGroup = class { constructor() { this.id = utils.createContextGroup(); diff --git a/deps/v8/test/inspector/runtime/console-time-end-format-expected.txt b/deps/v8/test/inspector/runtime/console-time-end-format-expected.txt index d09dc41c79..dd4a6960b3 100644 --- a/deps/v8/test/inspector/runtime/console-time-end-format-expected.txt +++ b/deps/v8/test/inspector/runtime/console-time-end-format-expected.txt @@ -1,37 +1,37 @@ Checks format of console.timeEnd output Running test: zero -js: 0ms -timeEnd: 0ms +js: 0 ms +timeEnd: 0 ms Running test: verySmall -js: 1e-15ms -timeEnd: 1e-15ms +js: 1e-15 ms +timeEnd: 1e-15 ms Running test: small -js: 0.001ms -timeEnd: 0.001ms +js: 0.001 ms +timeEnd: 0.001 ms Running test: regular -js: 1.2345ms -timeEnd: 1.2345ms +js: 1.2345 ms +timeEnd: 1.2345 ms Running test: big -js: 10000.2345ms -timeEnd: 10000.2345ms +js: 10000.2345 ms +timeEnd: 10000.2345 ms Running test: veryBig -js: 1000000000000000.2ms -timeEnd: 1000000000000000.2ms +js: 1000000000000000.2 ms +timeEnd: 1000000000000000.2 ms Running test: huge -js: 1e+42ms -timeEnd: 1e+42ms +js: 1e+42 ms +timeEnd: 1e+42 ms Running test: undefinedAsLabel -js: 1ms -default: 1ms +js: 1 ms +default: 1 ms Running test: emptyAsLabel -js: 1ms -default: 1ms +js: 1 ms +default: 1 ms diff --git a/deps/v8/test/inspector/runtime/console-time-end-format.js b/deps/v8/test/inspector/runtime/console-time-end-format.js index 4b28f67e8e..c7d779fecf 100644 --- a/deps/v8/test/inspector/runtime/console-time-end-format.js +++ b/deps/v8/test/inspector/runtime/console-time-end-format.js @@ -43,7 +43,7 @@ async function checkInterval(time, label) { label = label === undefined ? '\'timeEnd\'' : label; utils.setCurrentTimeMSForTest(0.0); Protocol.Runtime.evaluate({ - expression: `console.log('js: ' + ${time} + 'ms')` + expression: `console.log('js: ' + ${time} + ' ms')` }); await Protocol.Runtime.evaluate({expression: `console.time(${label})`}); utils.setCurrentTimeMSForTest(time); diff --git a/deps/v8/test/inspector/runtime/console-time-log-expected.txt b/deps/v8/test/inspector/runtime/console-time-log-expected.txt index 4cf9e408a3..72d00552c1 100644 --- a/deps/v8/test/inspector/runtime/console-time-log-expected.txt +++ b/deps/v8/test/inspector/runtime/console-time-log-expected.txt @@ -2,7 +2,7 @@ Test for console.timeLog [ [0] : { type : string - value : 42: 1ms + value : 42: 1 ms } [1] : { type : string @@ -12,7 +12,7 @@ Test for console.timeLog [ [0] : { type : string - value : 42: 2ms + value : 42: 2 ms } [1] : { type : string @@ -26,7 +26,7 @@ Test for console.timeLog [ [0] : { type : string - value : 42: 3ms + value : 42: 3 ms } ] [ diff --git a/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt b/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt index b675532adb..600423e361 100644 --- a/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt +++ b/deps/v8/test/inspector/runtime/console-time-repeat-expected.txt @@ -13,10 +13,10 @@ Checks that repeated console.time do not reset callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -30,7 +30,7 @@ Checks that repeated console.time do not reset args : [ [0] : { type : string - value : a: 2ms + value : a: 2 ms } ] executionContextId : <executionContextId> @@ -38,10 +38,10 @@ Checks that repeated console.time do not reset callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -63,10 +63,10 @@ Checks that repeated console.time do not reset callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } diff --git a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js index 9f715937c6..2456e957fa 100644 --- a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js +++ b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --no-stress-incremental-marking + let {session, contextGroup, Protocol} = InspectorTest.start('Tests that contextDesrtoyed nofitication is fired when context is collected.'); diff --git a/deps/v8/test/inspector/runtime/es6-module-expected.txt b/deps/v8/test/inspector/runtime/es6-module-expected.txt index 63d6696cf8..2be82c8b90 100644 --- a/deps/v8/test/inspector/runtime/es6-module-expected.txt +++ b/deps/v8/test/inspector/runtime/es6-module-expected.txt @@ -2,6 +2,7 @@ Checks basic ES6 modules support. { method : Debugger.scriptParsed params : { + embedderName : module1 endColumn : 17 endLine : 5 executionContextId : <executionContextId> @@ -21,6 +22,7 @@ Checks basic ES6 modules support. { method : Debugger.scriptParsed params : { + embedderName : module2 endColumn : 17 endLine : 5 executionContextId : <executionContextId> @@ -40,6 +42,7 @@ Checks basic ES6 modules support. { method : Debugger.scriptParsed params : { + embedderName : module3 endColumn : 0 endLine : 11 executionContextId : <executionContextId> @@ -201,6 +204,7 @@ console.log(239) { method : Debugger.scriptFailedToParse params : { + embedderName : module4 endColumn : 1 endLine : 0 executionContextId : <executionContextId> diff --git a/deps/v8/test/inspector/runtime/evaluate-async.js b/deps/v8/test/inspector/runtime/evaluate-async.js index 385b3f6fb4..8cade00fdf 100644 --- a/deps/v8/test/inspector/runtime/evaluate-async.js +++ b/deps/v8/test/inspector/runtime/evaluate-async.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --no-stress-incremental-marking + let {session, contextGroup, Protocol} = InspectorTest.start("Tests that Runtime.evaluate works with awaitPromise flag."); contextGroup.addScript(` diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt index a605c4d791..51537d3ecb 100644 --- a/deps/v8/test/inspector/runtime/get-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt @@ -102,6 +102,7 @@ Running test: testArrayBuffer 0 own number 16843009 1 own number 16843009 __proto__ own object undefined +[[IsDetached]] false Running test: testDetachedArrayBuffer [[Int8Array]] @@ -112,8 +113,11 @@ Running test: testDetachedArrayBuffer __proto__ own object undefined [[Int32Array]] __proto__ own object undefined +[[IsDetached]] true Running test: testArrayBufferWithBrokenUintCtor [[Int8Array]] own object undefined [[Uint8Array]] own object undefined __proto__ own object undefined +Internal properties + [[IsDetached]] boolean false diff --git a/deps/v8/test/inspector/runtime/get-properties.js b/deps/v8/test/inspector/runtime/get-properties.js index 6cb3e39909..ad0e2f91e4 100644 --- a/deps/v8/test/inspector/runtime/get-properties.js +++ b/deps/v8/test/inspector/runtime/get-properties.js @@ -50,6 +50,9 @@ InspectorTest.runAsyncTestSuite([ InspectorTest.log(prop.name); await logGetPropertiesResult(prop.value.objectId); } + for (let prop of props.result.internalProperties) { + InspectorTest.log(prop.name + ' ' + prop.value.value); + } }, async function testDetachedArrayBuffer() { @@ -65,6 +68,9 @@ InspectorTest.runAsyncTestSuite([ InspectorTest.log(prop.name); await logGetPropertiesResult(prop.value.objectId); } + for (let prop of props.result.internalProperties) { + InspectorTest.log(prop.name + ' ' + prop.value.value); + } }, async function testArrayBufferWithBrokenUintCtor() { diff --git a/deps/v8/test/inspector/runtime/internal-properties-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-expected.txt index 29694d2009..fc4de5bca3 100644 --- a/deps/v8/test/inspector/runtime/internal-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/internal-properties-expected.txt @@ -160,14 +160,14 @@ expression: Promise.resolve(42) result : { internalProperties : [ [0] : { - name : [[PromiseStatus]] + name : [[PromiseState]] value : { type : string value : fulfilled } } [1] : { - name : [[PromiseValue]] + name : [[PromiseResult]] value : { description : 42 type : number @@ -183,14 +183,14 @@ expression: new Promise(() => undefined) result : { internalProperties : [ [0] : { - name : [[PromiseStatus]] + name : [[PromiseState]] value : { type : string value : pending } } [1] : { - name : [[PromiseValue]] + name : [[PromiseResult]] value : { type : undefined } @@ -219,7 +219,7 @@ expression: gen1 } } [1] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] value : { type : string value : suspended @@ -275,7 +275,7 @@ expression: gen1.next();gen1 } } [1] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] value : { type : string value : suspended @@ -331,7 +331,7 @@ expression: gen1.next();gen1 } } [1] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] value : { type : string value : closed @@ -379,7 +379,7 @@ expression: gen2 } } [1] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] value : { type : string value : suspended @@ -435,7 +435,7 @@ expression: gen2.next();gen2 } } [1] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] value : { type : string value : suspended @@ -491,7 +491,7 @@ expression: gen2.next();gen2 } } [1] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] value : { type : string value : closed diff --git a/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt b/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt index da9eccc694..7f66bbca67 100644 --- a/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt +++ b/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt @@ -16,10 +16,10 @@ Running test: consoleLogWithDefaultLocale callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -36,7 +36,7 @@ set locale to fr_CA.UTF-8 (has comma as separator) args : [ [0] : { type : string - value : a: 0.001ms + value : a: 0.001 ms } ] executionContextId : <executionContextId> @@ -44,10 +44,10 @@ set locale to fr_CA.UTF-8 (has comma as separator) callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -73,10 +73,10 @@ set locale to fr_CA.UTF-8 (has comma as separator) callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -102,10 +102,10 @@ set locale to fr_CA.UTF-8 (has comma as separator) callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } @@ -119,7 +119,7 @@ set locale to fr_CA.UTF-8 (has comma as separator) args : [ [0] : { type : string - value : a: 0.001ms + value : a: 0.001 ms } ] executionContextId : <executionContextId> @@ -127,10 +127,10 @@ set locale to fr_CA.UTF-8 (has comma as separator) callFrames : [ [0] : { columnNumber : 8 - functionName : + functionName : lineNumber : 0 scriptId : <scriptId> - url : + url : } ] } diff --git a/deps/v8/test/inspector/runtime/regress-1075763-expected.txt b/deps/v8/test/inspector/runtime/regress-1075763-expected.txt index 30d5a1bbef..0cc0ce2133 100644 --- a/deps/v8/test/inspector/runtime/regress-1075763-expected.txt +++ b/deps/v8/test/inspector/runtime/regress-1075763-expected.txt @@ -11,7 +11,7 @@ Tests Runtime.evaluate returns object with undefined property. overflow : false properties : [ [0] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] type : string value : suspended } diff --git a/deps/v8/test/inspector/runtime/release-object-expected.txt b/deps/v8/test/inspector/runtime/release-object-expected.txt index 4c479c7558..2a9697f5d4 100644 --- a/deps/v8/test/inspector/runtime/release-object-expected.txt +++ b/deps/v8/test/inspector/runtime/release-object-expected.txt @@ -71,7 +71,7 @@ ReleaseObject with invalid params. { error : { code : -32602 - data : objectId: string value expected + data : Failed to deserialize params.objectId - BINDINGS: mandatory field missing at <some position> message : Invalid parameters } id : <messageId> @@ -150,8 +150,8 @@ ReleaseObjectGroup with invalid params { error : { code : -32602 - data : objectGroup: string value expected + data : Failed to deserialize params.objectGroup - BINDINGS: mandatory field missing at <some position> message : Invalid parameters } id : <messageId> -}
\ No newline at end of file +} diff --git a/deps/v8/test/inspector/runtime/release-object.js b/deps/v8/test/inspector/runtime/release-object.js index ae388ff9c4..9cae573277 100644 --- a/deps/v8/test/inspector/runtime/release-object.js +++ b/deps/v8/test/inspector/runtime/release-object.js @@ -31,7 +31,7 @@ const {Protocol} = InspectorTest.start( async function testReleaseObjectInvalid() { const releaseObjectResult = await Protocol.Runtime.releaseObject({}); InspectorTest.log('ReleaseObject with invalid params.'); - InspectorTest.logMessage(releaseObjectResult); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(releaseObjectResult)); }, async function testObjectGroups() { await logAndEvaluate('var a = {x:3};'); @@ -58,7 +58,7 @@ const {Protocol} = InspectorTest.start( async function testReleaseObjectGroupInvalid() { const releaseObjectGroupResult = await Protocol.Runtime.releaseObjectGroup({}); InspectorTest.log('ReleaseObjectGroup with invalid params'); - InspectorTest.logMessage(releaseObjectGroupResult); + InspectorTest.logMessage(InspectorTest.trimErrorMessage(releaseObjectGroupResult)); } ]); diff --git a/deps/v8/test/inspector/runtime/remote-object-expected.txt b/deps/v8/test/inspector/runtime/remote-object-expected.txt index 4763dd18c7..f4d98a9cca 100644 --- a/deps/v8/test/inspector/runtime/remote-object-expected.txt +++ b/deps/v8/test/inspector/runtime/remote-object-expected.txt @@ -1274,7 +1274,7 @@ Running test: testGenerator overflow : false properties : [ [0] : { - name : [[GeneratorStatus]] + name : [[GeneratorState]] type : string value : suspended } @@ -1565,12 +1565,12 @@ Running test: testPromise overflow : false properties : [ [0] : { - name : [[PromiseStatus]] + name : [[PromiseState]] type : string value : fulfilled } [1] : { - name : [[PromiseValue]] + name : [[PromiseResult]] type : string value : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaā¦aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa } @@ -1593,12 +1593,12 @@ Running test: testPromise overflow : false properties : [ [0] : { - name : [[PromiseStatus]] + name : [[PromiseState]] type : string value : rejected } [1] : { - name : [[PromiseValue]] + name : [[PromiseResult]] type : number value : 42 } @@ -1621,12 +1621,12 @@ Running test: testPromise overflow : false properties : [ [0] : { - name : [[PromiseStatus]] + name : [[PromiseState]] type : string value : pending } [1] : { - name : [[PromiseValue]] + name : [[PromiseResult]] type : undefined value : undefined } diff --git a/deps/v8/test/inspector/task-runner.cc b/deps/v8/test/inspector/task-runner.cc index 1476b0f64c..7237aad4e0 100644 --- a/deps/v8/test/inspector/task-runner.cc +++ b/deps/v8/test/inspector/task-runner.cc @@ -4,6 +4,9 @@ #include "test/inspector/task-runner.h" +#include "include/libplatform/libplatform.h" +#include "src/flags/flags.h" + #if !defined(_WIN32) && !defined(_WIN64) #include <unistd.h> // NOLINT #endif // !defined(_WIN32) && !defined(_WIN64) @@ -75,6 +78,15 @@ void TaskRunner::RunMessageLoop(bool only_protocol) { task->Run(data_.get()); delete task; } + // Also pump isolate's foreground task queue to ensure progress. + // This can be removed once https://crbug.com/v8/10747 is fixed. + // TODO(10748): Enable --stress-incremental-marking after the existing + // tests are fixed. + if (!i::FLAG_stress_incremental_marking) { + while (v8::platform::PumpMessageLoop( + v8::internal::V8::GetCurrentPlatform(), isolate())) { + } + } } } diff --git a/deps/v8/test/inspector/testcfg.py b/deps/v8/test/inspector/testcfg.py index 512bf54eb6..51a3866c52 100644 --- a/deps/v8/test/inspector/testcfg.py +++ b/deps/v8/test/inspector/testcfg.py @@ -10,13 +10,14 @@ from testrunner.objects import testcase from testrunner.outproc import base as outproc PROTOCOL_TEST_JS = "protocol-test.js" +WASM_INSPECTOR_JS = "wasm-inspector-test.js" EXPECTED_SUFFIX = "-expected.txt" RESOURCES_FOLDER = "resources" class TestLoader(testsuite.JSTestLoader): @property def excluded_files(self): - return {PROTOCOL_TEST_JS} + return {PROTOCOL_TEST_JS, WASM_INSPECTOR_JS} @property def excluded_dirs(self): @@ -56,6 +57,8 @@ class TestCase(testcase.TestCase): return [ os.path.join( 'test', 'inspector', 'debugger', 'resources', 'break-locations.js'), + os.path.join( + 'test', 'inspector', 'wasm-inspector-test.js'), ] @property diff --git a/deps/v8/test/inspector/wasm-inspector-test.js b/deps/v8/test/inspector/wasm-inspector-test.js new file mode 100644 index 0000000000..3e9b18907a --- /dev/null +++ b/deps/v8/test/inspector/wasm-inspector-test.js @@ -0,0 +1,120 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +utils.load('test/mjsunit/wasm/wasm-module-builder.js'); + +WasmInspectorTest = {} + +WasmInspectorTest.evalWithUrl = (code, url) => + Protocol.Runtime + .evaluate({'expression': code + '\n//# sourceURL=v8://test/' + url}) + .then(printIfFailure); + +WasmInspectorTest.instantiateFromBuffer = function(bytes) { + var buffer = new ArrayBuffer(bytes.length); + var view = new Uint8Array(buffer); + for (var i = 0; i < bytes.length; ++i) { + view[i] = bytes[i] | 0; + } + const module = new WebAssembly.Module(buffer); + return new WebAssembly.Instance(module); +} + +WasmInspectorTest.instantiate = async function(bytes, instance_name = 'instance') { + const instantiate_code = `var ${instance_name} = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(bytes)});`; + await WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate'); +} + +WasmInspectorTest.dumpScopeProperties = async function(message) { + printIfFailure(message); + for (var value of message.result.result) { + var value_str = await getScopeValues(value.name, value.value); + InspectorTest.log(' ' + value.name + ': ' + value_str); + } +} + +WasmInspectorTest.getWasmValue = function(wasmValue) { + return typeof (wasmValue.value) === 'undefined' ? + wasmValue.unserializableValue : + wasmValue.value; +} + +function printIfFailure(message) { + if (!message.result) { + InspectorTest.logMessage(message); + } + return message; +} + +async function getScopeValues(name, value) { + if (value.type == 'object') { + if (value.subtype == 'typedarray') return value.description; + if (name == 'instance') return dumpInstanceProperties(value); + if (name == 'function tables') return dumpTables(value); + + let msg = await Protocol.Runtime.getProperties({objectId: value.objectId}); + printIfFailure(msg); + const printProperty = function(elem) { + const wasmValue = WasmInspectorTest.getWasmValue(elem.value); + return `"${elem.name}": ${wasmValue} (${elem.value.subtype})`; + } + return msg.result.result.map(printProperty).join(', '); + } + return WasmInspectorTest.getWasmValue(value) + ' (' + value.subtype + ')'; +} + +function recursiveGetPropertiesWrapper(value, depth) { + return recursiveGetProperties({result: {result: [value]}}, depth); +} + +async function recursiveGetProperties(value, depth) { + if (depth > 0) { + const properties = await Promise.all(value.result.result.map( + x => {return Protocol.Runtime.getProperties({objectId: x.value.objectId});})); + const recursiveProperties = await Promise.all(properties.map( + x => {return recursiveGetProperties(x, depth - 1);})); + return recursiveProperties.flat(); + } + return value; +} + +async function dumpTables(tablesObj) { + let msg = await Protocol.Runtime.getProperties({objectId: tablesObj.objectId}); + var tables_str = []; + for (var table of msg.result.result) { + const func_entries = await recursiveGetPropertiesWrapper(table, 2); + var functions = []; + for (var func of func_entries) { + for (var value of func.result.result) { + functions.push(`${value.name}: ${value.value.description}`); + } + } + const functions_str = functions.join(', '); + tables_str.push(` ${table.name}: ${functions_str}`); + } + return '\n' + tables_str.join('\n'); +} + +async function dumpInstanceProperties(instanceObj) { + function invokeGetter(property) { + return this[JSON.parse(property)]; + } + + const exportsName = 'exports'; + let exportsObj = await Protocol.Runtime.callFunctionOn( + {objectId: instanceObj.objectId, + functionDeclaration: invokeGetter.toString(), + arguments: [{value: JSON.stringify(exportsName)}] + }); + printIfFailure(exportsObj); + let exports = await Protocol.Runtime.getProperties( + {objectId: exportsObj.result.result.objectId}); + printIfFailure(exports); + + const printExports = function(value) { + return `"${value.name}" (${value.value.className})`; + } + const formattedExports = exports.result.result.map(printExports).join(', '); + return `${exportsName}: ${formattedExports}` +} |