summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/harmony/weakrefs/reentrant-gc-from-cleanup.js
blob: 07e23f614f9bbdbd8192e7df973328ab532f1cdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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

let call_count = 0;
let reentrant_gc = function(holdings) {
  gc();
  call_count++;
}

let fg = new FinalizationRegistry(reentrant_gc);

(function() {
fg.register({}, 42);
})();

gc();

setTimeout(function() {
  assertEquals(1, call_count);
}, 0);