Reviewers: Sven Panne,

Description:
IsNearDeath needs to include pending nodes

[email protected]
BUG=

Please review this at https://codereview.chromium.org/21466003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M include/v8.h
  M src/global-handles.cc


Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 11fccdf023999ff3c3a8acf425c669be29cae54c..a4a665dccbc7cb317d125441ede9b5e977d4ad4d 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5447,6 +5447,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;
@@ -5662,8 +5663,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;
 }


Index: src/global-handles.cc
diff --git a/src/global-handles.cc b/src/global-handles.cc
index 88ebe31647dc954fa21f0f5deca99dbf2ccc819b..41771e6db4148a7e8189807dc9bab7dc135bc7d5 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to