Index: src/handles-inl.h |
diff --git a/src/handles-inl.h b/src/handles-inl.h |
index 34b3f32d960415bd93dd3cbe1c8f5d9178ba8399..3022f288a3919230c955c01c90d5773d731fac6d 100644 |
--- a/src/handles-inl.h |
+++ b/src/handles-inl.h |
@@ -92,7 +92,19 @@ HandleScope::HandleScope(Isolate* isolate) { |
HandleScope::~HandleScope() { |
- CloseScope(isolate_, prev_next_, prev_limit_); |
+#ifdef DEBUG |
+ if (FLAG_check_handle_count) { |
+ int before = NumberOfHandles(isolate_); |
+ CloseScope(isolate_, prev_next_, prev_limit_); |
+ int after = NumberOfHandles(isolate_); |
+ DCHECK(after - before < kCheckHandleThreshold); |
+ DCHECK(before < kCheckHandleThreshold); |
+ } else { |
+#endif // DEBUG |
+ CloseScope(isolate_, prev_next_, prev_limit_); |
+#ifdef DEBUG |
+ } |
+#endif // DEBUG |
} |