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

Unified Diff: src/hydrogen.cc

Issue 7033020: When inlining fails, disable optimization of the proper function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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 | « src/hydrogen.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index f7a6ce91d0a8d4d9a6edaedc470760aefdf4c764..77f56628042271c172e36445e65bd0e387a97786 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -521,6 +521,22 @@ HConstant* HGraph::GetConstantFalse() {
return GetConstant(&constant_false_, isolate()->heap()->false_value());
}
+HGraphBuilder::HGraphBuilder(CompilationInfo* info,
+ TypeFeedbackOracle* oracle)
+ : function_state_(NULL),
+ initial_function_state_(this, info, oracle),
+ ast_context_(NULL),
+ break_scope_(NULL),
+ graph_(NULL),
+ current_block_(NULL),
+ inlined_count_(0),
+ zone_(info->isolate()->zone()),
+ inline_bailout_(false) {
+ // This is not initialized in the initializer list because the
+ // constructor for the initial state relies on function_state_ == NULL
+ // to know it's the initial state.
+ function_state_= &initial_function_state_;
+}
HBasicBlock* HGraphBuilder::CreateJoin(HBasicBlock* first,
HBasicBlock* second,
@@ -4046,10 +4062,11 @@ bool HGraphBuilder::TryInline(Call* expr) {
// Precondition: call is monomorphic and we have found a target with the
// appropriate arity.
Handle<JSFunction> target = expr->target();
+ Handle<SharedFunctionInfo> target_shared(target->shared());
// Do a quick check on source code length to avoid parsing large
// inlining candidates.
- if (FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize) {
+ if (FLAG_limit_inlining && target_shared->SourceSize() > kMaxSourceSize) {
TraceInline(target, "target text too big");
return false;
}
@@ -4082,7 +4099,7 @@ bool HGraphBuilder::TryInline(Call* expr) {
}
// Don't inline recursive functions.
- if (target->shared() == outer_info->closure()->shared()) {
+ if (*target_shared == outer_info->closure()->shared()) {
TraceInline(target, "target is recursive");
return false;
}
@@ -4102,7 +4119,7 @@ bool HGraphBuilder::TryInline(Call* expr) {
if (target_info.isolate()->has_pending_exception()) {
// Parse or scope error, never optimize this function.
SetStackOverflow();
- target->shared()->set_optimization_disabled(true);
+ target_shared->DisableOptimization(*target);
}
TraceInline(target, "parse failure");
return false;
@@ -4131,7 +4148,6 @@ bool HGraphBuilder::TryInline(Call* expr) {
// Don't inline functions that uses the arguments object or that
// have a mismatching number of parameters.
- Handle<SharedFunctionInfo> target_shared(target->shared());
int arity = expr->arguments()->length();
if (function->scope()->arguments() != NULL ||
arity != target_shared->formal_parameter_count()) {
@@ -4189,6 +4205,8 @@ bool HGraphBuilder::TryInline(Call* expr) {
// Bail out if the inline function did, as we cannot residualize a call
// instead.
TraceInline(target, "inline graph construction failed");
+ target_shared->DisableOptimization(*target);
+ inline_bailout_ = true;
return true;
}
« no previous file with comments | « src/hydrogen.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698