From 55c8294e0545232d84d2042e242c4a7d510f0e3f Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Wed, 5 Jun 2013 15:35:14 +0000 Subject: [PATCH] Cosmetic change to the handle dereference check. R=jkummerow@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/16171017 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14956 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/handles-inl.h | 12 +++++++----- src/handles.h | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/handles-inl.h b/src/handles-inl.h index 9d38f38..4f4490b 100644 --- a/src/handles-inl.h +++ b/src/handles-inl.h @@ -57,7 +57,8 @@ inline bool Handle::is_identical_to(const Handle other) const { 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)); + SLOW_ASSERT(IsDereferenceAllowed(NO_DEFERRED_CHECK) && + other.IsDereferenceAllowed(NO_DEFERRED_CHECK)); return *location_ == *other.location_; } @@ -65,20 +66,21 @@ inline bool Handle::is_identical_to(const Handle other) const { template inline T* Handle::operator*() const { ASSERT(location_ != NULL && !(*location_)->IsFailure()); - SLOW_ASSERT(IsDereferenceAllowed(false)); + SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); return *BitCast(location_); } template inline T** Handle::location() const { ASSERT(location_ == NULL || !(*location_)->IsFailure()); - SLOW_ASSERT(location_ == NULL || IsDereferenceAllowed(false)); + SLOW_ASSERT(location_ == NULL || + IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); return location_; } #ifdef DEBUG template -bool Handle::IsDereferenceAllowed(bool explicitly_allow_deferred) const { +bool Handle::IsDereferenceAllowed(DereferenceCheckMode mode) const { ASSERT(location_ != NULL); Object* object = *BitCast(location_); if (object->IsSmi()) return true; @@ -91,7 +93,7 @@ bool Handle::IsDereferenceAllowed(bool explicitly_allow_deferred) const { return true; } if (!AllowHandleDereference::IsAllowed()) return false; - if (!explicitly_allow_deferred && + if (mode == INCLUDE_DEFERRED_CHECK && !AllowDeferredHandleDereference::IsAllowed()) { // Accessing maps and internalized strings is safe. if (heap_object->IsMap()) return true; diff --git a/src/handles.h b/src/handles.h index 573298a..e08a775 100644 --- a/src/handles.h +++ b/src/handles.h @@ -85,7 +85,9 @@ class Handle { inline Handle EscapeFrom(v8::HandleScope* scope); #ifdef DEBUG - bool IsDereferenceAllowed(bool explicitly_allow_deferred) const; + enum DereferenceCheckMode { INCLUDE_DEFERRED_CHECK, NO_DEFERRED_CHECK }; + + bool IsDereferenceAllowed(DereferenceCheckMode mode) const; #endif // DEBUG private: -- 2.7.4