Fix off-by-one bug in TurboFan register allocator.
authortitzer@chromium.org <titzer@chromium.org>
Tue, 21 Oct 2014 14:41:54 +0000 (14:41 +0000)
committertitzer@chromium.org <titzer@chromium.org>
Tue, 21 Oct 2014 14:41:54 +0000 (14:41 +0000)
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

src/compiler/instruction.h
src/compiler/register-allocator.cc

index fddc225..43958b8 100644 (file)
@@ -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()];
index 8f02452..801c7ca 100644 (file)
@@ -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);