Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: test/inspector/debugger/wasm-scripts.js

Issue 2531163010: [inspector] Introduce debug::WasmScript (Closed)
Patch Set: Fix expected output Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/wasm-translation.cc ('k') | test/inspector/debugger/wasm-scripts-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-wasm
6
7 load('test/mjsunit/wasm/wasm-constants.js');
8 load('test/mjsunit/wasm/wasm-module-builder.js');
9
10 // Add two empty functions. Both should be registered as individual scripts at
11 // module creation time.
12 var builder = new WasmModuleBuilder();
13 builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]);
14 builder.addFunction('main', kSig_v_v)
15 .addBody([kExprBlock, kAstStmt, kExprI32Const, 2, kExprDrop, kExprEnd])
16 .exportAs('main');
17 var module_bytes = builder.toArray();
18
19 function testFunction(bytes) {
20 var buffer = new ArrayBuffer(bytes.length);
21 var view = new Uint8Array(buffer);
22 for (var i = 0; i < bytes.length; i++) {
23 view[i] = bytes[i] | 0;
24 }
25
26 // Compilation triggers registration of wasm scripts.
27 new WebAssembly.Module(buffer);
28 }
29
30 InspectorTest.addScriptWithUrl(
31 testFunction.toString(), 'v8://test/testFunction');
32 InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes));
33
34 Protocol.Debugger.enable();
35 Protocol.Debugger.onScriptParsed(handleScriptParsed);
36 InspectorTest.log(
37 'Check that inspector gets two wasm scripts at module creation time.');
38 Protocol.Runtime
39 .evaluate({
40 'expression': '//# sourceURL=v8://test/runTestRunction\n' +
41 'testFunction(module_bytes)'
42 })
43 .then(checkFinished);
44
45 var num_scripts = 0;
46 var missing_sources = 0;
47
48 function checkFinished() {
49 if (missing_sources == 0)
50 InspectorTest.completeTest();
51 }
52
53 function handleScriptParsed(messageObject)
54 {
55 var url = messageObject.params.url;
56 InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url);
57 ++num_scripts;
58
59 if (url.startsWith("wasm://")) {
60 ++missing_sources;
61 function dumpScriptSource(message) {
62 InspectorTest.log("Source for " + url + ":");
63 InspectorTest.log(message.result.scriptSource);
64 --missing_sources;
65 }
66
67 Protocol.Debugger.getScriptSource({scriptId: messageObject.params.scriptId})
68 .then(dumpScriptSource.bind(null))
69 .then(checkFinished);
70 }
71 }
OLDNEW
« no previous file with comments | « src/inspector/wasm-translation.cc ('k') | test/inspector/debugger/wasm-scripts-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698