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,10 +95,12 @@ static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) { ...@@ -95,10 +95,12 @@ 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();
ReachingDefinitions rd(builder.postorder(), if (variable_count > 0 && builder.definitions()->length() > 0) {
builder.definitions(), ReachingDefinitions rd(builder.postorder(),
variable_count); builder.definitions(),
rd.Compute(); variable_count);
rd.Compute();
}
} }
#ifdef DEBUG #ifdef DEBUG
...@@ -497,10 +499,12 @@ Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal, ...@@ -497,10 +499,12 @@ 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();
ReachingDefinitions rd(builder.postorder(), if (variable_count > 0 && builder.definitions()->length() > 0) {
builder.definitions(), ReachingDefinitions rd(builder.postorder(),
variable_count); builder.definitions(),
rd.Compute(); variable_count);
rd.Compute();
}
} }
#ifdef DEBUG #ifdef DEBUG
......
...@@ -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