Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitd4a530e

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@7f5daedPR-URL:#51004Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent1ce901b commitd4a530e

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

‎common.gypi

Lines 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.29',
39+
'v8_embedder_string':'-node.30',
4040

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

‎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
returnReadOnlyRoots(isolate).undefined_value();
17311732
}
17321733

1734+
RUNTIME_FUNCTION(Runtime_GetWeakCollectionSize) {
1735+
HandleScopescope(isolate);
1736+
DCHECK_EQ(1, args.length());
1737+
Handle<JSWeakCollection> collection = args.at<JSWeakCollection>(0);
1738+
1739+
returnSmi::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
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// Flags: --harmony-symbol-as-weakmap-key --expose-gc
5+
// Flags: --harmony-symbol-as-weakmap-key --expose-gc --allow-natives-syntax --noincremental-marking
66

77
(functionTestWeakMapWithNonRegisteredSymbolKey(){
88
constkey=Symbol('123');
@@ -28,16 +28,17 @@
2828
constouterKey=Symbol('234');
2929
constouterValue=1;
3030
map.set(outerKey,outerValue);
31-
{
31+
(function(){
3232
constinnerKey=Symbol('123');
3333
constinnerValue=1;
3434
map.set(innerKey,innerValue);
3535
assertTrue(map.has(innerKey));
3636
assertSame(innerValue,map.get(innerKey));
37-
}
37+
})();
3838
gc();
3939
assertTrue(map.has(outerKey));
4040
assertSame(outerValue,map.get(outerKey));
41+
assertEquals(1,%GetWeakCollectionSize(map));
4142
})();
4243

4344
(functionTestWeakMapWithRegisteredSymbolKey(){
@@ -74,13 +75,14 @@
7475
constset=newWeakSet();
7576
constouterKey=Symbol('234');
7677
set.add(outerKey);
77-
{
78+
(function(){
7879
constinnerKey=Symbol('123');
7980
set.add(innerKey);
8081
assertTrue(set.has(innerKey));
81-
}
82-
gc();
82+
})();
8383
assertTrue(set.has(outerKey));
84+
gc();
85+
assertEquals(1,%GetWeakCollectionSize(set));
8486
})();
8587

8688
(functionTestWeakSetWithRegisteredSymbolKey(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp