Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: src/handles-inl.h

Issue 14660008: Fix braindead Handle::is_identical_to (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also fix (and broaden) zap value assertions Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/type-info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles-inl.h
diff --git a/src/handles-inl.h b/src/handles-inl.h
index 5a3e9ed2744ac9c0a0ef1c319648d23e174508f1..4f5e9fe720e0b68710ee9e2e6dc23709513c6f89 100644
--- a/src/handles-inl.h
+++ b/src/handles-inl.h
@@ -53,8 +53,9 @@ Handle<T>::Handle(T* obj, Isolate* isolate) {
template <typename T>
inline bool Handle<T>::is_identical_to(const Handle<T> other) const {
- ASSERT(location_ == NULL ||
- reinterpret_cast<Address>(*location_) != kZapValue);
+ ASSERT(location_ == NULL || !(*location_)->IsFailure());
+ 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_;
@@ -63,24 +64,22 @@ inline bool Handle<T>::is_identical_to(const Handle<T> other) const {
template <typename T>
inline T* Handle<T>::operator*() const {
- ASSERT(location_ != NULL);
- ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue);
+ ASSERT(location_ != NULL && !(*location_)->IsFailure());
SLOW_ASSERT(IsDereferenceAllowed(false));
return *BitCast<T**>(location_);
}
template <typename T>
inline T** Handle<T>::location() const {
- ASSERT(location_ == NULL ||
- reinterpret_cast<Address>(*location_) != kZapValue);
- SLOW_ASSERT(IsDereferenceAllowed(false));
+ ASSERT(location_ == NULL || !(*location_)->IsFailure());
+ 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);
« no previous file with comments | « no previous file | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698