Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Unified Diff: src/execution.cc

Issue 1777883002: Add memory pressure interrupt for memory pressure notification Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/v8.h ('K') | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« include/v8.h ('K') | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698