Revert "[inspector] Check that wasm wrappers appear in profiles"

This reverts commit 78defee492.

Reason for revert: Timeout on TSan: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20TSAN/30410

Original change's description:
> [inspector] Check that wasm wrappers appear in profiles
> 
> This extends the existing wasm profiling test to also check that
> wasm-to-js and js-to-wasm wrappers appear in the profiles as expected.
> It thus serves as a regression test for the status quo.
> 
> R=​bmeurer@chromium.org
> 
> Bug: chromium:1054386
> Change-Id: I5d4d8e6a252c6eb266b910621fca43a6ff0837bd
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2066970
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66401}

TBR=clemensb@chromium.org,bmeurer@chromium.org

Change-Id: Iac4299d5a4dc74041fbceac98cd2c2b96b9425df
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1054386
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2069328
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66406}
This commit is contained in:
Clemens Backes 2020-02-24 13:19:22 +00:00 committed by Commit Bot
parent 37425fe968
commit 11d4a38948
2 changed files with 17 additions and 29 deletions

View File

@ -1,4 +1,4 @@
Test that console profiles contain wasm function names.
Compiling wasm.
Running fib with increasing input until it shows up in the profile.
Found expected functions in profile.
Found fib in profile.

View File

@ -7,10 +7,8 @@ let {session, contextGroup, Protocol} = InspectorTest.start(
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
// Add fibonacci function, calling back and forth between JS and Wasm to also
// check for the occurrence of the wrappers.
// Add fibonacci function.
var builder = new WasmModuleBuilder();
const imp_index = builder.addImport('q', 'f', kSig_i_i);
builder.addFunction('fib', kSig_i_i)
.addBody([
kExprLocalGet, 0,
@ -19,9 +17,9 @@ builder.addFunction('fib', kSig_i_i)
kExprI32LeS, // i < 2 ?
kExprBrIf, 0, // --> return i
kExprI32Const, 1, kExprI32Sub, // i - 1
kExprCallFunction, imp_index, // imp(i - 1)
kExprCallFunction, 0, // fib(i - 1)
kExprLocalGet, 0, kExprI32Const, 2, kExprI32Sub, // i - 2
kExprCallFunction, imp_index, // imp(i - 2)
kExprCallFunction, 0, // fib(i - 2)
kExprI32Add
])
.exportFunc();
@ -34,38 +32,28 @@ function compile(bytes) {
view[i] = bytes[i] | 0;
}
let module = new WebAssembly.Module(buffer);
let fib = undefined;
function imp(i) { return fib(i); }
let instance = new WebAssembly.Instance(module, {q: {f: imp}});
fib = instance.exports.fib;
let instance = new WebAssembly.Instance(module);
return instance;
}
function checkError(message) {
if (!message.error) return;
InspectorTest.log('Error: ');
InspectorTest.logMessage(message);
InspectorTest.completeTest();
function checkError(message)
{
if (message.error) {
InspectorTest.log("Error: ");
InspectorTest.logMessage(message);
InspectorTest.completeTest();
}
}
(async function test() {
Protocol.Profiler.enable();
checkError(await Protocol.Profiler.start());
let found_good_profile = false;
let found_fib_in_profile = false;
let finished_profiles = 0;
Protocol.Profiler.onConsoleProfileFinished(e => {
++finished_profiles;
let function_names =
e.params.profile.nodes.map(n => n.callFrame.functionName);
// InspectorTest.log(function_names.join(', '));
// Check for at least one full cycle of
// fib -> wasm-to-js -> imp -> js-to-wasm -> fib.
const expected = ['fib', 'wasm-to-js:i:i', 'imp', 'js-to-wasm:i:i', 'fib'];
for (let i = 0; i <= function_names.length - expected.length; ++i) {
if (expected.every((val, idx) => val == function_names[i + idx])) {
found_good_profile = true;
}
}
if (e.params.profile.nodes.some(n => n.callFrame.functionName === 'fib'))
found_fib_in_profile = true;
});
InspectorTest.log('Compiling wasm.');
checkError(await Protocol.Runtime.evaluate({
@ -74,7 +62,7 @@ function checkError(message) {
}));
InspectorTest.log(
'Running fib with increasing input until it shows up in the profile.');
for (let i = 1; !found_good_profile; ++i) {
for (let i = 1; !found_fib_in_profile; ++i) {
checkError(await Protocol.Runtime.evaluate(
{expression: 'console.profile(\'profile\');'}));
checkError(await Protocol.Runtime.evaluate(
@ -87,6 +75,6 @@ function checkError(message) {
finished_profiles + ')');
}
}
InspectorTest.log('Found expected functions in profile.');
InspectorTest.log('Found fib in profile.');
InspectorTest.completeTest();
})().catch(e => InspectorTest.log('caught: ' + e));