Reviewers: Michael Starzinger,

Description:
Fix braindead Handle::is_identical_to

[email protected]
BUG=

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

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

Affected files:
  M src/handles-inl.h


Index: src/handles-inl.h
diff --git a/src/handles-inl.h b/src/handles-inl.h
index 5a3e9ed2744ac9c0a0ef1c319648d23e174508f1..2747cbcc1d0f2ed25eafbb11a51e23c355dea150 100644
--- a/src/handles-inl.h
+++ b/src/handles-inl.h
@@ -55,6 +55,8 @@ template <typename T>
 inline bool Handle<T>::is_identical_to(const Handle<T> other) const {
   ASSERT(location_ == NULL ||
          reinterpret_cast<Address>(*location_) != kZapValue);
+  if (location_ == other.location_) return true;
+  if (location_ == NULL || other.location_ == NULL) return false;
   // Dereferencing deferred handles to check object equality is safe.
SLOW_ASSERT(IsDereferenceAllowed(true) && other.IsDereferenceAllowed(true));
   return *location_ == *other.location_;
@@ -73,14 +75,14 @@ template <typename T>
 inline T** Handle<T>::location() const {
   ASSERT(location_ == NULL ||
          reinterpret_cast<Address>(*location_) != kZapValue);
-  SLOW_ASSERT(IsDereferenceAllowed(false));
+  SLOW_ASSERT(location_ == NULL || IsDereferenceAllowed(false));
   return location_;
 }

 #ifdef DEBUG
 template <typename T>
 bool Handle<T>::IsDereferenceAllowed(bool allow_deferred) const {
-  if (location_ == NULL) return true;
+  ASSERT(location_ != NULL);
   Object* object = *BitCast<T**>(location_);
   if (object->IsSmi()) return true;
   HeapObject* heap_object = HeapObject::cast(object);


--
--
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