Index: src/handles-inl.h |
diff --git a/src/handles-inl.h b/src/handles-inl.h |
index a5c81cec56f1d0056be0d1066683fc27432a4362..130798647ba2d6be2c68a1c810fd57a3bf39d1e0 100644 |
--- a/src/handles-inl.h |
+++ b/src/handles-inl.h |
@@ -149,25 +149,31 @@ T** HandleScope::CreateHandle(T* value, Isolate* isolate) { |
#ifdef DEBUG |
inline NoHandleAllocation::NoHandleAllocation() { |
+ Isolate* isolate = Isolate::Current(); |
v8::ImplementationUtilities::HandleScopeData* current = |
- Isolate::Current()->handle_scope_data(); |
+ isolate->handle_scope_data(); |
- // Shrink the current handle scope to make it impossible to do |
- // handle allocations without an explicit handle scope. |
- current->limit = current->next; |
+ active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
+ if (active_) { |
+ // Shrink the current handle scope to make it impossible to do |
+ // handle allocations without an explicit handle scope. |
+ current->limit = current->next; |
- level_ = current->level; |
- current->level = 0; |
+ level_ = current->level; |
+ current->level = 0; |
+ } |
} |
inline NoHandleAllocation::~NoHandleAllocation() { |
- // Restore state in current handle scope to re-enable handle |
- // allocations. |
- v8::ImplementationUtilities::HandleScopeData* data = |
- Isolate::Current()->handle_scope_data(); |
- ASSERT_EQ(0, data->level); |
- data->level = level_; |
+ if (active_) { |
+ // Restore state in current handle scope to re-enable handle |
+ // allocations. |
+ v8::ImplementationUtilities::HandleScopeData* data = |
+ Isolate::Current()->handle_scope_data(); |
+ ASSERT_EQ(0, data->level); |
+ data->level = level_; |
+ } |
} |
#endif |