Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Side by Side Diff: src/compiler/register-allocator.cc

Issue 1690863006: [turbofan] Fix small redundancy in register allocator per TODO. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/linkage.h" 6 #include "src/compiler/linkage.h"
7 #include "src/compiler/register-allocator.h" 7 #include "src/compiler/register-allocator.h"
8 #include "src/string-stream.h" 8 #include "src/string-stream.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 const InstructionBlock* end_block = GetInstructionBlock(code(), end); 2435 const InstructionBlock* end_block = GetInstructionBlock(code(), end);
2436 2436
2437 if (end_block == start_block) { 2437 if (end_block == start_block) {
2438 // The interval is split in the same basic block. Split at the latest 2438 // The interval is split in the same basic block. Split at the latest
2439 // possible position. 2439 // possible position.
2440 return end; 2440 return end;
2441 } 2441 }
2442 2442
2443 const InstructionBlock* block = end_block; 2443 const InstructionBlock* block = end_block;
2444 // Find header of outermost loop. 2444 // Find header of outermost loop.
2445 // TODO(titzer): fix redundancy below. 2445 do {
2446 while (GetContainingLoop(code(), block) != nullptr && 2446 const InstructionBlock* loop = GetContainingLoop(code(), block);
2447 GetContainingLoop(code(), block)->rpo_number().ToInt() > 2447 if (loop == nullptr ||
2448 start_block->rpo_number().ToInt()) { 2448 loop->rpo_number().ToInt() <= start_block->rpo_number().ToInt()) {
2449 block = GetContainingLoop(code(), block); 2449 // No more loops or loop starts before the lifetime start.
2450 } 2450 break;
2451 }
2452 block = loop;
2453 } while (true);
2451 2454
2452 // We did not find any suitable outer loop. Split at the latest possible 2455 // We did not find any suitable outer loop. Split at the latest possible
2453 // position unless end_block is a loop header itself. 2456 // position unless end_block is a loop header itself.
2454 if (block == end_block && !end_block->IsLoopHeader()) return end; 2457 if (block == end_block && !end_block->IsLoopHeader()) return end;
2455 2458
2456 return LifetimePosition::GapFromInstructionIndex( 2459 return LifetimePosition::GapFromInstructionIndex(
2457 block->first_instruction_index()); 2460 block->first_instruction_index());
2458 } 2461 }
2459 2462
2460 2463
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 spill_operand); 3578 spill_operand);
3576 } 3579 }
3577 } 3580 }
3578 } 3581 }
3579 } 3582 }
3580 3583
3581 3584
3582 } // namespace compiler 3585 } // namespace compiler
3583 } // namespace internal 3586 } // namespace internal
3584 } // namespace v8 3587 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698