[compiler] Ship Ignition for all TurboFan code.

This enables Ignition unconditionally for all code that is destined for
optimization with TurboFan. This ensures all optimization attempts will
go through the BytecodeGraphBuilder and that the AstGraphBuilder pipe is
dried out in practice.

R=mvstanton@chromium.org

Review-Url: https://chromiumcodereview.appspot.com/2427953002
Cr-Commit-Position: refs/heads/master@{#40462}
This commit is contained in:
mstarzinger 2016-10-20 03:57:19 -07:00 committed by Commit bot
parent e75d6885cd
commit 20d29ff036
18 changed files with 92 additions and 91 deletions

View File

@ -2258,11 +2258,10 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
source->info->set_script(script); source->info->set_script(script);
{ {
// Create a canonical handle scope if compiling ignition bytecode. This is // Create a canonical handle scope for compiling Ignition bytecode. This is
// required by the constant array builder to de-duplicate objects without // required by the constant array builder to de-duplicate objects without
// dereferencing handles. // dereferencing handles.
std::unique_ptr<i::CanonicalHandleScope> canonical; i::CanonicalHandleScope canonical(isolate);
if (i::FLAG_ignition) canonical.reset(new i::CanonicalHandleScope(isolate));
// Do the parsing tasks which need to be done on the main thread. This will // Do the parsing tasks which need to be done on the main thread. This will
// also handle parse errors. // also handle parse errors.

View File

@ -4061,7 +4061,7 @@ bool Genesis::InstallExtensions(Handle<Context> native_context,
InstallExtension(isolate, "v8/statistics", &extension_states)) && InstallExtension(isolate, "v8/statistics", &extension_states)) &&
(!FLAG_expose_trigger_failure || (!FLAG_expose_trigger_failure ||
InstallExtension(isolate, "v8/trigger-failure", &extension_states)) && InstallExtension(isolate, "v8/trigger-failure", &extension_states)) &&
(!(FLAG_ignition && FLAG_trace_ignition_dispatches) || (!FLAG_trace_ignition_dispatches ||
InstallExtension(isolate, "v8/ignition-statistics", InstallExtension(isolate, "v8/ignition-statistics",
&extension_states)) && &extension_states)) &&
InstallRequestedExtensions(isolate, extensions, &extension_states); InstallRequestedExtensions(isolate, extensions, &extension_states);

View File

@ -151,11 +151,10 @@ bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
parse_info_->set_shared_info(shared_); parse_info_->set_shared_info(shared_);
{ {
// Create a canonical handle scope if compiling ignition bytecode. This is // Create a canonical handle scope for compiling Ignition bytecode. This
// required by the constant array builder to de-duplicate objects without // is required by the constant array builder to de-duplicate objects
// dereferencing handles. // without dereferencing handles.
std::unique_ptr<CanonicalHandleScope> canonical; CanonicalHandleScope canonical(isolate_);
if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_));
// Do the parsing tasks which need to be done on the main thread. This // Do the parsing tasks which need to be done on the main thread. This
// will also handle parse errors. // will also handle parse errors.

View File

@ -252,11 +252,10 @@ void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) {
namespace { namespace {
bool Parse(ParseInfo* info) { bool Parse(ParseInfo* info) {
// Create a canonical handle scope if compiling ignition bytecode. This is // Create a canonical handle scope for compiling Ignition bytecode. This is
// required by the constant array builder to de-duplicate objects without // required by the constant array builder to de-duplicate objects without
// dereferencing handles. // dereferencing handles.
std::unique_ptr<CanonicalHandleScope> canonical; CanonicalHandleScope canonical(info->isolate());
if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info->isolate()));
return Parser::ParseStatic(info); return Parser::ParseStatic(info);
} }
@ -314,21 +313,46 @@ void EnsureFeedbackMetadata(CompilationInfo* info) {
info->literal()->feedback_vector_spec())); info->literal()->feedback_vector_spec()));
} }
bool ShouldUseIgnition(CompilationInfo* info) { bool UseTurboFan(Handle<SharedFunctionInfo> shared) {
if (!FLAG_ignition) return false; bool optimization_disabled = shared->optimization_disabled();
bool dont_crankshaft = shared->dont_crankshaft();
// Check the enabling conditions for Turbofan.
// 1. "use asm" code.
bool is_turbofanable_asm =
FLAG_turbo_asm && shared->asm_function() && !optimization_disabled;
// 2. Fallback for features unsupported by Crankshaft.
bool is_unsupported_by_crankshaft_but_turbofanable =
dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 &&
!optimization_disabled;
// 3. Explicitly enabled by the command-line filter.
bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter);
return is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable ||
passes_turbo_filter;
}
bool ShouldUseIgnition(CompilationInfo* info) {
DCHECK(info->has_shared_info()); DCHECK(info->has_shared_info());
// Skip Ignition for asm.js functions.
if (info->shared_info()->asm_function()) {
return false;
}
// When requesting debug code as a replacement for existing code, we provide // When requesting debug code as a replacement for existing code, we provide
// the same kind as the existing code (to prevent implicit tier-change). // the same kind as the existing code (to prevent implicit tier-change).
if (info->is_debug() && info->shared_info()->is_compiled()) { if (info->is_debug() && info->shared_info()->is_compiled()) {
return !info->shared_info()->HasBaselineCode(); return !info->shared_info()->HasBaselineCode();
} }
// Since we can't OSR from Ignition, skip Ignition for asm.js functions. // Code destined for TurboFan should be compiled with Ignition first.
if (info->shared_info()->asm_function()) { if (UseTurboFan(info->shared_info())) return true;
return false;
} // Only use Ignition for any other function if FLAG_ignition is true.
if (!FLAG_ignition) return false;
// Checks whether top level functions should be passed by the filter. // Checks whether top level functions should be passed by the filter.
if (info->shared_info()->is_toplevel()) { if (info->shared_info()->is_toplevel()) {
@ -492,13 +516,10 @@ void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
} }
bool Renumber(ParseInfo* parse_info) { bool Renumber(ParseInfo* parse_info) {
// Create a canonical handle scope if compiling ignition bytecode. This is // Create a canonical handle scope for compiling Ignition bytecode. This is
// required by the constant array builder to de-duplicate objects without // required by the constant array builder to de-duplicate objects without
// dereferencing handles. // dereferencing handles.
std::unique_ptr<CanonicalHandleScope> canonical; CanonicalHandleScope canonical(parse_info->isolate());
if (FLAG_ignition) {
canonical.reset(new CanonicalHandleScope(parse_info->isolate()));
}
if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(),
parse_info->literal())) { parse_info->literal())) {
@ -518,27 +539,6 @@ bool Renumber(ParseInfo* parse_info) {
return true; return true;
} }
bool UseTurboFan(Handle<SharedFunctionInfo> shared) {
bool optimization_disabled = shared->optimization_disabled();
bool dont_crankshaft = shared->dont_crankshaft();
// Check the enabling conditions for Turbofan.
// 1. "use asm" code.
bool is_turbofanable_asm =
FLAG_turbo_asm && shared->asm_function() && !optimization_disabled;
// 2. Fallback for features unsupported by Crankshaft.
bool is_unsupported_by_crankshaft_but_turbofanable =
dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 &&
!optimization_disabled;
// 3. Explicitly enabled by the command-line filter.
bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter);
return is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable ||
passes_turbo_filter;
}
bool GetOptimizedCodeNow(CompilationJob* job) { bool GetOptimizedCodeNow(CompilationJob* job) {
CompilationInfo* info = job->info(); CompilationInfo* info = job->info();
Isolate* isolate = info->isolate(); Isolate* isolate = info->isolate();

View File

@ -2788,7 +2788,7 @@ int Shell::Main(int argc, char* argv[]) {
RunShell(isolate); RunShell(isolate);
} }
if (i::FLAG_ignition && i::FLAG_trace_ignition_dispatches && if (i::FLAG_trace_ignition_dispatches &&
i::FLAG_trace_ignition_dispatches_output_file != nullptr) { i::FLAG_trace_ignition_dispatches_output_file != nullptr) {
WriteIgnitionDispatchCountersFile(isolate); WriteIgnitionDispatchCountersFile(isolate);
} }

View File

@ -439,8 +439,8 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
if (!marker->IsSmi()) { if (!marker->IsSmi()) {
if (maybe_function->IsSmi()) { if (maybe_function->IsSmi()) {
return NONE; return NONE;
} else if (FLAG_ignition && IsInterpreterFramePc(iterator->isolate(), } else if (IsInterpreterFramePc(iterator->isolate(),
*(state->pc_address))) { *(state->pc_address))) {
return INTERPRETED; return INTERPRETED;
} else { } else {
return JAVA_SCRIPT; return JAVA_SCRIPT;

View File

@ -1632,7 +1632,7 @@ class MarkCompactCollector::EvacuateVisitorBase
DCHECK_OBJECT_SIZE(size); DCHECK_OBJECT_SIZE(size);
DCHECK(IsAligned(size, kPointerSize)); DCHECK(IsAligned(size, kPointerSize));
heap_->CopyBlock(dst_addr, src_addr, size); heap_->CopyBlock(dst_addr, src_addr, size);
if ((mode == kProfiled) && FLAG_ignition && dst->IsBytecodeArray()) { if ((mode == kProfiled) && dst->IsBytecodeArray()) {
PROFILE(heap_->isolate(), PROFILE(heap_->isolate(),
CodeMoveEvent(AbstractCode::cast(src), dst_addr)); CodeMoveEvent(AbstractCode::cast(src), dst_addr));
} }

View File

@ -242,9 +242,8 @@ SharedFunctionInfo* IC::GetSharedFunctionInfo() const {
// corresponding to the frame. // corresponding to the frame.
StackFrameIterator it(isolate()); StackFrameIterator it(isolate());
while (it.frame()->fp() != this->fp()) it.Advance(); while (it.frame()->fp() != this->fp()) it.Advance();
if (FLAG_ignition && it.frame()->type() == StackFrame::STUB) { if (it.frame()->type() == StackFrame::STUB) {
// Advance over bytecode handler frame. // We might need to advance over bytecode handler frame for Ignition.
// TODO(rmcilroy): Remove this once bytecode handlers don't need a frame.
it.Advance(); it.Advance();
} }
JavaScriptFrame* frame = JavaScriptFrame::cast(it.frame()); JavaScriptFrame* frame = JavaScriptFrame::cast(it.frame());

View File

@ -2535,9 +2535,7 @@ bool Isolate::Init(Deserializer* des) {
} }
load_stub_cache_->Initialize(); load_stub_cache_->Initialize();
store_stub_cache_->Initialize(); store_stub_cache_->Initialize();
if (FLAG_ignition || serializer_enabled()) { interpreter_->Initialize();
interpreter_->Initialize();
}
heap_.NotifyDeserializationComplete(); heap_.NotifyDeserializationComplete();
} }

View File

@ -1484,8 +1484,6 @@ void Logger::LogCodeObjects() {
} }
void Logger::LogBytecodeHandlers() { void Logger::LogBytecodeHandlers() {
if (!FLAG_ignition) return;
const interpreter::OperandScale kOperandScales[] = { const interpreter::OperandScale kOperandScales[] = {
#define VALUE(Name, _) interpreter::OperandScale::k##Name, #define VALUE(Name, _) interpreter::OperandScale::k##Name,
OPERAND_SCALE_LIST(VALUE) OPERAND_SCALE_LIST(VALUE)

View File

@ -335,20 +335,30 @@
}], # 'arch == ppc64 and simulator_run == True' }], # 'arch == ppc64 and simulator_run == True'
##############################################################################
['variant == turbofan', {
# TurboFan cpu profiler result is different.
'test-cpu-profiler/CollectDeoptEvents': [FAIL],
'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL],
'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL],
}], # variant == turbofan
############################################################################## ##############################################################################
['variant == turbofan_opt', { ['variant == turbofan_opt', {
# BUG(5193): Flaky. # TODO(mythria,4680): Lack of code-ageing in interpreter.
'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], 'test-heap/Regress169209': [FAIL],
# TODO(mythria,4680): Lack of code-ageing and/or lack of compilation cache
# in interpreter.
'test-heap/CompilationCacheCachingBehavior': [FAIL],
# TODO(mstarzinger): Triggers Ignition+TurboFan on everything now and makes
# the stack traces within the profilers look different. Needs investigation.
'test-api/SetFunctionEntryHook': [SKIP],
'test-cpu-profiler/BoundFunctionCall': [FAIL],
'test-cpu-profiler/CollectSampleAPI': [FAIL],
'test-cpu-profiler/FunctionApplySample': [FAIL],
'test-cpu-profiler/FunctionCallSample': [FAIL],
'test-cpu-profiler/JsNativeJsRuntimeJsSample': [FAIL],
'test-cpu-profiler/JsNativeJsSample': [FAIL],
'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [FAIL],
'test-cpu-profiler/JsNative1JsNative2JsSample': [FAIL],
'test-cpu-profiler/NativeMethodUninitializedIC': [FAIL],
'test-cpu-profiler/NativeAccessorUninitializedIC': [FAIL],
'test-profile-generator/LineNumber': [FAIL],
'test-sampler-api/StackFramesConsistent': [FAIL],
}], # variant == turbofan_opt }], # variant == turbofan_opt
############################################################################## ##############################################################################
@ -397,7 +407,7 @@
}], # variant == ignition_staging }], # variant == ignition_staging
############################################################################## ##############################################################################
['variant == ignition_turbofan', { ['variant == turbofan or variant == ignition_turbofan', {
# TODO(rmcilroy,4680): Related to lack of code flushing. Check failed: !function->shared()->is_compiled() || function->IsOptimized(). # TODO(rmcilroy,4680): Related to lack of code flushing. Check failed: !function->shared()->is_compiled() || function->IsOptimized().
'test-heap/TestCodeFlushingPreAged': [FAIL], 'test-heap/TestCodeFlushingPreAged': [FAIL],
'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL],
@ -425,7 +435,7 @@
# BUG(5193): Flaky. # BUG(5193): Flaky.
'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]],
}], # variant == ignition_turbofan }], # variant == turbofan or variant == ignition_turbofan
############################################################################## ##############################################################################
['variant != ignition and variant != ignition_staging and variant != ignition_turbofan', { ['variant != ignition and variant != ignition_staging and variant != ignition_turbofan', {

View File

@ -2657,8 +2657,8 @@ TEST(InstanceOfStubWriteBarrier) {
namespace { namespace {
int GetProfilerTicks(SharedFunctionInfo* shared) { int GetProfilerTicks(SharedFunctionInfo* shared) {
return FLAG_ignition ? shared->profiler_ticks() return FLAG_ignition || FLAG_turbo ? shared->profiler_ticks()
: shared->code()->profiler_ticks(); : shared->code()->profiler_ticks();
} }
} // namespace } // namespace

View File

@ -14581,7 +14581,7 @@ void SetFunctionEntryHookTest::RunTest() {
RunLoopInNewEnv(isolate); RunLoopInNewEnv(isolate);
// Check the expected invocation counts. // Check the expected invocation counts.
if (!i::FLAG_ignition) { if (!i::FLAG_ignition && !i::FLAG_turbo) {
CHECK_EQ(2, CountInvocations(NULL, "bar")); CHECK_EQ(2, CountInvocations(NULL, "bar"));
CHECK_EQ(200, CountInvocations("bar", "foo")); CHECK_EQ(200, CountInvocations("bar", "foo"));
CHECK_EQ(200, CountInvocations(NULL, "foo")); CHECK_EQ(200, CountInvocations(NULL, "foo"));
@ -14822,8 +14822,9 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) {
for (int i = 0; i < kIterations; ++i) { for (int i = 0; i < kIterations; ++i) {
LocalContext env(isolate); LocalContext env(isolate);
i::AlwaysAllocateScope always_allocate(i_isolate); i::AlwaysAllocateScope always_allocate(i_isolate);
i::heap::SimulateFullSpace(i::FLAG_ignition ? heap->old_space() i::heap::SimulateFullSpace(i::FLAG_ignition || i::FLAG_turbo
: heap->code_space()); ? heap->old_space()
: heap->code_space());
CompileRun(script); CompileRun(script);
// Keep a strong reference to the code object in the handle scope. // Keep a strong reference to the code object in the handle scope.
@ -21804,7 +21805,7 @@ void TestStubCache(bool primary) {
// The test does not work with interpreter because bytecode handlers taken // The test does not work with interpreter because bytecode handlers taken
// from the snapshot already refer to ICs with disabled counters and there // from the snapshot already refer to ICs with disabled counters and there
// is no way to trigger bytecode handlers recompilation. // is no way to trigger bytecode handlers recompilation.
if (i::FLAG_ignition) return; if (i::FLAG_ignition || i::FLAG_turbo) return;
i::FLAG_native_code_counters = true; i::FLAG_native_code_counters = true;
if (primary) { if (primary) {

View File

@ -322,9 +322,10 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) {
// of the full code. // of the full code.
CHECK(f->IsOptimized()); CHECK(f->IsOptimized());
// If the baseline code is bytecode, then it will not have deoptimization // If the baseline code is bytecode, then it will not have deoptimization
// support. has_deoptimization_support() check is only required if the // support. The has_deoptimization_support() check is only required if the
// baseline code is from fullcodegen. // baseline code is from fullcodegen.
CHECK(f->shared()->has_deoptimization_support() || i::FLAG_ignition); CHECK(f->shared()->has_deoptimization_support() || i::FLAG_ignition ||
i::FLAG_turbo);
object = f->feedback_vector()->Get(slot_for_a); object = f->feedback_vector()->Get(slot_for_a);
CHECK(object->IsWeakCell() && CHECK(object->IsWeakCell() &&
WeakCell::cast(object)->value()->IsJSFunction()); WeakCell::cast(object)->value()->IsJSFunction());

View File

@ -81,9 +81,8 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) {
frame_iterator.Advance(); frame_iterator.Advance();
CHECK(frame_iterator.frame()->is_construct()); CHECK(frame_iterator.frame()->is_construct());
frame_iterator.Advance(); frame_iterator.Advance();
if (i::FLAG_ignition) { if (frame_iterator.frame()->type() == i::StackFrame::STUB) {
// Skip over bytecode handler frame. // Skip over bytecode handler frame.
CHECK(frame_iterator.frame()->type() == i::StackFrame::STUB);
frame_iterator.Advance(); frame_iterator.Advance();
} }
i::StackFrame* calling_frame = frame_iterator.frame(); i::StackFrame* calling_frame = frame_iterator.frame();

View File

@ -1678,7 +1678,7 @@ TEST(CodeSerializerInternalReference) {
// In ignition there are only relative jumps, so the following code // In ignition there are only relative jumps, so the following code
// would not have any internal references. This test is not relevant // would not have any internal references. This test is not relevant
// for ignition. // for ignition.
if (FLAG_ignition) { if (FLAG_ignition || FLAG_turbo) {
return; return;
} }
// Disable experimental natives that are loaded after deserialization. // Disable experimental natives that are loaded after deserialization.
@ -1762,7 +1762,7 @@ TEST(CodeSerializerInternalReference) {
} }
TEST(CodeSerializerEagerCompilationAndPreAge) { TEST(CodeSerializerEagerCompilationAndPreAge) {
if (FLAG_ignition) return; if (FLAG_ignition || FLAG_turbo) return;
FLAG_lazy = true; FLAG_lazy = true;
FLAG_serialize_toplevel = true; FLAG_serialize_toplevel = true;

View File

@ -59,6 +59,10 @@
# not work, but we expect it to not crash. # not work, but we expect it to not crash.
'debug-step-turbofan': [PASS, FAIL], 'debug-step-turbofan': [PASS, FAIL],
# Issue 4680: The eval'ed code is piped through Ignition and fails when being
# live edited. This needs investigation.
'debug-liveedit-double-call': [PASS, FAIL],
############################################################################## ##############################################################################
# Too slow in debug mode with --stress-opt mode. # Too slow in debug mode with --stress-opt mode.
'regress/regress-2318': [PASS, ['mode == debug', SKIP]], 'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
@ -618,14 +622,6 @@
'unicode-test': [SKIP], 'unicode-test': [SKIP],
}], # variant == stress }], # variant == stress
##############################################################################
['variant == turbofan', {
# Assumptions about optimization need investigation in TurboFan.
'regress-sync-optimized-lists': [FAIL],
}], # variant == turbofan
############################################################################## ##############################################################################
['variant == turbofan_opt', { ['variant == turbofan_opt', {
@ -637,6 +633,7 @@
'debug-evaluate-locals-optimized-double': [FAIL], 'debug-evaluate-locals-optimized-double': [FAIL],
'debug-liveedit-double-call': [FAIL], 'debug-liveedit-double-call': [FAIL],
'es6/debug-evaluate-blockscopes': [FAIL], 'es6/debug-evaluate-blockscopes': [FAIL],
'ignition/debug-break-on-stack': [FAIL],
# TODO(jgruber): Fails in --turbo --always-opt mode. # TODO(jgruber): Fails in --turbo --always-opt mode.
'regress/regress-105': [FAIL], 'regress/regress-105': [FAIL],

View File

@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
// TODO (mtrofin): re-enable ignition (v8:5345) // TODO (mtrofin): re-enable ignition (v8:5345)
// Flags: --no-ignition --no-ignition-staging // Flags: --no-turbo --no-ignition --no-ignition-staging
// Flags: --expose-wasm --expose-gc --allow-natives-syntax // Flags: --expose-wasm --expose-gc --allow-natives-syntax
load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-constants.js");