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

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

Issue 2531163010: [inspector] Introduce debug::WasmScript (Closed)
Patch Set: Rebase 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('func0', kSig_v_v).addBody([]);
14 builder.addFunction('func1', kSig_v_v).addBody([]).exportAs('main');
15 var module_bytes = builder.toArray();
16
17 function testFunction(bytes) {
18 var buffer = new ArrayBuffer(bytes.length);
19 var view = new Uint8Array(buffer);
20 for (var i = 0; i < bytes.length; i++) {
21 view[i] = bytes[i] | 0;
22 }
23
24 // Compilation triggers registration of wasm scripts.
25 new WebAssembly.Module(buffer);
26 }
27
28 function addSourceUrl(code, url) {
29 return '//# sourceURL=' + url + '\n' + code;
30 }
31
32 InspectorTest.addScript(
33 addSourceUrl(testFunction.toString(), 'v8://test/testFunction'));
34 InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes));
35
36 Protocol.Debugger.enable();
37 Protocol.Debugger.onScriptParsed(handleScriptParsed);
38 InspectorTest.log(
39 'Check that inspector gets two wasm scripts at module creation time.');
40 Protocol.Runtime
41 .evaluate({
42 'expression': addSourceUrl(
43 'testFunction(module_bytes)', 'v8://test/runTestRunction')
44 })
45 .then(InspectorTest.completeTest());
46
47 var num_scripts = 0;
48 function handleScriptParsed(messageObject)
49 {
50 var url = messageObject.params.url;
51 InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url);
kozy 2016/12/02 18:13:50 Can we request script content here and dump it as
Clemens Hammacher 2016/12/06 13:18:20 Done.
52 ++num_scripts;
53 }
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