Index: src/heap-inl.h |
diff --git a/src/heap-inl.h b/src/heap-inl.h |
index ea175bbc3b5c8cffa5b5e673c25fc468d4f62745..459be609a66eec14728113f5150baccb438707d7 100644 |
--- a/src/heap-inl.h |
+++ b/src/heap-inl.h |
@@ -223,7 +223,7 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes, |
HeapProfiler* profiler = isolate_->heap_profiler(); |
#ifdef DEBUG |
if (FLAG_gc_interval >= 0 && |
- !disallow_allocation_failure_ && |
+ AllowAllocationFailure::IsAllowed(isolate_) && |
Heap::allocation_timeout_-- <= 0) { |
return Failure::RetryAfterGC(space); |
} |
@@ -663,7 +663,7 @@ Isolate* Heap::isolate() { |
(ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ |
(ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ |
{ \ |
- AlwaysAllocateScope __scope__; \ |
+ AlwaysAllocateScope __scope__(ISOLATE); \ |
__maybe_object__ = FUNCTION_CALL; \ |
} \ |
if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \ |
@@ -778,21 +778,20 @@ void Heap::CompletelyClearInstanceofCache() { |
} |
-AlwaysAllocateScope::AlwaysAllocateScope() { |
+AlwaysAllocateScope::AlwaysAllocateScope(Isolate* isolate) |
+ : heap_(isolate->heap()), daf_(isolate) { |
// We shouldn't hit any nested scopes, because that requires |
// non-handle code to call handle code. The code still works but |
// performance will degrade, so we want to catch this situation |
// in debug mode. |
- Isolate* isolate = Isolate::Current(); |
- ASSERT(isolate->heap()->always_allocate_scope_depth_ == 0); |
- isolate->heap()->always_allocate_scope_depth_++; |
+ ASSERT(heap_->always_allocate_scope_depth_ == 0); |
+ heap_->always_allocate_scope_depth_++; |
} |
AlwaysAllocateScope::~AlwaysAllocateScope() { |
- Isolate* isolate = Isolate::Current(); |
- isolate->heap()->always_allocate_scope_depth_--; |
- ASSERT(isolate->heap()->always_allocate_scope_depth_ == 0); |
+ heap_->always_allocate_scope_depth_--; |
+ ASSERT(heap_->always_allocate_scope_depth_ == 0); |
} |
@@ -833,23 +832,6 @@ double GCTracer::SizeOfHeapObjects() { |
} |
-DisallowAllocationFailure::DisallowAllocationFailure() { |
-#ifdef DEBUG |
- Isolate* isolate = Isolate::Current(); |
- old_state_ = isolate->heap()->disallow_allocation_failure_; |
- isolate->heap()->disallow_allocation_failure_ = true; |
-#endif |
-} |
- |
- |
-DisallowAllocationFailure::~DisallowAllocationFailure() { |
-#ifdef DEBUG |
- Isolate* isolate = Isolate::Current(); |
- isolate->heap()->disallow_allocation_failure_ = old_state_; |
-#endif |
-} |
- |
- |
} } // namespace v8::internal |
#endif // V8_HEAP_INL_H_ |