Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.x] vm: backport vm-related fixes #51004

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a6524dd
deps: V8: cherry-pick c400af48b5ef
joyeecheung Dec 1, 2023
990caf3
deps: V8: cherry-pick 7f5daed62d47
joyeecheung Dec 1, 2023
8ade4aa
deps: V8: cherry-pick 9a98f96b6d68
joyeecheung Dec 1, 2023
80f54b7
deps: V8: cherry-pick 94e8282325a1
joyeecheung Dec 1, 2023
213e73b
deps: V8: cherry-pick 3dd9576ce336
joyeecheung Dec 1, 2023
0f33b00
deps: V8: cherry-pick 1fada6b36f8d
joyeecheung Dec 1, 2023
59cf71f
deps: V8: cherry-pick 705e374124ae
joyeecheung Dec 1, 2023
86d8b58
deps: V8: cherry-pick 71ff68830279
joyeecheung Dec 1, 2023
c8ed93a
lib: fix compileFunction throws range error for negative numbers
MrJithil Oct 6, 2023
f1251ef
src: cast v8::Object::GetInternalField() return value to v8::Value
joyeecheung Aug 2, 2023
af9edb4
deps: add v8::Object::SetInternalFieldForNodeCore()
joyeecheung Sep 26, 2023
9e8629c
src: set ModuleWrap internal fields only once
joyeecheung Sep 8, 2023
bb3462a
module: use symbol in WeakMap to manage host defined options
joyeecheung Jun 21, 2023
05778c4
module: fix leak of vm.SyntheticModule
joyeecheung Jun 21, 2023
0849599
module: fix the leak in SourceTextModule and ContextifySript
joyeecheung Jun 23, 2023
2feffae
test: add checkIfCollectable to test/common/gc.js
joyeecheung Sep 16, 2023
466c304
test: use checkIfCollectable in vm leak tests
joyeecheung Sep 16, 2023
fc003be
test: deflake test-vm-contextified-script-leak
joyeecheung Sep 23, 2023
d183187
vm: use default HDO when importModuleDynamically is not set
joyeecheung Oct 5, 2023
c8be386
vm: unify host-defined option generation in vm.compileFunction
joyeecheung Oct 5, 2023
222877e
vm: use internal versions of compileFunction and Script
joyeecheung Oct 11, 2023
a2b3f6e
vm: reject in importModuleDynamically without --experimental-vm-modules
joyeecheung Oct 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
joyeecheung committed Dec 1, 2023
commit 990caf332dfa4529c95dcff8ace137f359aa76d8
10 changes: 10 additions & 0 deletions deps/v8/src/runtime/runtime-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<JSWeakCollection> collection = args.at<JSWeakCollection>(0);

return Smi::FromInt(
EphemeronHashTable::cast(collection->table()).NumberOfElements());
}

} // namespace internal
} // namespace v8
1 change: 1 addition & 0 deletions deps/v8/src/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
14 changes: 8 additions & 6 deletions deps/v8/test/mjsunit/harmony/symbol-as-weakmap-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down