Index: src/execution.cc |
diff --git a/src/execution.cc b/src/execution.cc |
index e6a569f33d967d66bdfc0065ef10c7117a3a091a..2558d8c946426b196ed1bf7c158151fdcff6079a 100644 |
--- a/src/execution.cc |
+++ b/src/execution.cc |
@@ -452,8 +452,13 @@ Object* StackGuard::HandleInterrupts() { |
isolate_->heap()->MonotonicallyIncreasingTimeInMs(); |
} |
- if (CheckAndClearInterrupt(GC_REQUEST)) { |
- isolate_->heap()->HandleGCRequest(); |
+ if (CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT)) { |
+ isolate_->heap()->CollectAllAvailableGarbage("low memory notification"); |
+ CheckAndClearInterrupt(GC_REQUEST); |
+ } else { |
+ if (CheckAndClearInterrupt(GC_REQUEST)) { |
+ isolate_->heap()->HandleGCRequest(); |
+ } |
} |
if (CheckDebugBreak() || CheckDebugCommand()) { |
@@ -485,5 +490,13 @@ Object* StackGuard::HandleInterrupts() { |
return isolate_->heap()->undefined_value(); |
} |
+bool StackGuard::NeedMemoryPressureGC() { |
+ return CheckInterrupt(MEMORY_PRESSURE_INTERRUPT); |
+} |
+ |
+void StackGuard::MemoryPressureGCDone() { |
+ CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT); |
+} |
+ |
} // namespace internal |
} // namespace v8 |