diff --git a/common.gypi b/common.gypi index a58d48b0c5eb9a..7428367750fac2 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.29', + 'v8_embedder_string': '-node.30', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/runtime/runtime-test.cc b/deps/v8/src/runtime/runtime-test.cc index fcaada5711d487..7dcc05ab485408 100644 --- a/deps/v8/src/runtime/runtime-test.cc +++ b/deps/v8/src/runtime/runtime-test.cc @@ -27,6 +27,7 @@ #include "src/logging/counters.h" #include "src/objects/heap-object-inl.h" #include "src/objects/js-array-inl.h" +#include "src/objects/js-collection-inl.h" #include "src/objects/js-function-inl.h" #include "src/objects/js-regexp-inl.h" #include "src/objects/managed-inl.h" @@ -1730,5 +1731,14 @@ RUNTIME_FUNCTION(Runtime_SharedGC) { return ReadOnlyRoots(isolate).undefined_value(); } +RUNTIME_FUNCTION(Runtime_GetWeakCollectionSize) { + HandleScope scope(isolate); + DCHECK_EQ(1, args.length()); + Handle collection = args.at(0); + + return Smi::FromInt( + EphemeronHashTable::cast(collection->table()).NumberOfElements()); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/src/runtime/runtime.h b/deps/v8/src/runtime/runtime.h index 877b277a5e26cb..d0f81cf2f7672a 100644 --- a/deps/v8/src/runtime/runtime.h +++ b/deps/v8/src/runtime/runtime.h @@ -498,6 +498,7 @@ namespace internal { F(GetInitializerFunction, 1, 1) \ F(GetOptimizationStatus, 1, 1) \ F(GetUndetectable, 0, 1) \ + F(GetWeakCollectionSize, 1, 1) \ F(GlobalPrint, 1, 1) \ F(HasDictionaryElements, 1, 1) \ F(HasDoubleElements, 1, 1) \ diff --git a/deps/v8/test/mjsunit/harmony/symbol-as-weakmap-key.js b/deps/v8/test/mjsunit/harmony/symbol-as-weakmap-key.js index 0e97ea1accca58..f644fccb00022d 100644 --- a/deps/v8/test/mjsunit/harmony/symbol-as-weakmap-key.js +++ b/deps/v8/test/mjsunit/harmony/symbol-as-weakmap-key.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-symbol-as-weakmap-key --expose-gc +// Flags: --harmony-symbol-as-weakmap-key --expose-gc --allow-natives-syntax --noincremental-marking (function TestWeakMapWithNonRegisteredSymbolKey() { const key = Symbol('123'); @@ -28,16 +28,17 @@ const outerKey = Symbol('234'); const outerValue = 1; map.set(outerKey, outerValue); - { + (function () { const innerKey = Symbol('123'); const innerValue = 1; map.set(innerKey, innerValue); assertTrue(map.has(innerKey)); assertSame(innerValue, map.get(innerKey)); - } + })(); gc(); assertTrue(map.has(outerKey)); assertSame(outerValue, map.get(outerKey)); + assertEquals(1, %GetWeakCollectionSize(map)); })(); (function TestWeakMapWithRegisteredSymbolKey() { @@ -74,13 +75,14 @@ const set = new WeakSet(); const outerKey = Symbol('234'); set.add(outerKey); - { + (function () { const innerKey = Symbol('123'); set.add(innerKey); assertTrue(set.has(innerKey)); - } - gc(); + })(); assertTrue(set.has(outerKey)); + gc(); + assertEquals(1, %GetWeakCollectionSize(set)); })(); (function TestWeakSetWithRegisteredSymbolKey() {