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

Unified Diff: src/compiler/register-allocator.cc

Issue 1036433002: [turbofan] Add RegisterAllocator::NewLiveRange() utility method. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc
index 9f804e744f1e99d39dede960731753cfa58464c6..7bf5bd578e50acc479ee4cc405fb89b7df121e5c 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -736,15 +736,19 @@ InstructionOperand* RegisterAllocator::AllocateFixed(
}
+LiveRange* RegisterAllocator::NewLiveRange(int index) {
+ // The LiveRange object itself can go in the local zone, but the
+ // InstructionOperand needs to go in the code zone, since it may survive
+ // register allocation.
+ return new (local_zone()) LiveRange(index, code_zone());
+}
+
+
LiveRange* RegisterAllocator::FixedLiveRangeFor(int index) {
DCHECK(index < config()->num_general_registers());
auto result = fixed_live_ranges()[index];
if (result == nullptr) {
- // TODO(titzer): add a utility method to allocate a new LiveRange:
- // The LiveRange object itself can go in this zone, but the
- // InstructionOperand needs
- // to go in the code zone, since it may survive register allocation.
- result = new (local_zone()) LiveRange(FixedLiveRangeID(index), code_zone());
+ result = NewLiveRange(FixedLiveRangeID(index));
DCHECK(result->IsFixed());
result->kind_ = GENERAL_REGISTERS;
SetLiveRangeAssignedRegister(result, index);
@@ -758,8 +762,7 @@ LiveRange* RegisterAllocator::FixedDoubleLiveRangeFor(int index) {
DCHECK(index < config()->num_aliased_double_registers());
auto result = fixed_double_live_ranges()[index];
if (result == nullptr) {
- result = new (local_zone())
- LiveRange(FixedDoubleLiveRangeID(index), code_zone());
+ result = NewLiveRange(FixedDoubleLiveRangeID(index));
DCHECK(result->IsFixed());
result->kind_ = DOUBLE_REGISTERS;
SetLiveRangeAssignedRegister(result, index);
@@ -775,7 +778,7 @@ LiveRange* RegisterAllocator::LiveRangeFor(int index) {
}
auto result = live_ranges()[index];
if (result == nullptr) {
- result = new (local_zone()) LiveRange(index, code_zone());
+ result = NewLiveRange(index);
live_ranges()[index] = result;
}
return result;
« 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