From 03e1036fdef4d521716645426898b83577233fda Mon Sep 17 00:00:00 2001 From: "vegorov@chromium.org" Date: Tue, 1 Feb 2011 14:33:23 +0000 Subject: [PATCH] Fix control flow resolution bug in lithium register allocator. Review URL: http://codereview.chromium.org/6312057 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6556 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/lithium-allocator.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc index cac7d65..81877f3 100644 --- a/src/lithium-allocator.cc +++ b/src/lithium-allocator.cc @@ -1068,9 +1068,7 @@ void LAllocator::ResolveControlFlow(LiveRange* range, HBasicBlock* block, HBasicBlock* pred) { LifetimePosition pred_end = - LifetimePosition::FromInstructionIndex(pred->last_instruction_index()). - PrevInstruction(); - + LifetimePosition::FromInstructionIndex(pred->last_instruction_index()); LifetimePosition cur_start = LifetimePosition::FromInstructionIndex(block->first_instruction_index()); LiveRange* pred_cover = NULL; @@ -1245,7 +1243,7 @@ void LAllocator::BuildLiveRanges() { LifetimePosition start = LifetimePosition::FromInstructionIndex( block->first_instruction_index()); LifetimePosition end = LifetimePosition::FromInstructionIndex( - back_edge->last_instruction_index()); + back_edge->last_instruction_index()).NextInstruction(); while (!iterator.Done()) { int operand_index = iterator.Current(); LiveRange* range = LiveRangeFor(operand_index); @@ -2019,6 +2017,11 @@ LiveRange* LAllocator::SplitAt(LiveRange* range, LifetimePosition pos) { if (pos.Value() <= range->Start().Value()) return range; + // We can't properly connect liveranges if split occured at the end + // of control instruction. + ASSERT(pos.IsInstructionStart() || + !chunk_->instructions()->at(pos.InstructionIndex())->IsControl()); + LiveRange* result = LiveRangeFor(next_virtual_register_++); range->SplitAt(pos, result); return result; -- 2.7.4