Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index f7771f8b606fb4facafa5ddbaa704490776c3c9c..bf7702be4f51558e920372fb4bd90d9942a36e33 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -304,21 +304,46 @@ void EnsureFeedbackMetadata(CompilationInfo* info) { |
info->literal()->feedback_vector_spec())); |
} |
-bool ShouldUseIgnition(CompilationInfo* info) { |
- if (!FLAG_ignition) return false; |
+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 ShouldUseIgnition(CompilationInfo* 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 |
// the same kind as the existing code (to prevent implicit tier-change). |
if (info->is_debug() && info->shared_info()->is_compiled()) { |
return !info->shared_info()->HasBaselineCode(); |
} |
- // Since we can't OSR from Ignition, skip Ignition for asm.js functions. |
- if (info->shared_info()->asm_function()) { |
- return false; |
- } |
+ // Code destined for TurboFan should be compiled with Ignition first. |
+ if (UseTurboFan(info->shared_info())) return true; |
+ |
+ // 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. |
if (info->shared_info()->is_toplevel()) { |
@@ -500,27 +525,6 @@ bool Renumber(ParseInfo* parse_info) { |
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) { |
CompilationInfo* info = job->info(); |
Isolate* isolate = info->isolate(); |