| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 builder_->set_current_block(exit_block_); | 956 builder_->set_current_block(exit_block_); |
| 957 // Pop the phi from the expression stack | 957 // Pop the phi from the expression stack |
| 958 builder_->environment()->Pop(); | 958 builder_->environment()->Pop(); |
| 959 finished_ = true; | 959 finished_ = true; |
| 960 } | 960 } |
| 961 | 961 |
| 962 | 962 |
| 963 HGraph* HGraphBuilder::CreateGraph() { | 963 HGraph* HGraphBuilder::CreateGraph() { |
| 964 graph_ = new(zone()) HGraph(info_); | 964 graph_ = new(zone()) HGraph(info_); |
| 965 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); | 965 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); |
| 966 HPhase phase("H_Block building", isolate()); | 966 HPhase phase("H_Block building", isolate(), zone()); |
| 967 set_current_block(graph()->entry_block()); | 967 set_current_block(graph()->entry_block()); |
| 968 if (!BuildGraph()) return NULL; | 968 if (!BuildGraph()) return NULL; |
| 969 graph()->FinalizeUniqueValueIds(); | 969 graph()->FinalizeUniqueValueIds(); |
| 970 return graph_; | 970 return graph_; |
| 971 } | 971 } |
| 972 | 972 |
| 973 | 973 |
| 974 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { | 974 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
| 975 ASSERT(current_block() != NULL); | 975 ASSERT(current_block() != NULL); |
| 976 current_block()->AddInstruction(instr); | 976 current_block()->AddInstruction(instr); |
| (...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 HLoopInformation* loop_; | 2377 HLoopInformation* loop_; |
| 2378 HBasicBlock* block_; | 2378 HBasicBlock* block_; |
| 2379 HBasicBlock* loop_header_; | 2379 HBasicBlock* loop_header_; |
| 2380 int loop_index; | 2380 int loop_index; |
| 2381 int loop_length; | 2381 int loop_length; |
| 2382 HSuccessorIterator successor_iterator; | 2382 HSuccessorIterator successor_iterator; |
| 2383 }; | 2383 }; |
| 2384 | 2384 |
| 2385 | 2385 |
| 2386 void HGraph::OrderBlocks() { | 2386 void HGraph::OrderBlocks() { |
| 2387 HPhase phase("H_Block ordering", isolate()); | 2387 HPhase phase("H_Block ordering", isolate(), zone()); |
| 2388 BitVector visited(blocks_.length(), zone()); | 2388 BitVector visited(blocks_.length(), zone()); |
| 2389 | 2389 |
| 2390 ZoneList<HBasicBlock*> reverse_result(8, zone()); | 2390 ZoneList<HBasicBlock*> reverse_result(8, zone()); |
| 2391 HBasicBlock* start = blocks_[0]; | 2391 HBasicBlock* start = blocks_[0]; |
| 2392 PostorderProcessor* postorder = | 2392 PostorderProcessor* postorder = |
| 2393 PostorderProcessor::CreateEntryProcessor(zone(), start, &visited); | 2393 PostorderProcessor::CreateEntryProcessor(zone(), start, &visited); |
| 2394 while (postorder != NULL) { | 2394 while (postorder != NULL) { |
| 2395 postorder = postorder->PerformStep(zone(), &visited, &reverse_result); | 2395 postorder = postorder->PerformStep(zone(), &visited, &reverse_result); |
| 2396 } | 2396 } |
| 2397 blocks_.Rewind(0); | 2397 blocks_.Rewind(0); |
| (...skipping 9170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11568 names_.Add(name); | 11568 names_.Add(name); |
| 11569 timing_.Add(ticks); | 11569 timing_.Add(ticks); |
| 11570 sizes_.Add(size); | 11570 sizes_.Add(size); |
| 11571 } | 11571 } |
| 11572 } | 11572 } |
| 11573 | 11573 |
| 11574 | 11574 |
| 11575 const char* const HPhase::kFullCodeGen = "Full code generator"; | 11575 const char* const HPhase::kFullCodeGen = "Full code generator"; |
| 11576 | 11576 |
| 11577 | 11577 |
| 11578 HPhase::HPhase(const char* name, Isolate* isolate) { | 11578 HPhase::HPhase(const char* name, Isolate* isolate, Zone* zone) { |
| 11579 Init(isolate, name, NULL, NULL, NULL); | 11579 Init(isolate, name, zone, NULL, NULL, NULL); |
| 11580 } | 11580 } |
| 11581 | 11581 |
| 11582 | 11582 |
| 11583 HPhase::HPhase(const char* name, HGraph* graph) { | 11583 HPhase::HPhase(const char* name, HGraph* graph) { |
| 11584 Init(graph->isolate(), name, graph, NULL, NULL); | 11584 Init(graph->isolate(), name, graph->zone(), graph, NULL, NULL); |
| 11585 } | 11585 } |
| 11586 | 11586 |
| 11587 | 11587 |
| 11588 HPhase::HPhase(const char* name, LChunk* chunk) { | 11588 HPhase::HPhase(const char* name, LChunk* chunk) { |
| 11589 Init(chunk->isolate(), name, NULL, chunk, NULL); | 11589 Init(chunk->isolate(), name, chunk->zone(), NULL, chunk, NULL); |
| 11590 } | 11590 } |
| 11591 | 11591 |
| 11592 | 11592 |
| 11593 HPhase::HPhase(const char* name, LAllocator* allocator) { | 11593 HPhase::HPhase(const char* name, LAllocator* allocator) { |
| 11594 Init(allocator->isolate(), name, NULL, NULL, allocator); | 11594 Init(allocator->isolate(), name, allocator->zone(), NULL, NULL, allocator); |
| 11595 } | 11595 } |
| 11596 | 11596 |
| 11597 | 11597 |
| 11598 void HPhase::Init(Isolate* isolate, | 11598 void HPhase::Init(Isolate* isolate, |
| 11599 const char* name, | 11599 const char* name, |
| 11600 Zone* zone, |
| 11600 HGraph* graph, | 11601 HGraph* graph, |
| 11601 LChunk* chunk, | 11602 LChunk* chunk, |
| 11602 LAllocator* allocator) { | 11603 LAllocator* allocator) { |
| 11603 isolate_ = isolate; | 11604 isolate_ = isolate; |
| 11604 name_ = name; | 11605 name_ = name; |
| 11606 zone_ = zone; |
| 11605 graph_ = graph; | 11607 graph_ = graph; |
| 11606 chunk_ = chunk; | 11608 chunk_ = chunk; |
| 11607 allocator_ = allocator; | 11609 allocator_ = allocator; |
| 11608 if (allocator != NULL && chunk_ == NULL) { | 11610 if (allocator != NULL && chunk_ == NULL) { |
| 11609 chunk_ = allocator->chunk(); | 11611 chunk_ = allocator->chunk(); |
| 11610 } | 11612 } |
| 11611 if (FLAG_hydrogen_stats) { | 11613 if (FLAG_hydrogen_stats) { |
| 11612 start_ticks_ = OS::Ticks(); | 11614 start_ticks_ = OS::Ticks(); |
| 11613 start_allocation_size_ = Zone::allocation_size_; | 11615 start_allocation_size_ = zone_->allocation_size(); |
| 11614 } | 11616 } |
| 11615 } | 11617 } |
| 11616 | 11618 |
| 11617 | 11619 |
| 11618 HPhase::~HPhase() { | 11620 HPhase::~HPhase() { |
| 11619 if (FLAG_hydrogen_stats) { | 11621 if (FLAG_hydrogen_stats) { |
| 11620 int64_t ticks = OS::Ticks() - start_ticks_; | 11622 int64_t ticks = OS::Ticks() - start_ticks_; |
| 11621 unsigned size = Zone::allocation_size_ - start_allocation_size_; | 11623 unsigned size = zone_->allocation_size() - start_allocation_size_; |
| 11622 isolate_->GetHStatistics()->SaveTiming(name_, ticks, size); | 11624 isolate_->GetHStatistics()->SaveTiming(name_, ticks, size); |
| 11623 } | 11625 } |
| 11624 | 11626 |
| 11625 // Produce trace output if flag is set so that the first letter of the | 11627 // Produce trace output if flag is set so that the first letter of the |
| 11626 // phase name matches the command line parameter FLAG_trace_phase. | 11628 // phase name matches the command line parameter FLAG_trace_phase. |
| 11627 if (FLAG_trace_hydrogen && | 11629 if (FLAG_trace_hydrogen && |
| 11628 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL) { | 11630 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL) { |
| 11629 if (graph_ != NULL) { | 11631 if (graph_ != NULL) { |
| 11630 isolate_->GetHTracer()->TraceHydrogen(name_, graph_); | 11632 isolate_->GetHTracer()->TraceHydrogen(name_, graph_); |
| 11631 } | 11633 } |
| 11632 if (chunk_ != NULL) { | 11634 if (chunk_ != NULL) { |
| 11633 isolate_->GetHTracer()->TraceLithium(name_, chunk_); | 11635 isolate_->GetHTracer()->TraceLithium(name_, chunk_); |
| 11634 } | 11636 } |
| 11635 if (allocator_ != NULL) { | 11637 if (allocator_ != NULL) { |
| 11636 isolate_->GetHTracer()->TraceLiveRanges(name_, allocator_); | 11638 isolate_->GetHTracer()->TraceLiveRanges(name_, allocator_); |
| 11637 } | 11639 } |
| 11638 } | 11640 } |
| 11639 | 11641 |
| 11640 #ifdef DEBUG | 11642 #ifdef DEBUG |
| 11641 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11643 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 11642 if (allocator_ != NULL) allocator_->Verify(); | 11644 if (allocator_ != NULL) allocator_->Verify(); |
| 11643 #endif | 11645 #endif |
| 11644 } | 11646 } |
| 11645 | 11647 |
| 11646 } } // namespace v8::internal | 11648 } } // namespace v8::internal |
| OLD | NEW |