fafd7c5d22
It's been enabled everywhere since Chrome 88, and the related Chromium flag was removed in https://crrev.com/c/2886421. Bug: v8:6532 Change-Id: I987a5761f9453d4e7d77d16199e8f0b3a659c70a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3956131 Commit-Queue: Adam Klein <adamk@chromium.org> Reviewed-by: Clemens Backes <clemensb@chromium.org> Reviewed-by: Deepti Gandluri <gdeepti@chromium.org> Auto-Submit: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/main@{#83809}
40 lines
989 B
JavaScript
40 lines
989 B
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: --expose-gc
|
|
|
|
const kNumMessages = 1000;
|
|
|
|
function AllocMemory(pages = 1, max = pages) {
|
|
return new WebAssembly.Memory({initial : pages, maximum : max, shared : true});
|
|
}
|
|
|
|
(function RunTest() {
|
|
function workerCode() {
|
|
onmessage =
|
|
function(msg) {
|
|
if (msg.memory) postMessage({memory : msg.memory});
|
|
gc();
|
|
}
|
|
}
|
|
|
|
let worker = new Worker(workerCode, {type: 'function'});
|
|
|
|
let time = performance.now();
|
|
|
|
for (let i = 0; i < kNumMessages; i++) {
|
|
let now = performance.now();
|
|
print(`iteration ${i}, Δ = ${(now - time).toFixed(3)} ms`);
|
|
time = now;
|
|
|
|
let memory = AllocMemory();
|
|
worker.postMessage({memory : memory});
|
|
let msg = worker.getMessage();
|
|
if (msg.memory) {
|
|
assertInstanceof(msg.memory, WebAssembly.Memory);
|
|
}
|
|
gc();
|
|
}
|
|
})();
|