[inspector][profiler] Print wasm positions (url, line, column)

We currently report "wasm " as the source URL on all wasm code, with no
position information. This will change in a follow-up CL. To make that
difference visible, extend a test to show the URL and position reported
for wasm code.

R=thibaudm@chromium.org

Bug: chromium:1125986
Change-Id: I09f1820d591f27c1ff3c2acb41f8e279ac08a9e7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2575071
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71680}
This commit is contained in:
Clemens Backes 2020-12-08 17:11:40 +01:00 committed by Commit Bot
parent 0c46f7ee8b
commit 32b3b70254
2 changed files with 12 additions and 4 deletions

View File

@ -5,21 +5,25 @@ Building wasm module with sentinel 1.
Running fib with increasing input until it shows up in the profile.
Found expected functions in profile.
Wasm script id is set.
Wasm position: wasm @-1:-1
testEnableProfilerLate
Compiling wasm.
Building wasm module with sentinel 2.
Running fib with increasing input until it shows up in the profile.
Found expected functions in profile.
Wasm script id is set.
Wasm position: wasm @-1:-1
testEnableProfilerAfterDebugger
Compiling wasm.
Building wasm module with sentinel 3.
Running fib with increasing input until it shows up in the profile.
Found expected functions in profile.
Wasm script id is set.
Wasm position: wasm @-1:-1
testEnableProfilerBeforeDebugger
Compiling wasm.
Building wasm module with sentinel 4.
Running fib with increasing input until it shows up in the profile.
Found expected functions in profile.
Wasm script id is set.
Wasm position: wasm @-1:-1

View File

@ -61,12 +61,12 @@ function checkError(message) {
let found_good_profile = false;
let found_wasm_script_id;
let wasm_position;
let finished_profiles = 0;
Protocol.Profiler.onConsoleProfileFinished(e => {
++finished_profiles;
let function_names =
e.params.profile.nodes.map(n => n.callFrame.functionName);
let script_ids = e.params.profile.nodes.map(n => n.callFrame.scriptId);
let nodes = e.params.profile.nodes;
let function_names = nodes.map(n => n.callFrame.functionName);
// Enable this line for debugging:
// InspectorTest.log(function_names.join(', '));
// Check for at least one full cycle of
@ -80,7 +80,10 @@ Protocol.Profiler.onConsoleProfileFinished(e => {
for (let i = 0; i <= function_names.length - expected.length; ++i) {
if (expected.every((val, idx) => val.includes(function_names[i + idx]))) {
found_good_profile = true;
found_wasm_script_id = script_ids[i] != 0;
let wasm_frame = nodes[i].callFrame;
found_wasm_script_id = wasm_frame.scriptId != 0;
wasm_position = `${wasm_frame.url}@${wasm_frame.lineNumber}:${
wasm_frame.columnNumber}`;
}
}
});
@ -106,6 +109,7 @@ async function runFibUntilProfileFound() {
InspectorTest.log('Found expected functions in profile.');
InspectorTest.log(
'Wasm script id is ' + (found_wasm_script_id ? 'set.' : 'NOT SET.'));
InspectorTest.log('Wasm position: ' + wasm_position);
}
async function compileWasm() {