Reland "Disable the CompilerDispatcher if we don't have idle time"
Original issue's description: > 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} > Committed: https://chromium.googlesource.com/v8/v8/+/a0d9eb346bba90aa0b32a 2d3184cbbfd6adb243e BUG=v8:5215 Review-Url: https://codereview.chromium.org/2606233002 Cr-Commit-Position: refs/heads/master@{#42009}
This commit is contained in:
parent
b617335623
commit
09cb6efd58
@ -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;
|
||||
|
@ -61,6 +61,7 @@ class V8_EXPORT_PRIVATE CompilerDispatcher {
|
||||
JobMap;
|
||||
class IdleTask;
|
||||
|
||||
bool IsEnabled() const;
|
||||
JobMap::const_iterator GetJobFor(Handle<SharedFunctionInfo> shared) const;
|
||||
void ScheduleIdleTaskIfNeeded();
|
||||
void DoIdleWork(double deadline_in_seconds);
|
||||
|
@ -300,6 +300,7 @@ DEFINE_BOOL(string_slices, true, "use string slices")
|
||||
DEFINE_BOOL(ignition, false, "use ignition interpreter")
|
||||
DEFINE_BOOL(ignition_staging, false, "use ignition with all staged features")
|
||||
DEFINE_IMPLICATION(ignition_staging, ignition)
|
||||
DEFINE_IMPLICATION(ignition_staging, compiler_dispatcher)
|
||||
DEFINE_STRING(ignition_filter, "*", "filter for ignition interpreter")
|
||||
DEFINE_BOOL(ignition_deadcode, true,
|
||||
"use ignition dead code elimination optimizer")
|
||||
@ -666,6 +667,9 @@ DEFINE_BOOL(compilation_cache, true, "enable compilation cache")
|
||||
|
||||
DEFINE_BOOL(cache_prototype_transitions, true, "cache prototype transitions")
|
||||
|
||||
// compiler-dispatcher.cc
|
||||
DEFINE_BOOL(compiler_dispatcher, false, "enable compiler dispatcher")
|
||||
|
||||
// cpu-profiler.cc
|
||||
DEFINE_INT(cpu_profiler_sampling_interval, 1000,
|
||||
"CPU profiler sampling interval in microseconds")
|
||||
|
@ -16,7 +16,29 @@
|
||||
namespace v8 {
|
||||
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_compiler_dispatcher = true;
|
||||
TestWithContext::SetUpTestCase();
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
TestWithContext::TearDownTestCase();
|
||||
i::FLAG_compiler_dispatcher = old_flag_;
|
||||
}
|
||||
|
||||
private:
|
||||
static bool old_flag_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CompilerDispatcherTest);
|
||||
};
|
||||
|
||||
bool CompilerDispatcherTest::old_flag_;
|
||||
|
||||
namespace {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user