Commit a0d9eb34 authored by jochen's avatar jochen Committed by Commit bot

Disable the CompilerDispatcher if we don't have idle time

Since we can't do all steps on background threads, we need idle time to
work

BUG=v8:5215
R=danno@chromium.org

Review-Url: https://codereview.chromium.org/2600743002
Cr-Commit-Position: refs/heads/master@{#41944}
parent b0a09d78
...@@ -110,6 +110,8 @@ CompilerDispatcher::~CompilerDispatcher() { ...@@ -110,6 +110,8 @@ CompilerDispatcher::~CompilerDispatcher() {
} }
bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) { bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) {
if (!IsEnabled()) return false;
// We only handle functions (no eval / top-level code / wasm) that are // We only handle functions (no eval / top-level code / wasm) that are
// attached to a script. // attached to a script.
if (!function->script()->IsScript() || !function->is_function() || if (!function->script()->IsScript() || !function->is_function() ||
...@@ -127,6 +129,11 @@ bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) { ...@@ -127,6 +129,11 @@ bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function) {
return true; 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 { bool CompilerDispatcher::IsEnqueued(Handle<SharedFunctionInfo> function) const {
return GetJobFor(function) != jobs_.end(); return GetJobFor(function) != jobs_.end();
} }
...@@ -183,7 +190,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::GetJobFor( ...@@ -183,7 +190,7 @@ CompilerDispatcher::JobMap::const_iterator CompilerDispatcher::GetJobFor(
void CompilerDispatcher::ScheduleIdleTaskIfNeeded() { void CompilerDispatcher::ScheduleIdleTaskIfNeeded() {
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate_); 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 (idle_task_scheduled_) return;
if (jobs_.empty()) return; if (jobs_.empty()) return;
idle_task_scheduled_ = true; idle_task_scheduled_ = true;
......
...@@ -61,6 +61,7 @@ class V8_EXPORT_PRIVATE CompilerDispatcher { ...@@ -61,6 +61,7 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
JobMap; JobMap;
class IdleTask; class IdleTask;
bool IsEnabled() const;
JobMap::const_iterator GetJobFor(Handle<SharedFunctionInfo> shared) const; JobMap::const_iterator GetJobFor(Handle<SharedFunctionInfo> shared) const;
void ScheduleIdleTaskIfNeeded(); void ScheduleIdleTaskIfNeeded();
void DoIdleWork(double deadline_in_seconds); void DoIdleWork(double deadline_in_seconds);
......
...@@ -300,6 +300,7 @@ DEFINE_BOOL(string_slices, true, "use string slices") ...@@ -300,6 +300,7 @@ DEFINE_BOOL(string_slices, true, "use string slices")
DEFINE_BOOL(ignition, false, "use ignition interpreter") DEFINE_BOOL(ignition, false, "use ignition interpreter")
DEFINE_BOOL(ignition_staging, false, "use ignition with all staged features") DEFINE_BOOL(ignition_staging, false, "use ignition with all staged features")
DEFINE_IMPLICATION(ignition_staging, ignition) DEFINE_IMPLICATION(ignition_staging, ignition)
DEFINE_IMPLICATION(ignition_staging, compiler_dispatcher)
DEFINE_STRING(ignition_filter, "*", "filter for ignition interpreter") DEFINE_STRING(ignition_filter, "*", "filter for ignition interpreter")
DEFINE_BOOL(ignition_deadcode, true, DEFINE_BOOL(ignition_deadcode, true,
"use ignition dead code elimination optimizer") "use ignition dead code elimination optimizer")
...@@ -666,6 +667,9 @@ DEFINE_BOOL(compilation_cache, true, "enable compilation cache") ...@@ -666,6 +667,9 @@ DEFINE_BOOL(compilation_cache, true, "enable compilation cache")
DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions") DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
// compiler-dispatcher.cc
DEFINE_BOOL(compiler_dispatcher, false, "enable compiler dispatcher")
// cpu-profiler.cc // cpu-profiler.cc
DEFINE_INT(cpu_profiler_sampling_interval, 1000, DEFINE_INT(cpu_profiler_sampling_interval, 1000,
"CPU profiler sampling interval in microseconds") "CPU profiler sampling interval in microseconds")
......
...@@ -16,7 +16,30 @@ ...@@ -16,7 +16,30 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
typedef TestWithContext CompilerDispatcherTest; class CompilerDispatcherTest : public TestWithContext {
public:
CompilerDispatcherTest() = default;
~CompilerDispatcherTest() override = default;
static void SetUpTestCase() {
old_flag_ = i::FLAG_ignition;
i::FLAG_ignition = true;
i::FLAG_compiler_dispatcher = true;
TestWithContext::SetUpTestCase();
}
static void TearDownTestCase() {
TestWithContext::TearDownTestCase();
i::FLAG_ignition = old_flag_;
}
private:
static bool old_flag_;
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherTest);
};
bool CompilerDispatcherTest::old_flag_;
namespace { namespace {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment