Fix two bugs the LAllocator::FindOptimalSplitPos.
- It was calculating start_block and end_block incorrectly. - It was not considering the case when end_block is a loop header itself when searching for the header of the outermost loop. These bugs do not affect correctness of the allocation but can severely degrade it's quality (cause spills in loop bodies). Review URL: http://codereview.chromium.org/6901148 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7737 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
7088aea3eb
commit
cf239c4ea8
@ -2029,12 +2029,12 @@ LifetimePosition LAllocator::FindOptimalSplitPos(LifetimePosition start,
|
|||||||
// We have no choice
|
// We have no choice
|
||||||
if (start_instr == end_instr) return end;
|
if (start_instr == end_instr) return end;
|
||||||
|
|
||||||
HBasicBlock* end_block = GetBlock(start);
|
HBasicBlock* start_block = GetBlock(start);
|
||||||
HBasicBlock* start_block = GetBlock(end);
|
HBasicBlock* end_block = GetBlock(end);
|
||||||
|
|
||||||
if (end_block == start_block) {
|
if (end_block == start_block) {
|
||||||
// The interval is split in the same basic block. Split at latest possible
|
// The interval is split in the same basic block. Split at the latest
|
||||||
// position.
|
// possible position.
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2045,7 +2045,9 @@ LifetimePosition LAllocator::FindOptimalSplitPos(LifetimePosition start,
|
|||||||
block = block->parent_loop_header();
|
block = block->parent_loop_header();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block == end_block) return end;
|
// We did not find any suitable outer loop. Split at the latest possible
|
||||||
|
// position unless end_block is a loop header itself.
|
||||||
|
if (block == end_block && !end_block->IsLoopHeader()) return end;
|
||||||
|
|
||||||
return LifetimePosition::FromInstructionIndex(
|
return LifetimePosition::FromInstructionIndex(
|
||||||
block->first_instruction_index());
|
block->first_instruction_index());
|
||||||
|
Loading…
Reference in New Issue
Block a user