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

Unified Diff: src/parser.cc

Issue 8677008: Relax inlining limits for simple leaf functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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
« src/hydrogen.cc ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index e19af1cd5cd3dd265633660544b675246588c17b..2207c04312b557645b0adff1f7b660f2cc4d8585 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -656,6 +656,8 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
scope->set_start_position(0);
scope->set_end_position(source->length());
FunctionState function_state(this, scope, isolate());
+ int ast_nodes_before = isolate()->ast_node_count();
+ int heavy_ast_nodes_before = isolate()->heavy_ast_node_count();
top_scope_->SetStrictModeFlag(info->strict_mode_flag());
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16);
bool ok = true;
@@ -669,6 +671,10 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
CheckConflictingVarDeclarations(scope, &ok);
}
+ int ast_nodes_added = isolate()->ast_node_count() - ast_nodes_before + 1;
+ bool is_primitive =
+ (isolate()->heavy_ast_node_count() - heavy_ast_nodes_before == 0);
+
if (ok) {
result = new(zone()) FunctionLiteral(
isolate(),
@@ -682,7 +688,9 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
function_state.this_property_assignments(),
0,
FunctionLiteral::ANONYMOUS_EXPRESSION,
- false); // Does not have duplicate parameters.
+ false, // Does not have duplicate parameters.
+ ast_nodes_added,
+ is_primitive);
} else if (stack_overflow_) {
isolate()->StackOverflow();
}
@@ -2183,7 +2191,7 @@ Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) {
stmt = ParseStatement(labels, CHECK_OK);
with_scope->set_end_position(scanner().location().end_pos);
}
- return new(zone()) WithStatement(expr, stmt);
+ return new(zone()) WithStatement(isolate(), expr, stmt);
}
@@ -2349,7 +2357,8 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
// If we have both, create an inner try/catch.
ASSERT(catch_scope != NULL && catch_variable != NULL);
int index = current_function_state_->NextHandlerIndex();
- TryCatchStatement* statement = new(zone()) TryCatchStatement(index,
+ TryCatchStatement* statement = new(zone()) TryCatchStatement(isolate(),
+ index,
try_block,
catch_scope,
catch_variable,
@@ -2365,7 +2374,8 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
ASSERT(finally_block == NULL);
ASSERT(catch_scope != NULL && catch_variable != NULL);
int index = current_function_state_->NextHandlerIndex();
- result = new(zone()) TryCatchStatement(index,
+ result = new(zone()) TryCatchStatement(isolate(),
+ index,
try_block,
catch_scope,
catch_variable,
@@ -2373,7 +2383,8 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
} else {
ASSERT(finally_block != NULL);
int index = current_function_state_->NextHandlerIndex();
- result = new(zone()) TryFinallyStatement(index,
+ result = new(zone()) TryFinallyStatement(isolate(),
+ index,
try_block,
finally_block);
// Combine the jump targets of the try block and the possible catch block.
@@ -3938,6 +3949,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
int materialized_literal_count;
int expected_property_count;
int handler_count = 0;
+ int ast_node_count_before = isolate_->ast_node_count();
+ int heavy_ast_node_count_before = isolate_->heavy_ast_node_count();
bool only_simple_this_property_assignments;
Handle<FixedArray> this_property_assignments;
bool has_duplicate_parameters = false;
@@ -4119,6 +4132,10 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
CheckConflictingVarDeclarations(scope, CHECK_OK);
}
+ int ast_nodes_added = isolate_->ast_node_count() - ast_node_count_before + 1;
+ bool is_primitive =
+ (isolate_->heavy_ast_node_count() - heavy_ast_node_count_before == 0);
+
FunctionLiteral* function_literal =
new(zone()) FunctionLiteral(isolate(),
function_name,
@@ -4131,7 +4148,9 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
this_property_assignments,
num_parameters,
type,
- has_duplicate_parameters);
+ has_duplicate_parameters,
+ ast_nodes_added,
+ is_primitive);
function_literal->set_function_token_position(function_token_position);
if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal);
« src/hydrogen.cc ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698