Commit c0bf6ee3 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[compiler] Unplug Crankshaft from compilation pipeline.

This removes the ability of the compilation pipeline to invoke the
Crankshaft optimizing compiler for JavaScript functions. Note that in
this state Crankshaft can still be used to compile code stubs.

R=rmcilroy@chromium.org
BUG=v8:6408

Change-Id: I0bec7c8ec7c705c13257df43796403a228ea631c
Reviewed-on: https://chromium-review.googlesource.com/527443Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45803}
parent 38a3e074
...@@ -899,26 +899,24 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, ...@@ -899,26 +899,24 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
VMState<COMPILER> state(isolate); VMState<COMPILER> state(isolate);
DCHECK(!isolate->has_pending_exception()); DCHECK(!isolate->has_pending_exception());
PostponeInterruptsScope postpone(isolate); PostponeInterruptsScope postpone(isolate);
bool use_turbofan = UseTurboFan(shared) || ignition_osr;
bool has_script = shared->script()->IsScript(); bool has_script = shared->script()->IsScript();
// BUG(5946): This DCHECK is necessary to make certain that we won't tolerate // BUG(5946): This DCHECK is necessary to make certain that we won't tolerate
// the lack of a script without bytecode. // the lack of a script without bytecode.
DCHECK_IMPLIES(!has_script, ShouldUseIgnition(shared, false)); DCHECK_IMPLIES(!has_script, ShouldUseIgnition(shared, false));
std::unique_ptr<CompilationJob> job( std::unique_ptr<CompilationJob> job(
use_turbofan ? compiler::Pipeline::NewCompilationJob(function, has_script) compiler::Pipeline::NewCompilationJob(function, has_script));
: new HCompilationJob(function));
CompilationInfo* info = job->info(); CompilationInfo* info = job->info();
ParseInfo* parse_info = info->parse_info(); ParseInfo* parse_info = info->parse_info();
info->SetOptimizingForOsr(osr_ast_id, osr_frame); info->SetOptimizingForOsr(osr_ast_id, osr_frame);
// Do not use Crankshaft/TurboFan if we need to be able to set break points. // Do not use TurboFan if we need to be able to set break points.
if (info->shared_info()->HasBreakInfo()) { if (info->shared_info()->HasBreakInfo()) {
info->AbortOptimization(kFunctionBeingDebugged); info->AbortOptimization(kFunctionBeingDebugged);
return MaybeHandle<Code>(); return MaybeHandle<Code>();
} }
// Do not use Crankshaft/TurboFan when %NeverOptimizeFunction was applied. // Do not use TurboFan when %NeverOptimizeFunction was applied.
if (shared->optimization_disabled() && if (shared->optimization_disabled() &&
shared->disable_optimization_reason() == kOptimizationDisabledForTest) { shared->disable_optimization_reason() == kOptimizationDisabledForTest) {
info->AbortOptimization(kOptimizationDisabledForTest); info->AbortOptimization(kOptimizationDisabledForTest);
...@@ -933,12 +931,18 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, ...@@ -933,12 +931,18 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
return MaybeHandle<Code>(); 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); TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
// TurboFan can optimize directly from existing bytecode. // TurboFan can optimize directly from existing bytecode.
if (use_turbofan && ShouldUseIgnition(info)) { if (ShouldUseIgnition(info)) {
DCHECK(shared->HasBytecodeArray()); DCHECK(shared->HasBytecodeArray());
info->MarkAsOptimizeFromBytecode(); info->MarkAsOptimizeFromBytecode();
} }
...@@ -961,9 +965,8 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, ...@@ -961,9 +965,8 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
compilation.reset(new CompilationHandleScope(info)); compilation.reset(new CompilationHandleScope(info));
} }
// In case of TurboFan, all handles below will be canonicalized. // All handles below will be canonicalized.
std::unique_ptr<CanonicalHandleScope> canonical; CanonicalHandleScope canonical(info->isolate());
if (use_turbofan) canonical.reset(new CanonicalHandleScope(info->isolate()));
// Reopen handles in the new CompilationHandleScope. // Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope(); info->ReopenHandlesInNewHandleScope();
......
...@@ -731,7 +731,7 @@ TEST(BailoutReason) { ...@@ -731,7 +731,7 @@ TEST(BailoutReason) {
// The tree should look like this: // The tree should look like this:
// (root) // (root)
// "" // ""
// kFunctionBeingDebugged // kDeoptimizedTooManyTimes
current = PickChild(current, ""); current = PickChild(current, "");
CHECK(const_cast<v8::CpuProfileNode*>(current)); CHECK(const_cast<v8::CpuProfileNode*>(current));
......
...@@ -550,7 +550,7 @@ var failWithMessage; ...@@ -550,7 +550,7 @@ var failWithMessage;
assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) { assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) {
if (sync_opt === undefined) sync_opt = ""; if (sync_opt === undefined) sync_opt = "";
var opt_status = OptimizationStatus(fun, sync_opt); var opt_status = OptimizationStatus(fun, sync_opt);
// Tests that use assertOptimized() do not make sense if --always-opt // Tests that use assertUnoptimized() do not make sense if --always-opt
// option is provided. Such tests must add --no-always-opt to flags comment. // option is provided. Such tests must add --no-always-opt to flags comment.
assertFalse((opt_status & V8OptimizationStatus.kAlwaysOptimize) !== 0, assertFalse((opt_status & V8OptimizationStatus.kAlwaysOptimize) !== 0,
"test does not make sense with --always-opt"); "test does not make sense with --always-opt");
......
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