Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: src/compiler.cc

Issue 1110573002: Allow TurboFan to compile more methods. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/lithium.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698