81b3372efa
The test was explicitly tiering up or down a module, without respecting other isolates. Thus it was failing in multi-isolate mode. This CL removes two runtime functions which do not make sense in a multi-isolate setting (and were only used in this one test), and replaces them with runtime functions that mimic what enabling/disabling the debugger domain does: As long as there is at least one isolate which needs modules to be tiered down, we keep them tiered down. R=thibaudm@chromium.org Bug: v8:10359, v8:10099 Change-Id: Ia85f4ea29ba6a6bb54aca54a48fadd351121d3eb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2637231 Reviewed-by: Thibaud Michaud <thibaudm@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#72164}
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
load('test/mjsunit/wasm/wasm-module-builder.js');
|
|
|
|
const num_functions = 200;
|
|
|
|
function create_builder(delta = 0) {
|
|
const builder = new WasmModuleBuilder();
|
|
for (let i = 0; i < num_functions; ++i) {
|
|
builder.addFunction('f' + i, kSig_i_v)
|
|
.addBody(wasmI32Const(i + delta))
|
|
.exportFunc();
|
|
}
|
|
return builder;
|
|
}
|
|
|
|
function checkTieredDown(instance) {
|
|
for (let i = 0; i < num_functions; ++i) {
|
|
assertTrue(%IsLiftoffFunction(instance.exports['f' + i]));
|
|
}
|
|
}
|
|
|
|
function checkTieredUp(instance) {
|
|
// Busy waiting until all functions are tiered up.
|
|
let num_liftoff_functions;
|
|
while (true) {
|
|
num_liftoff_functions = 0;
|
|
for (let i = 0; i < num_functions; ++i) {
|
|
if (%IsLiftoffFunction(instance.exports['f' + i])) {
|
|
num_liftoff_functions++;
|
|
}
|
|
}
|
|
if (num_liftoff_functions == 0) return;
|
|
}
|
|
}
|
|
|
|
function check(instance) {
|
|
%WasmTierDown();
|
|
checkTieredDown(instance);
|
|
|
|
for (let i = 0; i < num_functions; ++i) {
|
|
%WasmTierUpFunction(instance, i);
|
|
}
|
|
checkTieredDown(instance);
|
|
|
|
%WasmTierUp();
|
|
checkTieredUp(instance);
|
|
}
|
|
|
|
(function testTierDownToLiftoff() {
|
|
print(arguments.callee.name);
|
|
const instance = create_builder().instantiate();
|
|
check(instance);
|
|
})();
|
|
|
|
// Use slightly different module for this test to avoid sharing native module.
|
|
async function testTierDownToLiftoffAsync() {
|
|
print(arguments.callee.name);
|
|
const instance = await create_builder(num_functions).asyncInstantiate();
|
|
check(instance);
|
|
}
|
|
|
|
assertPromiseResult(testTierDownToLiftoffAsync());
|