Revision: 15548
Author:   [email protected]
Date:     Mon Jul  8 04:29:55 2013
Log: Introduce a handle zapping setting, and enable it by default for release and debug

The checks are split out from "extra checks" which are too expensive to
turn on by default.

[email protected]

Review URL: https://codereview.chromium.org/18316006
http://code.google.com/p/v8/source/detail?r=15548

Modified:
 /branches/bleeding_edge/Makefile
 /branches/bleeding_edge/build/common.gypi
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/api.h
 /branches/bleeding_edge/src/global-handles.cc
 /branches/bleeding_edge/src/handles-inl.h
 /branches/bleeding_edge/src/handles.cc
 /branches/bleeding_edge/src/handles.h

=======================================
--- /branches/bleeding_edge/Makefile    Wed Jul  3 05:00:40 2013
+++ /branches/bleeding_edge/Makefile    Mon Jul  8 04:29:55 2013
@@ -80,6 +80,13 @@
 ifeq ($(extrachecks), off)
   GYPFLAGS += -Dv8_enable_extra_checks=0
 endif
+# handlezapping=on/off
+ifeq ($(handlezapping), on)
+  GYPFLAGS += -Dv8_enable_handle_zapping=1
+endif
+ifeq ($(handlezapping), off)
+  GYPFLAGS += -Dv8_enable_handle_zapping=0
+endif
 # gdbjit=on/off
 ifeq ($(gdbjit), on)
   GYPFLAGS += -Dv8_enable_gdbjit=1
=======================================
--- /branches/bleeding_edge/build/common.gypi   Wed Jul  3 04:22:29 2013
+++ /branches/bleeding_edge/build/common.gypi   Mon Jul  8 04:29:55 2013
@@ -490,6 +490,7 @@
       'Debug': {
         'variables': {
           'v8_enable_extra_checks%': 1,
+          'v8_enable_handle_zapping%': 1,
         },
         'defines': [
           'DEBUG',
@@ -518,6 +519,9 @@
           ['v8_enable_extra_checks==1', {
             'defines': ['ENABLE_EXTRA_CHECKS',],
           }],
+          ['v8_enable_handle_zapping==1', {
+            'defines': ['ENABLE_HANDLE_ZAPPING',],
+          }],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
                         '-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
@@ -550,11 +554,15 @@
       'Release': {
         'variables': {
           'v8_enable_extra_checks%': 0,
+          'v8_enable_handle_zapping%': 1,
         },
         'conditions': [
           ['v8_enable_extra_checks==1', {
             'defines': ['ENABLE_EXTRA_CHECKS',],
           }],
+          ['v8_enable_handle_zapping==1', {
+            'defines': ['ENABLE_HANDLE_ZAPPING',],
+          }],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
             'cflags!': [
               '-O2',
=======================================
--- /branches/bleeding_edge/src/api.cc  Sat Jul  6 02:12:09 2013
+++ /branches/bleeding_edge/src/api.cc  Mon Jul  8 04:29:55 2013
@@ -7979,7 +7979,7 @@
   isolate_->UnlinkDeferredHandles(this);

   for (int i = 0; i < blocks_.length(); i++) {
-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
     HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]);
 #endif
     isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]);
=======================================
--- /branches/bleeding_edge/src/api.h   Mon Jun 24 04:23:50 2013
+++ /branches/bleeding_edge/src/api.h   Mon Jul  8 04:29:55 2013
@@ -665,17 +665,22 @@
 #ifdef DEBUG
     // SealHandleScope may make the prev_limit to point inside the block.
     if (block_start <= prev_limit && prev_limit <= block_limit) {
-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
       internal::HandleScope::ZapRange(prev_limit, block_limit);
 #endif
       break;
     }
 #else
-    if (prev_limit == block_limit) break;
+    if (prev_limit == block_limit) {
+#ifdef ENABLE_HANDLE_ZAPPING
+      internal::HandleScope::ZapRange(prev_limit, block_limit);
+#endif
+      break;
+    }
 #endif

     blocks_.RemoveLast();
-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
     internal::HandleScope::ZapRange(block_start, block_limit);
 #endif
     if (spare_ != NULL) {
=======================================
--- /branches/bleeding_edge/src/global-handles.cc       Fri Jul  5 02:52:11 2013
+++ /branches/bleeding_edge/src/global-handles.cc       Mon Jul  8 04:29:55 2013
@@ -78,7 +78,7 @@
                   Internals::kNodeIsPartiallyDependentShift);
   }

-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
   ~Node() {
// TODO(1428): if it's a weak handle we should have invoked its callback.
     // Zap the values for eager trapping.
@@ -117,7 +117,7 @@
   void Release() {
     ASSERT(state() != FREE);
     set_state(FREE);
-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
     // Zap the values for eager trapping.
     object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue);
     class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
=======================================
--- /branches/bleeding_edge/src/handles-inl.h   Wed Jun  5 08:35:14 2013
+++ /branches/bleeding_edge/src/handles-inl.h   Mon Jul  8 04:29:55 2013
@@ -134,7 +134,7 @@
     DeleteExtensions(isolate);
   }

-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
   ZapRange(prev_next, prev_limit);
 #endif
 }
=======================================
--- /branches/bleeding_edge/src/handles.cc      Fri Jul  5 02:52:11 2013
+++ /branches/bleeding_edge/src/handles.cc      Mon Jul  8 04:29:55 2013
@@ -101,7 +101,7 @@
 }


-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
 void HandleScope::ZapRange(Object** start, Object** end) {
   ASSERT(end - start <= kHandleBlockSize);
   for (Object** p = start; p != end; p++) {
@@ -554,7 +554,7 @@
     LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object));
     result = args.Call(enum_fun);
   }
-#if ENABLE_EXTRA_CHECKS
+#if ENABLE_HANDLE_ZAPPING
   CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
 #endif
   return v8::Local<v8::Array>::New(reinterpret_cast<v8::Isolate*>(isolate),
@@ -575,7 +575,7 @@
v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator());
     LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object));
     result = args.Call(enum_fun);
-#if ENABLE_EXTRA_CHECKS
+#if ENABLE_HANDLE_ZAPPING
CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
 #endif
   }
=======================================
--- /branches/bleeding_edge/src/handles.h       Fri Jul  5 02:38:29 2013
+++ /branches/bleeding_edge/src/handles.h       Mon Jul  8 04:29:55 2013
@@ -177,7 +177,7 @@
   // Extend the handle scope making room for more handles.
   static internal::Object** Extend(Isolate* isolate);

-#ifdef ENABLE_EXTRA_CHECKS
+#ifdef ENABLE_HANDLE_ZAPPING
   // Zaps the handles in the half-open interval [start, end).
   static void ZapRange(Object** start, Object** end);
 #endif

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to