IsNearDeath needs to include pending nodes

R=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/21466003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16037 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
dcarney@chromium.org 2013-08-05 06:58:48 +00:00
parent d5b9616991
commit eb52c66fd0
2 changed files with 6 additions and 2 deletions

View File

@ -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 <class T>
bool Persistent<T>::IsNearDeath() const {
typedef internal::Internals I;
if (this->IsEmpty()) return false;
return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
I::kNodeStateIsNearDeathValue;
uint8_t node_state =
I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_));
return node_state == I::kNodeStateIsNearDeathValue ||
node_state == I::kNodeStateIsPendingValue;
}

View File

@ -71,6 +71,7 @@ class GlobalHandles::Node {
STATIC_ASSERT(static_cast<int>(NodeState::kMask) ==
Internals::kNodeStateMask);
STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue);
STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue);
STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue);
STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) ==
Internals::kNodeIsIndependentShift);