Commit 632221ac authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Compiler] Remove unnecessary UseTurboFan function and turbo_asm flag.

These are no longer necessary since we only have one optimizing compiler.
Also avoid changing --turbo-filter when --no-opt is set, and instead
explicitly check both the FLAG_opt and FLAG_turbo_filter in 
GetOptimizedCode to check whether optimization is disabled.

BUG=v8:6408

Change-Id: I0948f788e8ff111c08022270d86c22f848da300a
Reviewed-on: https://chromium-review.googlesource.com/568484
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46648}
parent af57d316
......@@ -266,17 +266,6 @@ void EnsureFeedbackMetadata(CompilationInfo* info) {
info->literal()->feedback_vector_spec()));
}
bool UseTurboFan(Handle<SharedFunctionInfo> shared) {
// Check the enabling conditions for Turbofan.
// 1. "use asm" code.
bool is_turbofanable_asm = FLAG_turbo_asm && shared->asm_function();
// 2. Explicitly enabled by the command-line filter.
bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter);
return is_turbofanable_asm || passes_turbo_filter;
}
bool ShouldUseFullCodegen(Handle<SharedFunctionInfo> shared) {
// Code which can't be supported by the old pipeline should use Ignition.
if (shared->must_use_ignition()) return false;
......@@ -783,6 +772,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
bool ignition_osr = osr_frame && osr_frame->is_interpreted();
USE(ignition_osr);
DCHECK_IMPLIES(ignition_osr, !osr_ast_id.IsNone());
DCHECK_IMPLIES(ignition_osr, FLAG_ignition_osr);
......@@ -837,6 +827,13 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
return MaybeHandle<Code>();
}
// Do not use TurboFan if optimization is disabled or function doesn't pass
// turbo_filter.
if (!FLAG_opt || !shared->PassesFilter(FLAG_turbo_filter)) {
info->AbortOptimization(kOptimizationDisabled);
return MaybeHandle<Code>();
}
// Limit the number of times we try to optimize functions.
const int kMaxDeoptCount =
FLAG_deopt_every_n_times == 0 ? FLAG_max_deopt_count : 1000;
......@@ -845,12 +842,6 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
return MaybeHandle<Code>();
}
// Do not use TurboFan if activation criteria are not met.
if (!UseTurboFan(shared) && !ignition_osr) {
info->AbortOptimization(kOptimizationDisabled);
return MaybeHandle<Code>();
}
TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
......
......@@ -427,7 +427,6 @@ DEFINE_BOOL(trace_turbo_trimming, false, "trace TurboFan's graph trimmer")
DEFINE_BOOL(trace_turbo_jt, false, "trace TurboFan's jump threading")
DEFINE_BOOL(trace_turbo_ceq, false, "trace TurboFan's control equivalence")
DEFINE_BOOL(trace_turbo_loop, false, "trace TurboFan's loop optimizations")
DEFINE_BOOL(turbo_asm, true, "enable TurboFan for asm.js code")
DEFINE_BOOL(turbo_verify, DEBUG_BOOL, "verify TurboFan graphs at each phase")
DEFINE_STRING(turbo_verify_machine_graph, nullptr,
"verify TurboFan machine graph before instruction selection")
......
......@@ -66,11 +66,6 @@ void V8::InitializeOncePerProcessImpl() {
FLAG_max_semi_space_size = 1;
}
if (!FLAG_opt && strcmp(FLAG_turbo_filter, "*") == 0) {
const char* filter_flag = "--turbo-filter=~";
FlagList::SetFlagsFromString(filter_flag, StrLength(filter_flag));
}
base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap);
Isolate::InitializeOncePerProcess();
......
......@@ -25356,11 +25356,11 @@ TEST(StringConcatOverflow) {
TEST(TurboAsmDisablesNeuter) {
i::FLAG_opt = true;
i::FLAG_allow_natives_syntax = true;
v8::V8::Initialize();
v8::HandleScope scope(CcTest::isolate());
LocalContext context;
bool should_be_neuterable = !i::FLAG_turbo_asm;
const char* load =
"function Module(stdlib, foreign, heap) {"
" 'use asm';"
......@@ -25375,7 +25375,7 @@ TEST(TurboAsmDisablesNeuter) {
"buffer";
v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>();
CHECK_EQ(should_be_neuterable, result->IsNeuterable());
CHECK(!result->IsNeuterable());
const char* store =
"function Module(stdlib, foreign, heap) {"
......@@ -25391,7 +25391,7 @@ TEST(TurboAsmDisablesNeuter) {
"buffer";
result = CompileRun(store).As<v8::ArrayBuffer>();
CHECK_EQ(should_be_neuterable, result->IsNeuterable());
CHECK(!result->IsNeuterable());
}
......
......@@ -695,6 +695,7 @@ TEST(LineNumber) {
TEST(BailoutReason) {
i::FLAG_allow_natives_syntax = true;
i::FLAG_always_opt = false;
i::FLAG_opt = true;
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
v8::Context::Scope context_scope(env);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --turbo-asm
// Flags: --allow-natives-syntax
var foo = (function(stdlib) {
"use asm";
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --turbo-asm
// Flags: --allow-natives-syntax
"use asm";
......
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