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

Side by Side Diff: src/hydrogen.cc

Issue 6691058: Restart AST node numbering when we enter a function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporate codereview suggestions. Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 575
576 HGraph::HGraph(CompilationInfo* info) 576 HGraph::HGraph(CompilationInfo* info)
577 : isolate_(info->isolate()), 577 : isolate_(info->isolate()),
578 next_block_id_(0), 578 next_block_id_(0),
579 entry_block_(NULL), 579 entry_block_(NULL),
580 blocks_(8), 580 blocks_(8),
581 values_(16), 581 values_(16),
582 phi_list_(NULL) { 582 phi_list_(NULL) {
583 start_environment_ = 583 start_environment_ =
584 new(zone()) HEnvironment(NULL, info->scope(), info->closure()); 584 new(zone()) HEnvironment(NULL, info->scope(), info->closure());
585 start_environment_->set_ast_id(info->function()->id()); 585 start_environment_->set_ast_id(AstNode::kFunctionEntryId);
586 entry_block_ = CreateBasicBlock(); 586 entry_block_ = CreateBasicBlock();
587 entry_block_->SetInitialEnvironment(start_environment_); 587 entry_block_->SetInitialEnvironment(start_environment_);
588 } 588 }
589 589
590 590
591 Handle<Code> HGraph::Compile(CompilationInfo* info) { 591 Handle<Code> HGraph::Compile(CompilationInfo* info) {
592 int values = GetMaximumValueID(); 592 int values = GetMaximumValueID();
593 if (values > LAllocator::max_initial_value_ids()) { 593 if (values > LAllocator::max_initial_value_ids()) {
594 if (FLAG_trace_bailout) PrintF("Function is too big\n"); 594 if (FLAG_trace_bailout) PrintF("Function is too big\n");
595 return Handle<Code>::null(); 595 return Handle<Code>::null();
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 // block in HInstruction::InsertAfter) seals the start block from 2196 // block in HInstruction::InsertAfter) seals the start block from
2197 // getting unwanted instructions inserted. 2197 // getting unwanted instructions inserted.
2198 // 2198 //
2199 // TODO(kmillikin): Fix this. Stop mutating the initial environment. 2199 // TODO(kmillikin): Fix this. Stop mutating the initial environment.
2200 // Make the Hydrogen instructions in the initial block into Hydrogen 2200 // Make the Hydrogen instructions in the initial block into Hydrogen
2201 // values (but not instructions), present in the initial environment and 2201 // values (but not instructions), present in the initial environment and
2202 // not replayed by the Lithium translation. 2202 // not replayed by the Lithium translation.
2203 HEnvironment* initial_env = environment()->CopyWithoutHistory(); 2203 HEnvironment* initial_env = environment()->CopyWithoutHistory();
2204 HBasicBlock* body_entry = CreateBasicBlock(initial_env); 2204 HBasicBlock* body_entry = CreateBasicBlock(initial_env);
2205 current_block()->Goto(body_entry); 2205 current_block()->Goto(body_entry);
2206 body_entry->SetJoinId(info()->function()->id()); 2206 body_entry->SetJoinId(AstNode::kFunctionEntryId);
2207 set_current_block(body_entry); 2207 set_current_block(body_entry);
2208 VisitStatements(info()->function()->body()); 2208 VisitStatements(info()->function()->body());
2209 if (HasStackOverflow()) return NULL; 2209 if (HasStackOverflow()) return NULL;
2210 2210
2211 if (current_block() != NULL) { 2211 if (current_block() != NULL) {
2212 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); 2212 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined());
2213 current_block()->FinishExit(instr); 2213 current_block()->FinishExit(instr);
2214 set_current_block(NULL); 2214 set_current_block(NULL);
2215 } 2215 }
2216 } 2216 }
(...skipping 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after
5656 } 5656 }
5657 } 5657 }
5658 5658
5659 // Initialize the stack-allocated locals to undefined. 5659 // Initialize the stack-allocated locals to undefined.
5660 int local_base = arity + 1; 5660 int local_base = arity + 1;
5661 int local_count = function->scope()->num_stack_slots(); 5661 int local_count = function->scope()->num_stack_slots();
5662 for (int i = 0; i < local_count; ++i) { 5662 for (int i = 0; i < local_count; ++i) {
5663 inner->SetValueAt(local_base + i, undefined); 5663 inner->SetValueAt(local_base + i, undefined);
5664 } 5664 }
5665 5665
5666 inner->set_ast_id(function->id()); 5666 inner->set_ast_id(AstNode::kFunctionEntryId);
5667 return inner; 5667 return inner;
5668 } 5668 }
5669 5669
5670 5670
5671 void HEnvironment::PrintTo(StringStream* stream) { 5671 void HEnvironment::PrintTo(StringStream* stream) {
5672 for (int i = 0; i < length(); i++) { 5672 for (int i = 0; i < length(); i++) {
5673 if (i == 0) stream->Add("parameters\n"); 5673 if (i == 0) stream->Add("parameters\n");
5674 if (i == parameter_count()) stream->Add("locals\n"); 5674 if (i == parameter_count()) stream->Add("locals\n");
5675 if (i == parameter_count() + local_count()) stream->Add("expressions"); 5675 if (i == parameter_count() + local_count()) stream->Add("expressions");
5676 HValue* val = values_.at(i); 5676 HValue* val = values_.at(i);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
5991 } 5991 }
5992 } 5992 }
5993 5993
5994 #ifdef DEBUG 5994 #ifdef DEBUG
5995 if (graph_ != NULL) graph_->Verify(); 5995 if (graph_ != NULL) graph_->Verify();
5996 if (allocator_ != NULL) allocator_->Verify(); 5996 if (allocator_ != NULL) allocator_->Verify();
5997 #endif 5997 #endif
5998 } 5998 }
5999 5999
6000 } } // namespace v8::internal 6000 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698