Reviewers: dcarney,
Description:
[turbofan] Add RegisterAllocator::NewLiveRange() utility method.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/1036433002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+14, -8 lines):
M src/compiler/register-allocator.h
M src/compiler/register-allocator.cc
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;
Index: src/compiler/register-allocator.h
diff --git a/src/compiler/register-allocator.h
b/src/compiler/register-allocator.h
index
91d3174cd3622d39a74ec60f83077ab5c945b506..9ee778d0bd358d37a58fcafb1077b6398a376acf
100644
--- a/src/compiler/register-allocator.h
+++ b/src/compiler/register-allocator.h
@@ -470,6 +470,9 @@ class RegisterAllocator FINAL : public ZoneObject {
// Returns the register kind required by the given virtual register.
RegisterKind RequiredRegisterKind(int virtual_register) const;
+ // Creates a new live range.
+ LiveRange* NewLiveRange(int index);
+
// This zone is for InstructionOperands and moves that live beyond
register
// allocation.
Zone* code_zone() const { return code()->zone(); }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.