Commit 31b23fcb authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][inspector][test] Check for wasm script id

We currently do not report a script ID for wasm code, i.e. the script id
is 0. We cannot just print the script ID itself, as it is considered
unstable. Thus this CL only makes us print whether it is set or not.
In a follow-up CL where we fix setting script IDs for wasm code events
the output will change.

R=thibaudm@chromium.org

Bug: chromium:1125986
Change-Id: Ibc52829ea8a5a5c9506e36390eb4c608bcab4624
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2571120
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71616}
parent 49170e99
......@@ -4,8 +4,10 @@ Compiling wasm.
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 NOT SET.
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 NOT SET.
......@@ -60,26 +60,27 @@ function checkError(message) {
}
let found_good_profile = false;
let found_wasm_script_id;
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);
// Enable this line for debugging:
// InspectorTest.log(function_names.join(', '));
// Check for at least one full cycle of
// fib -> wasm-to-js -> imp -> js-to-wasm -> fib.
// There are two different kinds of js-to-wasm-wrappers, so there are two
// possible positive traces.
const expected_generic =
['fib', 'wasm-to-js:i:i', 'imp', 'GenericJSToWasmWrapper', 'fib'];
const expected_optimized =
['fib', 'wasm-to-js:i:i', 'imp', 'js-to-wasm:i:i', 'fib'];
for (let i = 0; i <= function_names.length - expected_generic.length; ++i) {
if (expected_generic.every((val, idx) => val == function_names[i + idx]) ||
expected_optimized.every(
(val, idx) => val == function_names[i + idx])) {
const expected = [
['fib'], ['wasm-to-js:i:i'], ['imp'],
['GenericJSToWasmWrapper', 'js-to-wasm:i:i'], ['fib']
];
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;
}
}
});
......@@ -103,6 +104,8 @@ async function runFibUntilProfileFound() {
}
}
InspectorTest.log('Found expected functions in profile.');
InspectorTest.log(
'Wasm script id is ' + (found_wasm_script_id ? 'set.' : 'NOT SET.'));
}
async function compileWasm() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment