Index: src/heap-inl.h |
diff --git a/src/heap-inl.h b/src/heap-inl.h |
index 9d79db246675b30890448be4f2df0a8b128b77d4..958fe190cff5393806da93aa53d07cdc0dae781a 100644 |
--- a/src/heap-inl.h |
+++ b/src/heap-inl.h |
@@ -772,22 +772,30 @@ DisallowAllocationFailure::~DisallowAllocationFailure() { |
#ifdef DEBUG |
AssertNoAllocation::AssertNoAllocation() { |
- old_state_ = HEAP->allow_allocation(false); |
+ Isolate* isolate = ISOLATE; |
+ active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
+ if (active_) { |
+ old_state_ = isolate->heap()->allow_allocation(false); |
+ } |
} |
AssertNoAllocation::~AssertNoAllocation() { |
- HEAP->allow_allocation(old_state_); |
+ if (active_) HEAP->allow_allocation(old_state_); |
} |
DisableAssertNoAllocation::DisableAssertNoAllocation() { |
- old_state_ = HEAP->allow_allocation(true); |
+ Isolate* isolate = ISOLATE; |
+ active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
+ if (active_) { |
+ old_state_ = isolate->heap()->allow_allocation(true); |
+ } |
} |
DisableAssertNoAllocation::~DisableAssertNoAllocation() { |
- HEAP->allow_allocation(old_state_); |
+ if (active_) HEAP->allow_allocation(old_state_); |
} |
#else |