From: titzer@chromium.org Date: Tue, 21 Oct 2014 14:41:54 +0000 (+0000) Subject: Fix off-by-one bug in TurboFan register allocator. X-Git-Tag: upstream/4.7.83~6214 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2642058760811c8a9ca41a1a226c72b45175c52a;p=platform%2Fupstream%2Fv8.git Fix off-by-one bug in TurboFan register allocator. R=jarin@chromium.org BUG= Review URL: https://codereview.chromium.org/671703003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24778 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h index fddc225..43958b8 100644 --- a/src/compiler/instruction.h +++ b/src/compiler/instruction.h @@ -862,6 +862,11 @@ class InstructionSequence FINAL { return instruction_blocks_[rpo_number.ToSize()]; } + int LastLoopInstructionIndex(const InstructionBlock* block) { + return instruction_blocks_[block->loop_end().ToSize() - 1] + ->last_instruction_index(); + } + const InstructionBlock* InstructionBlockAt( BasicBlock::RpoNumber rpo_number) const { return instruction_blocks_[rpo_number.ToSize()]; diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc index 8f02452..801c7ca 100644 --- a/src/compiler/register-allocator.cc +++ b/src/compiler/register-allocator.cc @@ -1328,11 +1328,9 @@ void RegisterAllocator::BuildLiveRanges() { BitVector::Iterator iterator(live); LifetimePosition start = LifetimePosition::FromInstructionIndex( block->first_instruction_index()); - int end_index = code() - ->InstructionBlockAt(block->loop_end()) - ->last_instruction_index(); LifetimePosition end = - LifetimePosition::FromInstructionIndex(end_index).NextInstruction(); + LifetimePosition::FromInstructionIndex( + code()->LastLoopInstructionIndex(block)).NextInstruction(); while (!iterator.Done()) { int operand_index = iterator.Current(); LiveRange* range = LiveRangeFor(operand_index);