Commit 66170c92 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Fix braindead Handle::is_identical_to

R=mstarzinger@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14568 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6616081b
...@@ -53,8 +53,9 @@ Handle<T>::Handle(T* obj, Isolate* isolate) { ...@@ -53,8 +53,9 @@ Handle<T>::Handle(T* obj, Isolate* isolate) {
template <typename T> template <typename T>
inline bool Handle<T>::is_identical_to(const Handle<T> other) const { inline bool Handle<T>::is_identical_to(const Handle<T> other) const {
ASSERT(location_ == NULL || ASSERT(location_ == NULL || !(*location_)->IsFailure());
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. // Dereferencing deferred handles to check object equality is safe.
SLOW_ASSERT(IsDereferenceAllowed(true) && other.IsDereferenceAllowed(true)); SLOW_ASSERT(IsDereferenceAllowed(true) && other.IsDereferenceAllowed(true));
return *location_ == *other.location_; return *location_ == *other.location_;
...@@ -63,24 +64,22 @@ inline bool Handle<T>::is_identical_to(const Handle<T> other) const { ...@@ -63,24 +64,22 @@ inline bool Handle<T>::is_identical_to(const Handle<T> other) const {
template <typename T> template <typename T>
inline T* Handle<T>::operator*() const { inline T* Handle<T>::operator*() const {
ASSERT(location_ != NULL); ASSERT(location_ != NULL && !(*location_)->IsFailure());
ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue);
SLOW_ASSERT(IsDereferenceAllowed(false)); SLOW_ASSERT(IsDereferenceAllowed(false));
return *BitCast<T**>(location_); return *BitCast<T**>(location_);
} }
template <typename T> template <typename T>
inline T** Handle<T>::location() const { inline T** Handle<T>::location() const {
ASSERT(location_ == NULL || ASSERT(location_ == NULL || !(*location_)->IsFailure());
reinterpret_cast<Address>(*location_) != kZapValue); SLOW_ASSERT(location_ == NULL || IsDereferenceAllowed(false));
SLOW_ASSERT(IsDereferenceAllowed(false));
return location_; return location_;
} }
#ifdef DEBUG #ifdef DEBUG
template <typename T> template <typename T>
bool Handle<T>::IsDereferenceAllowed(bool allow_deferred) const { bool Handle<T>::IsDereferenceAllowed(bool allow_deferred) const {
if (location_ == NULL) return true; ASSERT(location_ != NULL);
Object* object = *BitCast<T**>(location_); Object* object = *BitCast<T**>(location_);
if (object->IsSmi()) return true; if (object->IsSmi()) return true;
HeapObject* heap_object = HeapObject::cast(object); HeapObject* heap_object = HeapObject::cast(object);
......
...@@ -67,7 +67,7 @@ TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, ...@@ -67,7 +67,7 @@ TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
isolate_(isolate), isolate_(isolate),
zone_(zone) { zone_(zone) {
BuildDictionary(code); BuildDictionary(code);
ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); ASSERT(dictionary_->IsDictionary());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment