Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b0e8889

Browse filesBrowse files
joyeecheungrichardlau
authored andcommitted
deps: V8: cherry-pick 1fada6b36f8d
Original commit message: [symbol-as-weakmap-key] Fix DCHECKs when clearing JS weakrefs Bug: chromium:1372500, v8:12947 Fixed: chromium:1372500 Change-Id: Id6330de5886e4ea72544b307c358e2190ea47d9c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3942586 Reviewed-by: Anton Bikineev <bikineev@chromium.org> Commit-Queue: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/main@{#83632} Refs: v8/v8@1fada6b PR-URL: #51004 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent d87a810 commit b0e8889
Copy full SHA for b0e8889

File tree

Expand file treeCollapse file tree

3 files changed

+18
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+18
-3
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.33',
39+
'v8_embedder_string': '-node.34',
4040

4141
##### V8 defaults for Node.js #####
4242

Collapse file

‎deps/v8/src/heap/mark-compact.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/mark-compact.cc
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,7 +3027,7 @@ void MarkCompactCollector::ClearJSWeakRefs() {
30273027
};
30283028
HeapObject target = HeapObject::cast(weak_cell.target());
30293029
if (!non_atomic_marking_state()->IsBlackOrGrey(target)) {
3030-
DCHECK(!target.IsUndefined());
3030+
DCHECK(target.CanBeHeldWeakly());
30313031
// The value of the WeakCell is dead.
30323032
JSFinalizationRegistry finalization_registry =
30333033
JSFinalizationRegistry::cast(weak_cell.finalization_registry());
@@ -3049,6 +3049,7 @@ void MarkCompactCollector::ClearJSWeakRefs() {
30493049

30503050
HeapObject unregister_token = weak_cell.unregister_token();
30513051
if (!non_atomic_marking_state()->IsBlackOrGrey(unregister_token)) {
3052+
DCHECK(unregister_token.CanBeHeldWeakly());
30523053
// The unregister token is dead. Remove any corresponding entries in the
30533054
// key map. Multiple WeakCell with the same token will have all their
30543055
// unregister_token field set to undefined when processing the first
@@ -3057,7 +3058,7 @@ void MarkCompactCollector::ClearJSWeakRefs() {
30573058
JSFinalizationRegistry finalization_registry =
30583059
JSFinalizationRegistry::cast(weak_cell.finalization_registry());
30593060
finalization_registry.RemoveUnregisterToken(
3060-
JSReceiver::cast(unregister_token), isolate(),
3061+
unregister_token, isolate(),
30613062
JSFinalizationRegistry::kKeepMatchedCellsInRegistry,
30623063
gc_notify_updated_slot);
30633064
} else {
Collapse file
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2022 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --harmony-symbol-as-weakmap-key --expose-gc
6+
7+
// Register an object in a FinalizationRegistry with a Symbol as the unregister
8+
// token.
9+
let fr = new FinalizationRegistry(function () {});
10+
(function register() {
11+
fr.register({}, "holdings", Symbol('unregisterToken'));
12+
})();
13+
// The unregister token should be dead, trigger its collection.
14+
gc();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.