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

Unified Diff: Source/bindings/core/v8/V8GCController.cpp

Issue 1190513006: Oilpan: adjust GC policy under memory pressure (only.) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove testing CPPery Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8GCController.cpp
diff --git a/Source/bindings/core/v8/V8GCController.cpp b/Source/bindings/core/v8/V8GCController.cpp
index 678ba9d952eedd4a84cc79cc15dfbf1a40e94b14..3c496ae2a398335ee891c1ab67ba5a5fc48d13cd 100644
--- a/Source/bindings/core/v8/V8GCController.cpp
+++ b/Source/bindings/core/v8/V8GCController.cpp
@@ -382,19 +382,23 @@ void V8GCController::majorGCPrologue(v8::Isolate* isolate, bool constructRetaine
void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags)
{
+ // v8::kGCCallbackFlagForced forces a Blink heap garbage collection
+ // when a garbage collection was forced from V8. This is either used
+ // for tests that force GCs from JavaScript to verify that objects die
+ // when expected, or when handling memory pressure notifications.
+ bool forceGC = flags & v8::kGCCallbackFlagForced;
+
// FIXME: It would be nice if the GC callbacks passed the Isolate directly....
v8::Isolate* isolate = v8::Isolate::GetCurrent();
if (type == v8::kGCTypeScavenge) {
minorGCEpilogue(isolate);
} else if (type == v8::kGCTypeMarkSweepCompact) {
majorGCEpilogue(isolate);
- ThreadState::current()->didV8GC();
+ if (!forceGC)
+ ThreadState::current()->didV8MajorGC();
}
- // Forces a Blink heap garbage collection when a garbage collection
- // was forced from V8. This is used for tests that force GCs from
- // JavaScript to verify that objects die when expected.
- if (flags & v8::kGCCallbackFlagForced) {
+ if (forceGC) {
// This single GC is not enough for two reasons:
// (1) The GC is not precise because the GC scans on-stack pointers conservatively.
// (2) One GC is not enough to break a chain of persistent handles. It's possible that
« no previous file with comments | « no previous file | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698