deps: V8: cherry-pick f4b860d
Original commit message:
[heap,api] Remove deprecated APIs
Bug: chromium:923361, v8:8834
Change-Id: I6ec42aeb74bea5c0629fcdc3f95c125f5de534a0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1526195
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60289}
Refs: f4b860d9b8
PR-URL: https://github.com/nodejs/node/pull/27013
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
98b5ba840e
commit
2ea9de2e85
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
# Reset this number to 0 on major V8 upgrades.
|
# Reset this number to 0 on major V8 upgrades.
|
||||||
# Increment by one for each non-official patch applied to deps/v8.
|
# Increment by one for each non-official patch applied to deps/v8.
|
||||||
'v8_embedder_string': '-node.13',
|
'v8_embedder_string': '-node.14',
|
||||||
|
|
||||||
##### V8 defaults for Node.js #####
|
##### V8 defaults for Node.js #####
|
||||||
|
|
||||||
|
1
deps/v8/include/v8-internal.h
vendored
1
deps/v8/include/v8-internal.h
vendored
@ -164,7 +164,6 @@ class Internals {
|
|||||||
static const int kNodeStateMask = 0x7;
|
static const int kNodeStateMask = 0x7;
|
||||||
static const int kNodeStateIsWeakValue = 2;
|
static const int kNodeStateIsWeakValue = 2;
|
||||||
static const int kNodeStateIsPendingValue = 3;
|
static const int kNodeStateIsPendingValue = 3;
|
||||||
static const int kNodeStateIsNearDeathValue = 4;
|
|
||||||
static const int kNodeIsIndependentShift = 3;
|
static const int kNodeIsIndependentShift = 3;
|
||||||
static const int kNodeIsActiveShift = 4;
|
static const int kNodeIsActiveShift = 4;
|
||||||
|
|
||||||
|
26
deps/v8/include/v8.h
vendored
26
deps/v8/include/v8.h
vendored
@ -576,10 +576,6 @@ template <class T> class PersistentBase {
|
|||||||
|
|
||||||
V8_DEPRECATED("See MarkIndependent.", V8_INLINE bool IsIndependent() const);
|
V8_DEPRECATED("See MarkIndependent.", V8_INLINE bool IsIndependent() const);
|
||||||
|
|
||||||
/** Checks if the handle holds the only reference to an object. */
|
|
||||||
V8_DEPRECATED("Garbage collection internal state should not be relied on.",
|
|
||||||
V8_INLINE bool IsNearDeath() const);
|
|
||||||
|
|
||||||
/** Returns true if the handle's reference is weak. */
|
/** Returns true if the handle's reference is weak. */
|
||||||
V8_INLINE bool IsWeak() const;
|
V8_INLINE bool IsWeak() const;
|
||||||
|
|
||||||
@ -8519,17 +8515,6 @@ class V8_EXPORT Isolate {
|
|||||||
*/
|
*/
|
||||||
void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
|
void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterates through all the persistent handles in the current isolate's heap
|
|
||||||
* that have class_ids and are candidates to be marked as partially dependent
|
|
||||||
* handles. This will visit handles to young objects created since the last
|
|
||||||
* garbage collection but is free to visit an arbitrary superset of these
|
|
||||||
* objects.
|
|
||||||
*/
|
|
||||||
V8_DEPRECATED(
|
|
||||||
"Use VisitHandlesWithClassIds",
|
|
||||||
void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates through all the persistent handles in the current isolate's heap
|
* Iterates through all the persistent handles in the current isolate's heap
|
||||||
* that have class_ids and are weak to be marked as inactive if there is no
|
* that have class_ids and are weak to be marked as inactive if there is no
|
||||||
@ -9783,17 +9768,6 @@ bool PersistentBase<T>::IsIndependent() const {
|
|||||||
I::kNodeIsIndependentShift);
|
I::kNodeIsIndependentShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
bool PersistentBase<T>::IsNearDeath() const {
|
|
||||||
typedef internal::Internals I;
|
|
||||||
if (this->IsEmpty()) return false;
|
|
||||||
uint8_t node_state =
|
|
||||||
I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_));
|
|
||||||
return node_state == I::kNodeStateIsNearDeathValue ||
|
|
||||||
node_state == I::kNodeStateIsPendingValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool PersistentBase<T>::IsWeak() const {
|
bool PersistentBase<T>::IsWeak() const {
|
||||||
typedef internal::Internals I;
|
typedef internal::Internals I;
|
||||||
|
9
deps/v8/src/api.cc
vendored
9
deps/v8/src/api.cc
vendored
@ -8876,15 +8876,6 @@ void Isolate::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
|
|||||||
isolate->global_handles()->IterateAllRootsWithClassIds(visitor);
|
isolate->global_handles()->IterateAllRootsWithClassIds(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Isolate::VisitHandlesForPartialDependence(
|
|
||||||
PersistentHandleVisitor* visitor) {
|
|
||||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
|
||||||
i::DisallowHeapAllocation no_allocation;
|
|
||||||
isolate->global_handles()->IterateAllYoungRootsWithClassIds(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) {
|
void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) {
|
||||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||||
i::DisallowHeapAllocation no_allocation;
|
i::DisallowHeapAllocation no_allocation;
|
||||||
|
10
deps/v8/src/global-handles.cc
vendored
10
deps/v8/src/global-handles.cc
vendored
@ -379,7 +379,6 @@ class GlobalHandles::Node final : public NodeBase<GlobalHandles::Node> {
|
|||||||
Internals::kNodeStateMask);
|
Internals::kNodeStateMask);
|
||||||
STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue);
|
STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue);
|
||||||
STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue);
|
STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue);
|
||||||
STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue);
|
|
||||||
STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) ==
|
STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) ==
|
||||||
Internals::kNodeIsIndependentShift);
|
Internals::kNodeIsIndependentShift);
|
||||||
STATIC_ASSERT(static_cast<int>(IsActive::kShift) ==
|
STATIC_ASSERT(static_cast<int>(IsActive::kShift) ==
|
||||||
@ -427,11 +426,6 @@ class GlobalHandles::Node final : public NodeBase<GlobalHandles::Node> {
|
|||||||
flags_ = NodeWeaknessType::update(flags_, weakness_type);
|
flags_ = NodeWeaknessType::update(flags_, weakness_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsNearDeath() const {
|
|
||||||
// Check for PENDING to ensure correct answer when processing callbacks.
|
|
||||||
return state() == PENDING || state() == NEAR_DEATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsWeak() const { return state() == WEAK; }
|
bool IsWeak() const { return state() == WEAK; }
|
||||||
|
|
||||||
bool IsInUse() const { return state() != FREE; }
|
bool IsInUse() const { return state() != FREE; }
|
||||||
@ -819,10 +813,6 @@ void GlobalHandles::AnnotateStrongRetainer(Address* location,
|
|||||||
Node::FromLocation(location)->AnnotateStrongRetainer(label);
|
Node::FromLocation(location)->AnnotateStrongRetainer(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlobalHandles::IsNearDeath(Address* location) {
|
|
||||||
return Node::FromLocation(location)->IsNearDeath();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GlobalHandles::IsWeak(Address* location) {
|
bool GlobalHandles::IsWeak(Address* location) {
|
||||||
return Node::FromLocation(location)->IsWeak();
|
return Node::FromLocation(location)->IsWeak();
|
||||||
}
|
}
|
||||||
|
3
deps/v8/src/global-handles.h
vendored
3
deps/v8/src/global-handles.h
vendored
@ -73,9 +73,6 @@ class GlobalHandles final {
|
|||||||
// Clear the weakness of a global handle.
|
// Clear the weakness of a global handle.
|
||||||
static void* ClearWeakness(Address* location);
|
static void* ClearWeakness(Address* location);
|
||||||
|
|
||||||
// Tells whether global handle is near death.
|
|
||||||
static bool IsNearDeath(Address* location);
|
|
||||||
|
|
||||||
// Tells whether global handle is weak.
|
// Tells whether global handle is weak.
|
||||||
static bool IsWeak(Address* location);
|
static bool IsWeak(Address* location);
|
||||||
|
|
||||||
|
20
deps/v8/test/cctest/heap/test-heap.cc
vendored
20
deps/v8/test/cctest/heap/test-heap.cc
vendored
@ -531,14 +531,9 @@ TEST(WeakGlobalHandlesScavenge) {
|
|||||||
|
|
||||||
// Scavenge treats weak pointers as normal roots.
|
// Scavenge treats weak pointers as normal roots.
|
||||||
CcTest::CollectGarbage(NEW_SPACE);
|
CcTest::CollectGarbage(NEW_SPACE);
|
||||||
|
|
||||||
CHECK((*h1)->IsString());
|
CHECK((*h1)->IsString());
|
||||||
CHECK((*h2)->IsHeapNumber());
|
CHECK((*h2)->IsHeapNumber());
|
||||||
|
|
||||||
CHECK(!WeakPointerCleared);
|
CHECK(!WeakPointerCleared);
|
||||||
CHECK(!global_handles->IsNearDeath(h2.location()));
|
|
||||||
CHECK(!global_handles->IsNearDeath(h1.location()));
|
|
||||||
|
|
||||||
GlobalHandles::Destroy(h1.location());
|
GlobalHandles::Destroy(h1.location());
|
||||||
GlobalHandles::Destroy(h2.location());
|
GlobalHandles::Destroy(h2.location());
|
||||||
}
|
}
|
||||||
@ -576,11 +571,8 @@ TEST(WeakGlobalUnmodifiedApiHandlesScavenge) {
|
|||||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||||
|
|
||||||
CcTest::CollectGarbage(NEW_SPACE);
|
CcTest::CollectGarbage(NEW_SPACE);
|
||||||
|
|
||||||
CHECK((*h1)->IsHeapNumber());
|
CHECK((*h1)->IsHeapNumber());
|
||||||
CHECK(WeakPointerCleared);
|
CHECK(WeakPointerCleared);
|
||||||
CHECK(!global_handles->IsNearDeath(h1.location()));
|
|
||||||
|
|
||||||
GlobalHandles::Destroy(h1.location());
|
GlobalHandles::Destroy(h1.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,10 +609,7 @@ TEST(WeakGlobalApiHandleModifiedMapScavenge) {
|
|||||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||||
|
|
||||||
CcTest::CollectGarbage(NEW_SPACE);
|
CcTest::CollectGarbage(NEW_SPACE);
|
||||||
|
|
||||||
CHECK(!WeakPointerCleared);
|
CHECK(!WeakPointerCleared);
|
||||||
CHECK(!global_handles->IsNearDeath(h1.location()));
|
|
||||||
|
|
||||||
GlobalHandles::Destroy(h1.location());
|
GlobalHandles::Destroy(h1.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,10 +650,7 @@ TEST(WeakGlobalApiHandleWithElementsScavenge) {
|
|||||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||||
|
|
||||||
CcTest::CollectGarbage(NEW_SPACE);
|
CcTest::CollectGarbage(NEW_SPACE);
|
||||||
|
|
||||||
CHECK(!WeakPointerCleared);
|
CHECK(!WeakPointerCleared);
|
||||||
CHECK(!global_handles->IsNearDeath(h1.location()));
|
|
||||||
|
|
||||||
GlobalHandles::Destroy(h1.location());
|
GlobalHandles::Destroy(h1.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,17 +685,11 @@ TEST(WeakGlobalHandlesMark) {
|
|||||||
GlobalHandles::MakeWeak(
|
GlobalHandles::MakeWeak(
|
||||||
h2.location(), reinterpret_cast<void*>(&handle_and_id),
|
h2.location(), reinterpret_cast<void*>(&handle_and_id),
|
||||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||||
CHECK(!GlobalHandles::IsNearDeath(h1.location()));
|
|
||||||
CHECK(!GlobalHandles::IsNearDeath(h2.location()));
|
|
||||||
|
|
||||||
// Incremental marking potentially marked handles before they turned weak.
|
// Incremental marking potentially marked handles before they turned weak.
|
||||||
CcTest::CollectAllGarbage();
|
CcTest::CollectAllGarbage();
|
||||||
|
|
||||||
CHECK((*h1)->IsString());
|
CHECK((*h1)->IsString());
|
||||||
|
|
||||||
CHECK(WeakPointerCleared);
|
CHECK(WeakPointerCleared);
|
||||||
CHECK(!GlobalHandles::IsNearDeath(h1.location()));
|
|
||||||
|
|
||||||
GlobalHandles::Destroy(h1.location());
|
GlobalHandles::Destroy(h1.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
37
deps/v8/test/cctest/test-api.cc
vendored
37
deps/v8/test/cctest/test-api.cc
vendored
@ -20545,43 +20545,6 @@ TEST(WrapperClassId) {
|
|||||||
object.Reset();
|
object.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(PersistentHandleInNewSpaceVisitor) {
|
|
||||||
LocalContext context;
|
|
||||||
v8::Isolate* isolate = context->GetIsolate();
|
|
||||||
v8::HandleScope scope(isolate);
|
|
||||||
v8::Persistent<v8::Object> object1(isolate, v8::Object::New(isolate));
|
|
||||||
CHECK_EQ(0, object1.WrapperClassId());
|
|
||||||
object1.SetWrapperClassId(42);
|
|
||||||
CHECK_EQ(42, object1.WrapperClassId());
|
|
||||||
|
|
||||||
CcTest::CollectAllGarbage();
|
|
||||||
CcTest::CollectAllGarbage();
|
|
||||||
|
|
||||||
v8::Persistent<v8::Object> object2(isolate, v8::Object::New(isolate));
|
|
||||||
CHECK_EQ(0, object2.WrapperClassId());
|
|
||||||
object2.SetWrapperClassId(42);
|
|
||||||
CHECK_EQ(42, object2.WrapperClassId());
|
|
||||||
|
|
||||||
Visitor42 visitor(&object2);
|
|
||||||
#if __clang__
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated"
|
|
||||||
#endif
|
|
||||||
// VisitHandlesForPartialDependence is marked deprecated. This test will be
|
|
||||||
// removed with the API method.
|
|
||||||
isolate->VisitHandlesForPartialDependence(&visitor);
|
|
||||||
#if __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CHECK_EQ(1, visitor.counter_);
|
|
||||||
|
|
||||||
object1.Reset();
|
|
||||||
object2.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TEST(RegExp) {
|
TEST(RegExp) {
|
||||||
LocalContext context;
|
LocalContext context;
|
||||||
v8::HandleScope scope(context->GetIsolate());
|
v8::HandleScope scope(context->GetIsolate());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user