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

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

Issue 2355373002: [turbofan] Pre-spill ranges that have a slot use. (Closed)
Patch Set: [turbofan] Don't pre-spill ranges that don't even have a slot use. Created 4 years, 2 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 | « src/compiler/register-allocator.h ('k') | 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 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 const LiveRange* range, int instruction_index) { 2378 const LiveRange* range, int instruction_index) {
2379 LifetimePosition ret = LifetimePosition::Invalid(); 2379 LifetimePosition ret = LifetimePosition::Invalid();
2380 2380
2381 ret = LifetimePosition::GapFromInstructionIndex(instruction_index); 2381 ret = LifetimePosition::GapFromInstructionIndex(instruction_index);
2382 if (range->Start() >= ret || ret >= range->End()) { 2382 if (range->Start() >= ret || ret >= range->End()) {
2383 return LifetimePosition::Invalid(); 2383 return LifetimePosition::Invalid();
2384 } 2384 }
2385 return ret; 2385 return ret;
2386 } 2386 }
2387 2387
2388 2388 void RegisterAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
2389 void RegisterAllocator::SplitAndSpillRangesDefinedByMemoryOperand(
2390 bool operands_only) {
2391 size_t initial_range_count = data()->live_ranges().size(); 2389 size_t initial_range_count = data()->live_ranges().size();
2392 for (size_t i = 0; i < initial_range_count; ++i) { 2390 for (size_t i = 0; i < initial_range_count; ++i) {
2393 TopLevelLiveRange* range = data()->live_ranges()[i]; 2391 TopLevelLiveRange* range = data()->live_ranges()[i];
2394 if (!CanProcessRange(range)) continue; 2392 if (!CanProcessRange(range)) continue;
2395 if (!range->HasSpillOperand()) continue; 2393 if (range->HasNoSpillType() ||
2396 2394 (range->HasSpillRange() && !range->has_slot_use())) {
2395 continue;
2396 }
2397 LifetimePosition start = range->Start(); 2397 LifetimePosition start = range->Start();
2398 TRACE("Live range %d:%d is defined by a spill operand.\n", 2398 TRACE("Live range %d:%d is defined by a spill operand.\n",
2399 range->TopLevel()->vreg(), range->relative_id()); 2399 range->TopLevel()->vreg(), range->relative_id());
2400 LifetimePosition next_pos = start; 2400 LifetimePosition next_pos = start;
2401 if (next_pos.IsGapPosition()) { 2401 if (next_pos.IsGapPosition()) {
2402 next_pos = next_pos.NextStart(); 2402 next_pos = next_pos.NextStart();
2403 } 2403 }
2404 UsePosition* pos = range->NextUsePositionRegisterIsBeneficial(next_pos); 2404 UsePosition* pos = range->NextUsePositionRegisterIsBeneficial(next_pos);
2405 // If the range already has a spill operand and it doesn't need a 2405 // If the range already has a spill operand and it doesn't need a
2406 // register immediately, split it and spill the first part of the range. 2406 // register immediately, split it and spill the first part of the range.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 DCHECK(RegisterConfiguration::kMaxFPRegisters >= 2564 DCHECK(RegisterConfiguration::kMaxFPRegisters >=
2565 this->data()->config()->num_general_registers()); 2565 this->data()->config()->num_general_registers());
2566 } 2566 }
2567 2567
2568 2568
2569 void LinearScanAllocator::AllocateRegisters() { 2569 void LinearScanAllocator::AllocateRegisters() {
2570 DCHECK(unhandled_live_ranges().empty()); 2570 DCHECK(unhandled_live_ranges().empty());
2571 DCHECK(active_live_ranges().empty()); 2571 DCHECK(active_live_ranges().empty());
2572 DCHECK(inactive_live_ranges().empty()); 2572 DCHECK(inactive_live_ranges().empty());
2573 2573
2574 SplitAndSpillRangesDefinedByMemoryOperand(code()->VirtualRegisterCount() <= 2574 SplitAndSpillRangesDefinedByMemoryOperand();
2575 num_allocatable_registers());
2576 2575
2577 for (TopLevelLiveRange* range : data()->live_ranges()) { 2576 for (TopLevelLiveRange* range : data()->live_ranges()) {
2578 if (!CanProcessRange(range)) continue; 2577 if (!CanProcessRange(range)) continue;
2579 for (LiveRange* to_add = range; to_add != nullptr; 2578 for (LiveRange* to_add = range; to_add != nullptr;
2580 to_add = to_add->next()) { 2579 to_add = to_add->next()) {
2581 if (!to_add->spilled()) { 2580 if (!to_add->spilled()) {
2582 AddToUnhandledUnsorted(to_add); 2581 AddToUnhandledUnsorted(to_add);
2583 } 2582 }
2584 } 2583 }
2585 } 2584 }
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 } 3620 }
3622 } 3621 }
3623 } 3622 }
3624 } 3623 }
3625 } 3624 }
3626 3625
3627 3626
3628 } // namespace compiler 3627 } // namespace compiler
3629 } // namespace internal 3628 } // namespace internal
3630 } // namespace v8 3629 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698