v8/test/mjsunit/harmony/weakrefs/finalizationregistry-independent-lifetime.js
Jakob Gruber b457c6845f Add --no-concurrent-inlining to finalizationregistry test
The test relies on deterministic GC behavior.

Bug: v8:11771
Change-Id: I4c04f683ca51e0849e11736c97a2f2342977cc36
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2902735
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74639}
2021-05-18 14:17:07 +00:00

26 lines
633 B
JavaScript

// Copyright 2020 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 --noincremental-marking --no-concurrent-inlining
let cleanup_called = false;
function cleanup(holdings) {
cleanup_called = true;
};
(function() {
let fg = new FinalizationRegistry(cleanup);
(function() {
let x = {};
fg.register(x, {});
x = null;
})();
// Schedule fg for cleanup.
gc();
})();
// Collect fg, which should result in cleanup not called.
gc();
setTimeout(function() { assertFalse(cleanup_called); }, 0);