Split extra checks into extra checks and handle zapping

That will make it easier to turn on handle zapping alone and experiment
with it.

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17004 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2013-09-30 11:56:52 +00:00
parent f03dbcff94
commit 3387afd33e
8 changed files with 17 additions and 9 deletions

View File

@ -76,10 +76,10 @@ ifeq ($(snapshot), off)
endif endif
# extrachecks=on/off # extrachecks=on/off
ifeq ($(extrachecks), on) ifeq ($(extrachecks), on)
GYPFLAGS += -Dv8_enable_extra_checks=1 GYPFLAGS += -Dv8_enable_extra_checks=1 -Dv8_enable_handle_zapping=1
endif endif
ifeq ($(extrachecks), off) ifeq ($(extrachecks), off)
GYPFLAGS += -Dv8_enable_extra_checks=0 GYPFLAGS += -Dv8_enable_extra_checks=0 -Dv8_enable_handle_zapping=0
endif endif
# gdbjit=on/off # gdbjit=on/off
ifeq ($(gdbjit), on) ifeq ($(gdbjit), on)

View File

@ -89,21 +89,29 @@
'Debug': { 'Debug': {
'variables': { 'variables': {
'v8_enable_extra_checks%': 1, 'v8_enable_extra_checks%': 1,
'v8_enable_handle_zapping%': 1,
}, },
'conditions': [ 'conditions': [
['v8_enable_extra_checks==1', { ['v8_enable_extra_checks==1', {
'defines': ['ENABLE_EXTRA_CHECKS',], 'defines': ['ENABLE_EXTRA_CHECKS',],
}], }],
['v8_enable_handle_zapping==1', {
'defines': ['ENABLE_HANDLE_ZAPPING',],
}],
], ],
}, # Debug }, # Debug
'Release': { 'Release': {
'variables': { 'variables': {
'v8_enable_extra_checks%': 0, 'v8_enable_extra_checks%': 0,
'v8_enable_handle_zapping%': 0,
}, },
'conditions': [ 'conditions': [
['v8_enable_extra_checks==1', { ['v8_enable_extra_checks==1', {
'defines': ['ENABLE_EXTRA_CHECKS',], 'defines': ['ENABLE_EXTRA_CHECKS',],
}], }],
['v8_enable_handle_zapping==1', {
'defines': ['ENABLE_HANDLE_ZAPPING',],
}],
], # conditions ], # conditions
}, # Release }, # Release
}, # configurations }, # configurations

View File

@ -7525,7 +7525,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 ENABLE_EXTRA_CHECKS #ifdef ENABLE_HANDLE_ZAPPING
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]);

View File

@ -667,7 +667,7 @@ void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) {
#ifdef DEBUG #ifdef DEBUG
// SealHandleScope may make the prev_limit to point inside the block. // SealHandleScope may make the prev_limit to point inside the block.
if (block_start <= prev_limit && prev_limit <= block_limit) { if (block_start <= prev_limit && prev_limit <= block_limit) {
#ifdef ENABLE_EXTRA_CHECKS #ifdef ENABLE_HANDLE_ZAPPING
internal::HandleScope::ZapRange(prev_limit, block_limit); internal::HandleScope::ZapRange(prev_limit, block_limit);
#endif #endif
break; break;
@ -677,7 +677,7 @@ void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) {
#endif #endif
blocks_.RemoveLast(); blocks_.RemoveLast();
#ifdef ENABLE_EXTRA_CHECKS #ifdef ENABLE_HANDLE_ZAPPING
internal::HandleScope::ZapRange(block_start, block_limit); internal::HandleScope::ZapRange(block_start, block_limit);
#endif #endif
if (spare_ != NULL) { if (spare_ != NULL) {

View File

@ -79,7 +79,7 @@ class GlobalHandles::Node {
Internals::kNodeIsPartiallyDependentShift); Internals::kNodeIsPartiallyDependentShift);
} }
#ifdef ENABLE_EXTRA_CHECKS #ifdef ENABLE_HANDLE_ZAPPING
~Node() { ~Node() {
// TODO(1428): if it's a weak handle we should have invoked its callback. // TODO(1428): if it's a weak handle we should have invoked its callback.
// Zap the values for eager trapping. // Zap the values for eager trapping.

View File

@ -135,7 +135,7 @@ void HandleScope::CloseScope(Isolate* isolate,
if (current->limit != prev_limit) { if (current->limit != prev_limit) {
current->limit = prev_limit; current->limit = prev_limit;
DeleteExtensions(isolate); DeleteExtensions(isolate);
#ifdef ENABLE_EXTRA_CHECKS #ifdef ENABLE_HANDLE_ZAPPING
ZapRange(current->next, prev_limit); ZapRange(current->next, prev_limit);
} else { } else {
ZapRange(current->next, prev_next); ZapRange(current->next, prev_next);

View File

@ -101,7 +101,7 @@ void HandleScope::DeleteExtensions(Isolate* isolate) {
} }
#ifdef ENABLE_EXTRA_CHECKS #ifdef ENABLE_HANDLE_ZAPPING
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++) {

View File

@ -177,7 +177,7 @@ 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 #ifdef ENABLE_HANDLE_ZAPPING
// Zaps the handles in the half-open interval [start, end). // Zaps the handles in the half-open interval [start, end).
static void ZapRange(Object** start, Object** end); static void ZapRange(Object** start, Object** end);
#endif #endif