deps: V8: cherry-pick 7f5daed62d47 · nodejs/node@d4a530e · GitHub
Skip to content

Commit d4a530e

Browse files
joyeecheungrichardlau
authored andcommitted
deps: V8: cherry-pick 7f5daed62d47
Original commit message: [symbol-as-weakmap-key] Add tests to check weak collection size ... after gc. This CL also adds a runtime test function GetWeakCollectionSize to get the weak collection size. Bug: v8:12947 Change-Id: I4aff39165a54b63b3d690bfea71c2a439da01d00 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905071 Reviewed-by: Marja Hölttä <marja@chromium.org> Commit-Queue: 王澳 <wangao.james@bytedance.com> Cr-Commit-Position: refs/heads/main@{#83464} Refs: v8/v8@7f5daed PR-URL: #51004 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 1ce901b commit d4a530e

4 files changed

Lines changed: 20 additions & 7 deletions

File tree

common.gypi

Lines changed: 1 addition & 1 deletion

deps/v8/src/runtime/runtime-test.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "src/logging/counters.h"
2828
#include "src/objects/heap-object-inl.h"
2929
#include "src/objects/js-array-inl.h"
30+
#include "src/objects/js-collection-inl.h"
3031
#include "src/objects/js-function-inl.h"
3132
#include "src/objects/js-regexp-inl.h"
3233
#include "src/objects/managed-inl.h"
@@ -1730,5 +1731,14 @@ RUNTIME_FUNCTION(Runtime_SharedGC) {
17301731
return ReadOnlyRoots(isolate).undefined_value();
17311732
}
17321733

1734+
RUNTIME_FUNCTION(Runtime_GetWeakCollectionSize) {
1735+
HandleScope scope(isolate);
1736+
DCHECK_EQ(1, args.length());
1737+
Handle<JSWeakCollection> collection = args.at<JSWeakCollection>(0);
1738+
1739+
return Smi::FromInt(
1740+
EphemeronHashTable::cast(collection->table()).NumberOfElements());
1741+
}
1742+
17331743
} // namespace internal
17341744
} // namespace v8

deps/v8/src/runtime/runtime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ namespace internal {
498498
F(GetInitializerFunction, 1, 1) \
499499
F(GetOptimizationStatus, 1, 1) \
500500
F(GetUndetectable, 0, 1) \
501+
F(GetWeakCollectionSize, 1, 1) \
501502
F(GlobalPrint, 1, 1) \
502503
F(HasDictionaryElements, 1, 1) \
503504
F(HasDoubleElements, 1, 1) \

deps/v8/test/mjsunit/harmony/symbol-as-weakmap-key.js

Lines changed: 8 additions & 6 deletions

0 commit comments

Comments
 (0)