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

Unified Diff: src/api.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') | « include/v8.h ('k') | src/execution.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 26ebfa8a6775163c01e75c00d54e728fc950ecdf..4da05947b241b83a34db8a09bc2729f390027d3e 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -7153,6 +7153,10 @@ void Isolate::RequestInterrupt(InterruptCallback callback, void* data) {
isolate->RequestInterrupt(callback, data);
}
+void Isolate::RequestMemoryPressureInterrupt() {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+ isolate->RequestMemoryPressureInterrupt();
+}
void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) {
CHECK(i::FLAG_expose_gc);
@@ -7577,6 +7581,18 @@ void Isolate::LowMemoryNotification() {
}
}
+void Isolate::GCNotificationBasedOnMemoryPressureInterrupt() {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+ {
+ i::HistogramTimerScope idle_notification_scope(
+ isolate->counters()->gc_low_memory_notification());
+ if (isolate->stack_guard()->NeedMemoryPressureGC()) {
+ TRACE_EVENT0("v8", "V8.GCLowMemoryNotification");
+ isolate->heap()->CollectAllAvailableGarbage("low memory notification");
+ isolate->stack_guard()->MemoryPressureGCDone();
+ }
+ }
+}
int Isolate::ContextDisposedNotification(bool dependant_context) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
« include/v8.h ('K') | « include/v8.h ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698