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
This commit is contained in:
fschneider@chromium.org 2010-03-12 15:01:05 +00:00
parent 10e5690d32
commit ff03f6b36f
2 changed files with 13 additions and 9 deletions

View File

@ -95,11 +95,13 @@ static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) {
if (!builder.HasStackOverflow()) {
int variable_count =
function->num_parameters() + function->scope()->num_stack_slots();
if (variable_count > 0 && builder.definitions()->length() > 0) {
ReachingDefinitions rd(builder.postorder(),
builder.definitions(),
variable_count);
rd.Compute();
}
}
#ifdef DEBUG
if (FLAG_print_graph_text && !builder.HasStackOverflow()) {
@ -497,11 +499,13 @@ Handle<JSFunction> Compiler::BuildBoilerplate(FunctionLiteral* literal,
if (!builder.HasStackOverflow()) {
int variable_count =
literal->num_parameters() + literal->scope()->num_stack_slots();
if (variable_count > 0 && builder.definitions()->length() > 0) {
ReachingDefinitions rd(builder.postorder(),
builder.definitions(),
variable_count);
rd.Compute();
}
}
#ifdef DEBUG
if (FLAG_print_graph_text && !builder.HasStackOverflow()) {

View File

@ -2061,7 +2061,7 @@ void JoinNode::UpdateRDIn(WorkList<Node>* worklist, bool mark) {
void ReachingDefinitions::Compute() {
if (definitions_->is_empty()) return;
ASSERT(!definitions_->is_empty());
int variable_count = variables_.length();
int definition_count = definitions_->length();