Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 75349e99d2793205704b44f396a83e67f21702e6..036b8e52a1ddf675d166ea10c88b0e391cb263fc 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -322,33 +322,13 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
return RetryOptimization(kDebuggerHasBreakPoints); |
} |
- // Limit the number of times we re-compile a functions with |
- // the optimizing compiler. |
+ // Limit the number of times we try to optimize functions. |
const int kMaxOptCount = |
FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
if (info()->opt_count() > kMaxOptCount) { |
return AbortOptimization(kOptimizedTooManyTimes); |
} |
- // Due to an encoding limit on LUnallocated operands in the Lithium |
- // language, we cannot optimize functions with too many formal parameters |
- // or perform on-stack replacement for function with too many |
- // stack-allocated local variables. |
- // |
- // The encoding is as a signed value, with parameters and receiver using |
- // the negative indices and locals the non-negative ones. |
- const int parameter_limit = -LUnallocated::kMinFixedSlotIndex; |
- Scope* scope = info()->scope(); |
- if ((scope->num_parameters() + 1) > parameter_limit) { |
- return AbortOptimization(kTooManyParameters); |
- } |
- |
- const int locals_limit = LUnallocated::kMaxFixedSlotIndex; |
- if (info()->is_osr() && |
- scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { |
- return AbortOptimization(kTooManyParametersLocals); |
- } |
- |
// Check the whitelist for Crankshaft. |
if (!info()->closure()->PassesFilter(FLAG_hydrogen_filter)) { |
return AbortOptimization(kHydrogenFilter); |
@@ -379,6 +359,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || |
info()->closure()->PassesFilter(FLAG_turbo_filter)) && |
(FLAG_turbo_osr || !info()->is_osr())) { |
+ // Use TurboFan for the compilation. |
if (FLAG_trace_opt) { |
OFStream os(stdout); |
os << "[compiling method " << Brief(*info()->closure()) |
@@ -403,8 +384,23 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
} |
} |
- // Do not use Crankshaft if the code is intended to be serialized. |
- if (!isolate()->use_crankshaft()) return SetLastStatus(FAILED); |
+ if (!isolate()->use_crankshaft()) { |
+ // Crankshaft is entirely disabled. |
+ return SetLastStatus(FAILED); |
+ } |
+ |
+ Scope* scope = info()->scope(); |
+ if (LUnallocated::TooManyParameters(scope->num_parameters())) { |
+ // Crankshaft would require too many Lithium operands. |
+ return AbortOptimization(kTooManyParameters); |
+ } |
+ |
+ if (info()->is_osr() && |
+ LUnallocated::TooManyParametersOrStackSlots(scope->num_parameters(), |
+ scope->num_stack_slots())) { |
+ // Crankshaft would require too many Lithium operands. |
+ return AbortOptimization(kTooManyParametersLocals); |
+ } |
if (scope->HasIllegalRedeclaration()) { |
// Crankshaft cannot handle illegal redeclarations. |