[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/527443
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45803}
This commit is contained in:
Michael Starzinger 2017-06-08 18:23:27 +02:00 committed by Commit Bot
parent 38a3e0741b
commit c0bf6ee331
3 changed files with 14 additions and 11 deletions

View File

@ -899,26 +899,24 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
VMState<COMPILER> state(isolate);
DCHECK(!isolate->has_pending_exception());
PostponeInterruptsScope postpone(isolate);
bool use_turbofan = UseTurboFan(shared) || ignition_osr;
bool has_script = shared->script()->IsScript();
// BUG(5946): This DCHECK is necessary to make certain that we won't tolerate
// the lack of a script without bytecode.
DCHECK_IMPLIES(!has_script, ShouldUseIgnition(shared, false));
std::unique_ptr<CompilationJob> job(
use_turbofan ? compiler::Pipeline::NewCompilationJob(function, has_script)
: new HCompilationJob(function));
compiler::Pipeline::NewCompilationJob(function, has_script));
CompilationInfo* info = job->info();
ParseInfo* parse_info = info->parse_info();
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()) {
info->AbortOptimization(kFunctionBeingDebugged);
return MaybeHandle<Code>();
}
// Do not use Crankshaft/TurboFan when %NeverOptimizeFunction was applied.
// Do not use TurboFan when %NeverOptimizeFunction was applied.
if (shared->optimization_disabled() &&
shared->disable_optimization_reason() == kOptimizationDisabledForTest) {
info->AbortOptimization(kOptimizationDisabledForTest);
@ -933,12 +931,18 @@ 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");
// TurboFan can optimize directly from existing bytecode.
if (use_turbofan && ShouldUseIgnition(info)) {
if (ShouldUseIgnition(info)) {
DCHECK(shared->HasBytecodeArray());
info->MarkAsOptimizeFromBytecode();
}
@ -961,9 +965,8 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
compilation.reset(new CompilationHandleScope(info));
}
// In case of TurboFan, all handles below will be canonicalized.
std::unique_ptr<CanonicalHandleScope> canonical;
if (use_turbofan) canonical.reset(new CanonicalHandleScope(info->isolate()));
// All handles below will be canonicalized.
CanonicalHandleScope canonical(info->isolate());
// Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope();

View File

@ -731,7 +731,7 @@ TEST(BailoutReason) {
// The tree should look like this:
// (root)
// ""
// kFunctionBeingDebugged
// kDeoptimizedTooManyTimes
current = PickChild(current, "");
CHECK(const_cast<v8::CpuProfileNode*>(current));

View File

@ -550,7 +550,7 @@ var failWithMessage;
assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) {
if (sync_opt === undefined) 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.
assertFalse((opt_status & V8OptimizationStatus.kAlwaysOptimize) !== 0,
"test does not make sense with --always-opt");