Index: src/execution.cc |
diff --git a/src/execution.cc b/src/execution.cc |
index e6a569f33d967d66bdfc0065ef10c7117a3a091a..07b9a86549fc4eff5d8971591918d56881c93bef 100644 |
--- a/src/execution.cc |
+++ b/src/execution.cc |
@@ -452,8 +452,16 @@ Object* StackGuard::HandleInterrupts() { |
isolate_->heap()->MonotonicallyIncreasingTimeInMs(); |
} |
- if (CheckAndClearInterrupt(GC_REQUEST)) { |
- isolate_->heap()->HandleGCRequest(); |
+ if (CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT)) { |
+ if (isolate_->memory_pressure_level_ != |
+ v8::Isolate::MemoryPressureLevel::kNone) { |
+ isolate_->heap()->CollectAllAvailableGarbage("low memory notification"); |
+ CheckAndClearInterrupt(GC_REQUEST); |
+ } |
+ } else { |
+ if (CheckAndClearInterrupt(GC_REQUEST)) { |
+ isolate_->heap()->HandleGCRequest(); |
+ } |
} |
if (CheckDebugBreak() || CheckDebugCommand()) { |
@@ -485,5 +493,14 @@ Object* StackGuard::HandleInterrupts() { |
return isolate_->heap()->undefined_value(); |
} |
+void StackGuard::HandleMemoryPressureInterrupt() { |
+ if (CheckAndClearInterrupt(MEMORY_PRESSURE_INTERRUPT)) { |
+ if (isolate_->memory_pressure_level_ != |
+ v8::Isolate::MemoryPressureLevel::kNone) { |
+ isolate_->heap()->CollectAllAvailableGarbage("low memory notification"); |
+ } |
+ } |
+} |
+ |
} // namespace internal |
} // namespace v8 |