diff --git a/include/v8.h b/include/v8.h index 311ad434de..3eb4794f5c 100644 --- a/include/v8.h +++ b/include/v8.h @@ -5457,6 +5457,7 @@ class Internals { static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; static const int kNodeStateMask = 0xf; static const int kNodeStateIsWeakValue = 2; + static const int kNodeStateIsPendingValue = 3; static const int kNodeStateIsNearDeathValue = 4; static const int kNodeIsIndependentShift = 4; static const int kNodeIsPartiallyDependentShift = 5; @@ -5672,8 +5673,10 @@ template bool Persistent::IsNearDeath() const { typedef internal::Internals I; if (this->IsEmpty()) return false; - return I::GetNodeState(reinterpret_cast(this->val_)) == - I::kNodeStateIsNearDeathValue; + uint8_t node_state = + I::GetNodeState(reinterpret_cast(this->val_)); + return node_state == I::kNodeStateIsNearDeathValue || + node_state == I::kNodeStateIsPendingValue; } diff --git a/src/global-handles.cc b/src/global-handles.cc index 88ebe31647..41771e6db4 100644 --- a/src/global-handles.cc +++ b/src/global-handles.cc @@ -71,6 +71,7 @@ class GlobalHandles::Node { STATIC_ASSERT(static_cast(NodeState::kMask) == Internals::kNodeStateMask); STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue); + STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue); STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue); STATIC_ASSERT(static_cast(IsIndependent::kShift) == Internals::kNodeIsIndependentShift);