Only invoke reaching definitions if there are >0 variables and >0 definitions.

Review URL: http://codereview.chromium.org/885004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4120 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 10e5690d
...@@ -95,11 +95,13 @@ static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) { ...@@ -95,11 +95,13 @@ static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) {
if (!builder.HasStackOverflow()) { if (!builder.HasStackOverflow()) {
int variable_count = int variable_count =
function->num_parameters() + function->scope()->num_stack_slots(); function->num_parameters() + function->scope()->num_stack_slots();
if (variable_count > 0 && builder.definitions()->length() > 0) {
ReachingDefinitions rd(builder.postorder(), ReachingDefinitions rd(builder.postorder(),
builder.definitions(), builder.definitions(),
variable_count); variable_count);
rd.Compute(); rd.Compute();
} }
}
#ifdef DEBUG #ifdef DEBUG
if (FLAG_print_graph_text && !builder.HasStackOverflow()) { if (FLAG_print_graph_text && !builder.HasStackOverflow()) {
...@@ -497,11 +499,13 @@ Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal, ...@@ -497,11 +499,13 @@ Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal,
if (!builder.HasStackOverflow()) { if (!builder.HasStackOverflow()) {
int variable_count = int variable_count =
literal->num_parameters() + literal->scope()->num_stack_slots(); literal->num_parameters() + literal->scope()->num_stack_slots();
if (variable_count > 0 && builder.definitions()->length() > 0) {
ReachingDefinitions rd(builder.postorder(), ReachingDefinitions rd(builder.postorder(),
builder.definitions(), builder.definitions(),
variable_count); variable_count);
rd.Compute(); rd.Compute();
} }
}
#ifdef DEBUG #ifdef DEBUG
if (FLAG_print_graph_text && !builder.HasStackOverflow()) { if (FLAG_print_graph_text && !builder.HasStackOverflow()) {
......
...@@ -2061,7 +2061,7 @@ void JoinNode::UpdateRDIn(WorkList<Node>* worklist, bool mark) { ...@@ -2061,7 +2061,7 @@ void JoinNode::UpdateRDIn(WorkList<Node>* worklist, bool mark) {
void ReachingDefinitions::Compute() { void ReachingDefinitions::Compute() {
if (definitions_->is_empty()) return; ASSERT(!definitions_->is_empty());
int variable_count = variables_.length(); int variable_count = variables_.length();
int definition_count = definitions_->length(); int definition_count = definitions_->length();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment