Index: src/compiler-dispatcher/compiler-dispatcher.cc |
diff --git a/src/compiler-dispatcher/compiler-dispatcher.cc b/src/compiler-dispatcher/compiler-dispatcher.cc |
index 1b639fe9b0ad7035969b993a2253397461fa595c..5cf10aa3eb8ac012143c4f4b486d0e69c3bcfc1c 100644 |
--- a/src/compiler-dispatcher/compiler-dispatcher.cc |
+++ b/src/compiler-dispatcher/compiler-dispatcher.cc |
@@ -110,6 +110,8 @@ CompilerDispatcher::~CompilerDispatcher() { |
} |
bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) { |
+ if (!IsEnabled()) return false; |
+ |
// We only handle functions (no eval / top-level code / wasm) that are |
// attached to a script. |
if (!function->script()->IsScript() || !function->is_function() || |
@@ -127,6 +129,11 @@ bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) { |
return true; |
} |
+bool CompilerDispatcher::IsEnabled() const { |
+ v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); |
+ return FLAG_compiler_dispatcher && platform_->IdleTasksEnabled(v8_isolate); |
+} |
+ |
bool CompilerDispatcher::IsEnqueued(Handle<SharedFunctionInfo> function) const { |
return GetJobFor(function) != jobs_.end(); |
} |
@@ -183,7 +190,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::GetJobFor( |
void CompilerDispatcher::ScheduleIdleTaskIfNeeded() { |
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); |
- if (!platform_->IdleTasksEnabled(v8_isolate)) return; |
+ DCHECK(platform_->IdleTasksEnabled(v8_isolate)); |
if (idle_task_scheduled_) return; |
if (jobs_.empty()) return; |
idle_task_scheduled_ = true; |