From e9b71b6bddfd2f97bc3652c4b7c9d3a2b9368a1d Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Fri, 22 Mar 2013 13:40:13 +0000 Subject: [PATCH] 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 --- src/api.cc | 12 ++---------- src/api.h | 4 ++-- src/apiutils.h | 4 ---- src/handles-inl.h | 2 +- src/handles.cc | 2 ++ src/handles.h | 5 +++-- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/api.cc b/src/api.cc index 64c0022..71d3f78 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 8628b2a..d73646d 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 71c0e1c..9831f08 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 fd60a35..b763c86 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 2958d2c..9c436a2 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 3e408b7..bcd6113 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; }; -- 2.7.4