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
parent b8fd2527
...@@ -477,14 +477,6 @@ void V8::SetAllowCodeGenerationFromStringsCallback( ...@@ -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) { void V8::SetFlagsFromString(const char* str, int length) {
i::FlagList::SetFlagsFromString(str, length); i::FlagList::SetFlagsFromString(str, length);
} }
...@@ -706,7 +698,7 @@ void HandleScope::Leave() { ...@@ -706,7 +698,7 @@ void HandleScope::Leave() {
i::HandleScope::DeleteExtensions(isolate_); i::HandleScope::DeleteExtensions(isolate_);
} }
#ifdef DEBUG #ifdef ENABLE_EXTRA_CHECKS
i::HandleScope::ZapRange(prev_next_, prev_limit_); i::HandleScope::ZapRange(prev_next_, prev_limit_);
#endif #endif
} }
...@@ -7053,7 +7045,7 @@ DeferredHandles::~DeferredHandles() { ...@@ -7053,7 +7045,7 @@ DeferredHandles::~DeferredHandles() {
isolate_->UnlinkDeferredHandles(this); isolate_->UnlinkDeferredHandles(this);
for (int i = 0; i < blocks_.length(); i++) { for (int i = 0; i < blocks_.length(); i++) {
#ifdef DEBUG #ifdef ENABLE_EXTRA_CHECKS
HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]); HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]);
#endif #endif
isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]); isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]);
......
...@@ -572,8 +572,8 @@ void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) { ...@@ -572,8 +572,8 @@ void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) {
#endif #endif
blocks_.RemoveLast(); blocks_.RemoveLast();
#ifdef DEBUG #ifdef ENABLE_EXTRA_CHECKS
v8::ImplementationUtilities::ZapHandleRange(block_start, block_limit); internal::HandleScope::ZapRange(block_start, block_limit);
#endif #endif
if (spare_ != NULL) { if (spare_ != NULL) {
DeleteArray(spare_); DeleteArray(spare_);
......
...@@ -67,10 +67,6 @@ class ImplementationUtilities { ...@@ -67,10 +67,6 @@ class ImplementationUtilities {
// Introduce an alias for the handle scope data to allow non-friends // Introduce an alias for the handle scope data to allow non-friends
// to access the HandleScope data. // to access the HandleScope data.
typedef v8::HandleScope::Data HandleScopeData; typedef v8::HandleScope::Data HandleScopeData;
#ifdef DEBUG
static void ZapHandleRange(internal::Object** begin, internal::Object** end);
#endif
}; };
} // namespace v8 } // namespace v8
......
...@@ -107,7 +107,7 @@ void HandleScope::CloseScope() { ...@@ -107,7 +107,7 @@ void HandleScope::CloseScope() {
current->limit = prev_limit_; current->limit = prev_limit_;
DeleteExtensions(isolate_); DeleteExtensions(isolate_);
} }
#ifdef DEBUG #ifdef ENABLE_EXTRA_CHECKS
ZapRange(prev_next_, prev_limit_); ZapRange(prev_next_, prev_limit_);
#endif #endif
} }
......
...@@ -101,12 +101,14 @@ void HandleScope::DeleteExtensions(Isolate* isolate) { ...@@ -101,12 +101,14 @@ void HandleScope::DeleteExtensions(Isolate* isolate) {
} }
#ifdef ENABLE_EXTRA_CHECKS
void HandleScope::ZapRange(Object** start, Object** end) { void HandleScope::ZapRange(Object** start, Object** end) {
ASSERT(end - start <= kHandleBlockSize); ASSERT(end - start <= kHandleBlockSize);
for (Object** p = start; p != end; p++) { for (Object** p = start; p != end; p++) {
*reinterpret_cast<Address*>(p) = v8::internal::kHandleZapValue; *reinterpret_cast<Address*>(p) = v8::internal::kHandleZapValue;
} }
} }
#endif
Address HandleScope::current_level_address(Isolate* isolate) { Address HandleScope::current_level_address(Isolate* isolate) {
......
...@@ -160,13 +160,14 @@ class HandleScope { ...@@ -160,13 +160,14 @@ class HandleScope {
// Extend the handle scope making room for more handles. // Extend the handle scope making room for more handles.
static internal::Object** Extend(Isolate* isolate); static internal::Object** Extend(Isolate* isolate);
#ifdef ENABLE_EXTRA_CHECKS
// Zaps the handles in the half-open interval [start, end). // Zaps the handles in the half-open interval [start, end).
static void ZapRange(internal::Object** start, internal::Object** end); static void ZapRange(internal::Object** start, internal::Object** end);
#endif
friend class v8::internal::DeferredHandles;
friend class v8::HandleScope; friend class v8::HandleScope;
friend class v8::internal::DeferredHandles;
friend class v8::internal::HandleScopeImplementer; friend class v8::internal::HandleScopeImplementer;
friend class v8::ImplementationUtilities;
friend class v8::internal::Isolate; friend class v8::internal::Isolate;
}; };
......
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