Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Flush the optimizing compilejob queue when doing memory pressure GCs
Browse files Browse the repository at this point in the history
R=ulan@chromium.org,hpayer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2145683003
Cr-Commit-Position: refs/heads/master@{#37726}
  • Loading branch information
jeisinger authored and Commit bot committed Jul 13, 2016
1 parent 3179967 commit 906cb20
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "src/frames-inl.h"
#include "src/full-codegen/full-codegen.h"
#include "src/globals.h"
#include "src/heap/heap.h"
#include "src/interpreter/interpreter.h"
#include "src/isolate-inl.h"
#include "src/log-inl.h"
Expand Down Expand Up @@ -705,6 +706,15 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
return false;
}

if (isolate->heap()->HighMemoryPressure()) {
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** High memory pressure, will retry optimizing ");
info->closure()->ShortPrint();
PrintF(" later.\n");
}
return false;
}

// All handles below this point will be allocated in a deferred handle scope
// that is detached and handed off to the background thread when we return.
CompilationHandleScope handle_scope(info);
Expand Down
7 changes: 7 additions & 0 deletions src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4373,6 +4373,13 @@ class MemoryPressureInterruptTask : public CancelableTask {
};

void Heap::CheckMemoryPressure() {
if (HighMemoryPressure()) {
if (isolate()->concurrent_recompilation_enabled()) {
// The optimizing compiler may be unnecessarily holding on to memory.
DisallowHeapAllocation no_recursive_gc;
isolate()->optimizing_compile_dispatcher()->Flush();
}
}
if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) {
CollectGarbageOnMemoryPressure("memory pressure");
} else if (memory_pressure_level_.Value() == MemoryPressureLevel::kModerate) {
Expand Down

0 comments on commit 906cb20

Please sign in to comment.