From: mstarzinger@chromium.org Date: Fri, 22 Mar 2013 13:40:13 +0000 (+0000) Subject: Put zapping of local handles behind the extra checks flag. X-Git-Tag: upstream/4.7.83~14770 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9b71b6bddfd2f97bc3652c4b7c9d3a2b9368a1d;p=platform%2Fupstream%2Fv8.git Put zapping of local handles behind the extra checks flag. R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/12989019 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14048 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/api.cc b/src/api.cc index 64c00220f..71d3f78ed 100644 --- a/src/api.cc +++ b/src/api.cc @@ -477,14 +477,6 @@ void V8::SetAllowCodeGenerationFromStringsCallback( } -#ifdef DEBUG -void ImplementationUtilities::ZapHandleRange(i::Object** begin, - i::Object** end) { - i::HandleScope::ZapRange(begin, end); -} -#endif - - void V8::SetFlagsFromString(const char* str, int length) { i::FlagList::SetFlagsFromString(str, length); } @@ -706,7 +698,7 @@ void HandleScope::Leave() { i::HandleScope::DeleteExtensions(isolate_); } -#ifdef DEBUG +#ifdef ENABLE_EXTRA_CHECKS i::HandleScope::ZapRange(prev_next_, prev_limit_); #endif } @@ -7053,7 +7045,7 @@ DeferredHandles::~DeferredHandles() { isolate_->UnlinkDeferredHandles(this); for (int i = 0; i < blocks_.length(); i++) { -#ifdef DEBUG +#ifdef ENABLE_EXTRA_CHECKS HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]); #endif isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]); diff --git a/src/api.h b/src/api.h index 8628b2a96..d73646d99 100644 --- a/src/api.h +++ b/src/api.h @@ -572,8 +572,8 @@ void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) { #endif blocks_.RemoveLast(); -#ifdef DEBUG - v8::ImplementationUtilities::ZapHandleRange(block_start, block_limit); +#ifdef ENABLE_EXTRA_CHECKS + internal::HandleScope::ZapRange(block_start, block_limit); #endif if (spare_ != NULL) { DeleteArray(spare_); diff --git a/src/apiutils.h b/src/apiutils.h index 71c0e1c2c..9831f0866 100644 --- a/src/apiutils.h +++ b/src/apiutils.h @@ -67,10 +67,6 @@ class ImplementationUtilities { // Introduce an alias for the handle scope data to allow non-friends // to access the HandleScope data. typedef v8::HandleScope::Data HandleScopeData; - -#ifdef DEBUG - static void ZapHandleRange(internal::Object** begin, internal::Object** end); -#endif }; } // namespace v8 diff --git a/src/handles-inl.h b/src/handles-inl.h index fd60a350d..b763c86a7 100644 --- a/src/handles-inl.h +++ b/src/handles-inl.h @@ -107,7 +107,7 @@ void HandleScope::CloseScope() { current->limit = prev_limit_; DeleteExtensions(isolate_); } -#ifdef DEBUG +#ifdef ENABLE_EXTRA_CHECKS ZapRange(prev_next_, prev_limit_); #endif } diff --git a/src/handles.cc b/src/handles.cc index 2958d2cc0..9c436a211 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -101,12 +101,14 @@ void HandleScope::DeleteExtensions(Isolate* isolate) { } +#ifdef ENABLE_EXTRA_CHECKS void HandleScope::ZapRange(Object** start, Object** end) { ASSERT(end - start <= kHandleBlockSize); for (Object** p = start; p != end; p++) { *reinterpret_cast(p) = v8::internal::kHandleZapValue; } } +#endif Address HandleScope::current_level_address(Isolate* isolate) { diff --git a/src/handles.h b/src/handles.h index 3e408b73f..bcd611307 100644 --- a/src/handles.h +++ b/src/handles.h @@ -160,13 +160,14 @@ class HandleScope { // Extend the handle scope making room for more handles. static internal::Object** Extend(Isolate* isolate); +#ifdef ENABLE_EXTRA_CHECKS // Zaps the handles in the half-open interval [start, end). static void ZapRange(internal::Object** start, internal::Object** end); +#endif - friend class v8::internal::DeferredHandles; friend class v8::HandleScope; + friend class v8::internal::DeferredHandles; friend class v8::internal::HandleScopeImplementer; - friend class v8::ImplementationUtilities; friend class v8::internal::Isolate; };