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

Unified Diff: runtime/vm/compiler.cc

Issue 1904153002: Add a stress testing flag --background-compilation-stop-alot; add an extra check if background comp… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: r 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/flag_list.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 96481e074bf99588d14651a8983757450419a04e..55afac151ad4bded0838a3123d0c5a8ec8760e1a 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -473,6 +473,7 @@ class CompileParsedFunctionHelper : public ValueObject {
void FinalizeCompilation(Assembler* assembler,
FlowGraphCompiler* graph_compiler,
FlowGraph* flow_graph);
+ void CheckIfBackgroundCompilerIsBeingStopped();
ParsedFunction* parsed_function_;
const bool optimized_;
@@ -666,6 +667,16 @@ NOT_IN_PRODUCT(
}
+void CompileParsedFunctionHelper::CheckIfBackgroundCompilerIsBeingStopped() {
+ ASSERT(Compiler::IsBackgroundCompilation());
+ if (!isolate()->background_compiler()->is_running()) {
+ // The background compiler is being stopped.
+ Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
+ "Background compilation is being stopped");
+ }
+}
+
+
// Return false if bailed out.
// If optimized_result_code is not NULL then it is caller's responsibility
// to install code.
@@ -1133,19 +1144,17 @@ bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
// changes code page access permissions (makes them temporary not
// executable).
{
+ CheckIfBackgroundCompilerIsBeingStopped();
SafepointOperationScope safepoint_scope(thread());
// Do not Garbage collect during this stage and instead allow the
// heap to grow.
NoHeapGrowthControlScope no_growth_control;
- if (!isolate()->background_compiler()->is_running()) {
- // The background compiler is being stopped.
- Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
- "Background compilation is being stopped");
- }
+ CheckIfBackgroundCompilerIsBeingStopped();
FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
}
// TODO(srdjan): Enable this and remove the one from
- // 'BackgroundCompiler::CompileOptimized'
+ // 'BackgroundCompiler::CompileOptimized' once cause of time-outs
+ // is resolved.
// if (isolate()->heap()->NeedsGarbageCollection()) {
// isolate()->heap()->CollectAllGarbage();
// }
@@ -1916,7 +1925,10 @@ void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) {
void BackgroundCompiler::Stop(Isolate* isolate) {
BackgroundCompiler* task = isolate->background_compiler();
- ASSERT(task != NULL);
+ if (task == NULL) {
+ // Nothing to stop.
+ return;
+ }
BackgroundCompilationQueue* function_queue = task->function_queue();
Monitor* queue_monitor = task->queue_monitor_;
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698