| Index: src/lithium-allocator.cc
|
| diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc
|
| index 09dca345d5d789a4009f222b7f85fa960eb98adb..a646f4c7b87f7d785f0d6eb6ec34a5a1b71ae612 100644
|
| --- a/src/lithium-allocator.cc
|
| +++ b/src/lithium-allocator.cc
|
| @@ -1095,7 +1095,6 @@ bool LAllocator::Allocate(LChunk* chunk) {
|
| AllocateDoubleRegisters();
|
| if (!AllocationOk()) return false;
|
| PopulatePointerMaps();
|
| - if (has_osr_entry_) ProcessOsrEntry();
|
| ConnectRanges();
|
| ResolveControlFlow();
|
| return true;
|
| @@ -1103,7 +1102,7 @@ bool LAllocator::Allocate(LChunk* chunk) {
|
|
|
|
|
| void LAllocator::MeetRegisterConstraints() {
|
| - HPhase phase("L_Register constraints", chunk_);
|
| + LAllocatorPhase phase("L_Register constraints", this);
|
| first_artificial_register_ = next_virtual_register_;
|
| const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
|
| for (int i = 0; i < blocks->length(); ++i) {
|
| @@ -1115,7 +1114,7 @@ void LAllocator::MeetRegisterConstraints() {
|
|
|
|
|
| void LAllocator::ResolvePhis() {
|
| - HPhase phase("L_Resolve phis", chunk_);
|
| + LAllocatorPhase phase("L_Resolve phis", this);
|
|
|
| // Process the blocks in reverse order.
|
| const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
|
| @@ -1206,7 +1205,7 @@ HBasicBlock* LAllocator::GetBlock(LifetimePosition pos) {
|
|
|
|
|
| void LAllocator::ConnectRanges() {
|
| - HPhase phase("L_Connect ranges", this);
|
| + LAllocatorPhase phase("L_Connect ranges", this);
|
| for (int i = 0; i < live_ranges()->length(); ++i) {
|
| LiveRange* first_range = live_ranges()->at(i);
|
| if (first_range == NULL || first_range->parent() != NULL) continue;
|
| @@ -1246,7 +1245,7 @@ bool LAllocator::CanEagerlyResolveControlFlow(HBasicBlock* block) const {
|
|
|
|
|
| void LAllocator::ResolveControlFlow() {
|
| - HPhase phase("L_Resolve control flow", this);
|
| + LAllocatorPhase phase("L_Resolve control flow", this);
|
| const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
|
| for (int block_id = 1; block_id < blocks->length(); ++block_id) {
|
| HBasicBlock* block = blocks->at(block_id);
|
| @@ -1267,7 +1266,7 @@ void LAllocator::ResolveControlFlow() {
|
|
|
|
|
| void LAllocator::BuildLiveRanges() {
|
| - HPhase phase("L_Build live ranges", this);
|
| + LAllocatorPhase phase("L_Build live ranges", this);
|
| InitializeLivenessAnalysis();
|
| // Process the blocks in reverse order.
|
| const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
|
| @@ -1379,7 +1378,7 @@ bool LAllocator::SafePointsAreInOrder() const {
|
|
|
|
|
| void LAllocator::PopulatePointerMaps() {
|
| - HPhase phase("L_Populate pointer maps", this);
|
| + LAllocatorPhase phase("L_Populate pointer maps", this);
|
| const ZoneList<LPointerMap*>* pointer_maps = chunk_->pointer_maps();
|
|
|
| ASSERT(SafePointsAreInOrder());
|
| @@ -1466,46 +1465,15 @@ void LAllocator::PopulatePointerMaps() {
|
| }
|
|
|
|
|
| -void LAllocator::ProcessOsrEntry() {
|
| - const ZoneList<LInstruction*>* instrs = chunk_->instructions();
|
| -
|
| - // Linear search for the OSR entry instruction in the chunk.
|
| - int index = -1;
|
| - while (++index < instrs->length() &&
|
| - !instrs->at(index)->IsOsrEntry()) {
|
| - }
|
| - ASSERT(index < instrs->length());
|
| - LOsrEntry* instruction = LOsrEntry::cast(instrs->at(index));
|
| -
|
| - LifetimePosition position = LifetimePosition::FromInstructionIndex(index);
|
| - for (int i = 0; i < live_ranges()->length(); ++i) {
|
| - LiveRange* range = live_ranges()->at(i);
|
| - if (range != NULL) {
|
| - if (range->Covers(position) &&
|
| - range->HasRegisterAssigned() &&
|
| - range->TopLevel()->HasAllocatedSpillOperand()) {
|
| - int reg_index = range->assigned_register();
|
| - LOperand* spill_operand = range->TopLevel()->GetSpillOperand();
|
| - if (range->IsDouble()) {
|
| - instruction->MarkSpilledDoubleRegister(reg_index, spill_operand);
|
| - } else {
|
| - instruction->MarkSpilledRegister(reg_index, spill_operand);
|
| - }
|
| - }
|
| - }
|
| - }
|
| -}
|
| -
|
| -
|
| void LAllocator::AllocateGeneralRegisters() {
|
| - HPhase phase("L_Allocate general registers", this);
|
| + LAllocatorPhase phase("L_Allocate general registers", this);
|
| num_registers_ = Register::NumAllocatableRegisters();
|
| AllocateRegisters();
|
| }
|
|
|
|
|
| void LAllocator::AllocateDoubleRegisters() {
|
| - HPhase phase("L_Allocate double registers", this);
|
| + LAllocatorPhase phase("L_Allocate double registers", this);
|
| num_registers_ = DoubleRegister::NumAllocatableRegisters();
|
| mode_ = DOUBLE_REGISTERS;
|
| AllocateRegisters();
|
| @@ -2194,4 +2162,16 @@ void LAllocator::Verify() const {
|
| #endif
|
|
|
|
|
| +LAllocatorPhase::~LAllocatorPhase() {
|
| + if (ShouldProduceTraceOutput()) {
|
| + isolate()->GetHTracer()->TraceLithium(name(), allocator_->chunk());
|
| + isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_);
|
| + }
|
| +
|
| +#ifdef DEBUG
|
| + if (allocator_ != NULL) allocator_->Verify();
|
| +#endif
|
| +}
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|