Index: src/heap/heap-inl.h |
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h |
index f40ac5616d159a33c638cca024d96fdab971ab59..183fc9d4f9bd6c500431ac913617d23fcae357a3 100644 |
--- a/src/heap/heap-inl.h |
+++ b/src/heap/heap-inl.h |
@@ -497,6 +497,21 @@ AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { |
} |
+bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason, |
+ const GCFlags flags, |
+ const GCCallbackFlags callback_flags) { |
+ const char* collector_reason = nullptr; |
+ GarbageCollector collector = SelectGarbageCollector(space, &collector_reason); |
+ set_current_gc_flags(flags); |
+ current_gc_callback_flags_ = callback_flags; |
+ const bool next_gc_likely_to_collect_more = |
+ CollectGarbage(collector, gc_reason, collector_reason); |
+ set_current_gc_flags(kNoGCFlags); |
+ current_gc_callback_flags_ = kNoGCCallbackFlags; |
+ return next_gc_likely_to_collect_more; |
+} |
+ |
+ |
void Heap::UpdateAllocationSiteFeedback(HeapObject* object, |
ScratchpadSlotMode mode) { |
Heap* heap = object->GetHeap(); |
@@ -542,14 +557,6 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
} |
-bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason, |
- const v8::GCCallbackFlags callbackFlags) { |
- const char* collector_reason = NULL; |
- GarbageCollector collector = SelectGarbageCollector(space, &collector_reason); |
- return CollectGarbage(collector, gc_reason, collector_reason, callbackFlags); |
-} |
- |
- |
Isolate* Heap::isolate() { |
return reinterpret_cast<Isolate*>( |
reinterpret_cast<intptr_t>(this) - |
@@ -570,28 +577,29 @@ Isolate* Heap::isolate() { |
RETURN_VALUE; \ |
} |
-#define CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ |
- do { \ |
- AllocationResult __allocation__ = FUNCTION_CALL; \ |
- Object* __object__ = NULL; \ |
- RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
- /* Two GCs before panicking. In newspace will almost always succeed. */ \ |
- for (int __i__ = 0; __i__ < 2; __i__++) { \ |
- (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ |
- "allocation failure"); \ |
- __allocation__ = FUNCTION_CALL; \ |
- RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
- } \ |
- (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ |
- (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ |
- { \ |
- AlwaysAllocateScope __scope__(ISOLATE); \ |
- __allocation__ = FUNCTION_CALL; \ |
- } \ |
- RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
- /* TODO(1181417): Fix this. */ \ |
- v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ |
- RETURN_EMPTY; \ |
+#define CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ |
+ do { \ |
+ AllocationResult __allocation__ = FUNCTION_CALL; \ |
+ Object* __object__ = NULL; \ |
+ RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
+ /* Two GCs before panicking. In newspace will almost always succeed. */ \ |
+ for (int __i__ = 0; __i__ < 2; __i__++) { \ |
+ (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ |
+ "allocation failure", \ |
+ Heap::kNoGCFlags, kNoGCCallbackFlags); \ |
+ __allocation__ = FUNCTION_CALL; \ |
+ RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
+ } \ |
+ (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ |
+ (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ |
+ { \ |
+ AlwaysAllocateScope __scope__(ISOLATE); \ |
+ __allocation__ = FUNCTION_CALL; \ |
+ } \ |
+ RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
+ /* TODO(1181417): Fix this. */ \ |
+ v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ |
+ RETURN_EMPTY; \ |
} while (false) |
#define CALL_AND_RETRY_OR_DIE(ISOLATE, FUNCTION_CALL, RETURN_VALUE, \ |