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

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

Issue 2652153005: [turbofan] Correct regalloc blocked register behavior (Closed)
Patch Set: Handle case when range ends at the instruction with blocking regs Created 3 years, 11 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 | test/mjsunit/regress/regress-5888.js » ('j') | 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 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 } 3271 }
3272 } 3272 }
3273 3273
3274 LifetimePosition pos = use_pos[reg]; 3274 LifetimePosition pos = use_pos[reg];
3275 3275
3276 if (pos < register_use->pos()) { 3276 if (pos < register_use->pos()) {
3277 if (LifetimePosition::ExistsGapPositionBetween(current->Start(), 3277 if (LifetimePosition::ExistsGapPositionBetween(current->Start(),
3278 register_use->pos())) { 3278 register_use->pos())) {
3279 SpillBetween(current, current->Start(), register_use->pos()); 3279 SpillBetween(current, current->Start(), register_use->pos());
3280 } else { 3280 } else {
3281 SetLiveRangeAssignedRegister(current, reg); 3281 // We can't spill up to the first register use, because there is no gap
3282 SplitAndSpillIntersecting(current); 3282 // where the fill before the register use may happen. This happens when
3283 // there is high register pressure, we are at the beginning of an
3284 // instruction, we are the input to that instruction, and we can't hold
3285 // on to the register past the instruction (we likely lose due to an
3286 // output or a temp).
3287 // We give the `reg` register to this range, but then we need to spill
3288 // until the next register use, if any.
3289 LifetimePosition after_this_reg_use = register_use->pos().NextFullStart();
3290 if (after_this_reg_use >= current->End()) {
3291 // The range ends at this instruction, since the end is at or before
3292 // the next gap. It should follow that there is no other use either.
3293 DCHECK_NULL(register_use->next());
3294 SetLiveRangeAssignedRegister(current, reg);
3295 } else {
3296 const UsePosition* next_reg_pos = register_use->next();
3297 for (; next_reg_pos != nullptr; next_reg_pos = next_reg_pos->next()) {
3298 if (next_reg_pos->type() == UsePositionType::kRequiresRegister) break;
3299 }
3300 SetLiveRangeAssignedRegister(current, reg);
3301 if (next_reg_pos == nullptr) {
3302 SpillAfter(current, after_this_reg_use);
3303 } else {
3304 SpillBetween(current, after_this_reg_use, next_reg_pos->pos());
3305 }
3306 }
3283 } 3307 }
3284 return; 3308 return;
3285 } 3309 }
3286 3310
3287 if (block_pos[reg] < current->End()) { 3311 if (block_pos[reg] < current->End()) {
3288 // Register becomes blocked before the current range end. Split before that 3312 // Register becomes blocked before the current range end. Split before that
3289 // position. 3313 // position.
3290 LiveRange* tail = 3314 LiveRange* tail =
3291 SplitBetween(current, current->Start(), block_pos[reg].Start()); 3315 SplitBetween(current, current->Start(), block_pos[reg].Start());
3292 AddToUnhandledSorted(tail); 3316 AddToUnhandledSorted(tail);
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
4007 } 4031 }
4008 } 4032 }
4009 } 4033 }
4010 } 4034 }
4011 } 4035 }
4012 4036
4013 4037
4014 } // namespace compiler 4038 } // namespace compiler
4015 } // namespace internal 4039 } // namespace internal
4016 } // namespace v8 4040 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5888.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698