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

Unified Diff: runtime/vm/compiler.cc

Issue 1562853003: 1. Add code to grow the heap instead of collecting garbage in Heap::AllocateOld when allocation is … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review-comments Created 4 years, 11 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 | runtime/vm/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index be9c996a8ee88a12f439c6bb3fbe4041a12f7223..70d1ac6509062e80ebd2963b8b7ec8bafbbf7f33 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -1049,8 +1049,10 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
TimelineDurationScope tds(thread(),
compiler_timeline,
"FinalizeCompilation");
- // This part of compilation must be at a safepoint.
- if (!thread()->IsMutatorThread()) {
+ if (thread()->IsMutatorThread()) {
+ FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
+ } else {
+ // This part of compilation must be at a safepoint.
// Stop mutator thread before creating the instruction object and
// installing code.
// Mutator thread may not run code while we are creating the
@@ -1058,13 +1060,16 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
// changes code page access permissions (makes them temporary not
// executable).
isolate()->thread_registry()->SafepointThreads();
- }
-
- FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
-
- if (!thread()->IsMutatorThread()) {
- // Background compilation.
+ {
+ // Do not Garbage collect during this stage and instead allow the
+ // heap to grow.
+ NoHeapGrowthControlScope no_growth_control;
+ FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
+ }
isolate()->thread_registry()->ResumeAllThreads();
+ if (isolate()->heap()->NeedsGarbageCollection()) {
+ isolate()->heap()->CollectAllGarbage();
+ }
}
}
// Mark that this isolate now has compiled code.
« no previous file with comments | « no previous file | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698