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

Unified Diff: runtime/vm/compiler.cc

Issue 1887123002: GC Experiment: move GC call from background compiler thread to the mutator thread (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | no next file » | 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 7f84e1407de635450ed583a4975946d3c650e29d..8d3b319d5717492eb6450219d041f96c1e0311df 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -1073,9 +1073,11 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
}
FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
}
- if (isolate()->heap()->NeedsGarbageCollection()) {
- isolate()->heap()->CollectAllGarbage();
- }
+ // TODO(srdjan): Enable this and remove the one from
+ // 'BackgroundCompiler::CompileOptimize'
+ // if (isolate()->heap()->NeedsGarbageCollection()) {
+ // isolate()->heap()->CollectAllGarbage();
+ // }
}
}
// Mark that this isolate now has compiled code.
@@ -1812,14 +1814,21 @@ void BackgroundCompiler::Run() {
void BackgroundCompiler::CompileOptimized(const Function& function) {
ASSERT(Thread::Current()->IsMutatorThread());
- MonitorLocker ml(queue_monitor_);
- ASSERT(running_);
- if (function_queue()->ContainsObj(function)) {
- return;
+ // TODO(srdjan): Checking different strategy for collecting garbage
+ // accumulated by background compiler.
+ if (isolate_->heap()->NeedsGarbageCollection()) {
+ isolate_->heap()->CollectAllGarbage();
+ }
+ {
+ MonitorLocker ml(queue_monitor_);
+ ASSERT(running_);
+ if (function_queue()->ContainsObj(function)) {
+ return;
+ }
+ QueueElement* elem = new QueueElement(function);
+ function_queue()->Add(elem);
+ ml.Notify();
}
- QueueElement* elem = new QueueElement(function);
- function_queue()->Add(elem);
- ml.Notify();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698