OLD | NEW |
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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
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_ = new HEnvironment(NULL, info->scope(), info->closure()); | 583 start_environment_ = new HEnvironment(NULL, info->scope(), info->closure()); |
584 start_environment_->set_ast_id(info->function()->id()); | 584 start_environment_->set_ast_id(0); |
585 entry_block_ = CreateBasicBlock(); | 585 entry_block_ = CreateBasicBlock(); |
586 entry_block_->SetInitialEnvironment(start_environment_); | 586 entry_block_->SetInitialEnvironment(start_environment_); |
587 } | 587 } |
588 | 588 |
589 | 589 |
590 Handle<Code> HGraph::Compile(CompilationInfo* info) { | 590 Handle<Code> HGraph::Compile(CompilationInfo* info) { |
591 int values = GetMaximumValueID(); | 591 int values = GetMaximumValueID(); |
592 if (values > LAllocator::max_initial_value_ids()) { | 592 if (values > LAllocator::max_initial_value_ids()) { |
593 if (FLAG_trace_bailout) PrintF("Function is too big\n"); | 593 if (FLAG_trace_bailout) PrintF("Function is too big\n"); |
594 return Handle<Code>::null(); | 594 return Handle<Code>::null(); |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 // block in HInstruction::InsertAfter) seals the start block from | 2191 // block in HInstruction::InsertAfter) seals the start block from |
2192 // getting unwanted instructions inserted. | 2192 // getting unwanted instructions inserted. |
2193 // | 2193 // |
2194 // TODO(kmillikin): Fix this. Stop mutating the initial environment. | 2194 // TODO(kmillikin): Fix this. Stop mutating the initial environment. |
2195 // Make the Hydrogen instructions in the initial block into Hydrogen | 2195 // Make the Hydrogen instructions in the initial block into Hydrogen |
2196 // values (but not instructions), present in the initial environment and | 2196 // values (but not instructions), present in the initial environment and |
2197 // not replayed by the Lithium translation. | 2197 // not replayed by the Lithium translation. |
2198 HEnvironment* initial_env = environment()->CopyWithoutHistory(); | 2198 HEnvironment* initial_env = environment()->CopyWithoutHistory(); |
2199 HBasicBlock* body_entry = CreateBasicBlock(initial_env); | 2199 HBasicBlock* body_entry = CreateBasicBlock(initial_env); |
2200 current_block()->Goto(body_entry); | 2200 current_block()->Goto(body_entry); |
2201 body_entry->SetJoinId(info()->function()->id()); | 2201 body_entry->SetJoinId(0); |
2202 set_current_block(body_entry); | 2202 set_current_block(body_entry); |
2203 VisitStatements(info()->function()->body()); | 2203 VisitStatements(info()->function()->body()); |
2204 if (HasStackOverflow()) return NULL; | 2204 if (HasStackOverflow()) return NULL; |
2205 | 2205 |
2206 if (current_block() != NULL) { | 2206 if (current_block() != NULL) { |
2207 HReturn* instr = new HReturn(graph()->GetConstantUndefined()); | 2207 HReturn* instr = new HReturn(graph()->GetConstantUndefined()); |
2208 current_block()->FinishExit(instr); | 2208 current_block()->FinishExit(instr); |
2209 set_current_block(NULL); | 2209 set_current_block(NULL); |
2210 } | 2210 } |
2211 } | 2211 } |
(...skipping 3755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5967 } | 5967 } |
5968 } | 5968 } |
5969 | 5969 |
5970 #ifdef DEBUG | 5970 #ifdef DEBUG |
5971 if (graph_ != NULL) graph_->Verify(); | 5971 if (graph_ != NULL) graph_->Verify(); |
5972 if (allocator_ != NULL) allocator_->Verify(); | 5972 if (allocator_ != NULL) allocator_->Verify(); |
5973 #endif | 5973 #endif |
5974 } | 5974 } |
5975 | 5975 |
5976 } } // namespace v8::internal | 5976 } } // namespace v8::internal |
OLD | NEW |