Reviewers: Benedikt Meurer, Jarin,
Description:
[turbofan] Greedy: Unset hints at eviction.
BUG=
Please review this at https://codereview.chromium.org/1313023003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+13, -5 lines):
M src/compiler/greedy-allocator.cc
Index: src/compiler/greedy-allocator.cc
diff --git a/src/compiler/greedy-allocator.cc
b/src/compiler/greedy-allocator.cc
index
63a2e436ee42e82390cc867dd473dfae5815beb6..444130aa1ea806e2647d7d375f4395384e6e5528
100644
--- a/src/compiler/greedy-allocator.cc
+++ b/src/compiler/greedy-allocator.cc
@@ -30,6 +30,14 @@ void UpdateOperands(LiveRange* range,
RegisterAllocationData* data) {
}
+void UnsetOperands(LiveRange* range, RegisterAllocationData* data) {
+ range->UnsetUseHints();
+ if (range->IsTopLevel() && range->TopLevel()->is_phi()) {
+ data->GetPhiMapValueFor(range->TopLevel())->UnsetAssignedRegister();
+ }
+}
+
+
LiveRange* Split(LiveRange* range, RegisterAllocationData* data,
LifetimePosition pos) {
DCHECK(range->Start() < pos && pos < range->End());
@@ -44,7 +52,6 @@ LiveRange* Split(LiveRange* range,
RegisterAllocationData* data,
// TODO(mtrofin): explain why splitting in gap START is always OK.
LifetimePosition GetSplitPositionForInstruction(const LiveRange* range,
- const InstructionSequence*
code,
int instruction_index) {
LifetimePosition ret = LifetimePosition::Invalid();
@@ -87,11 +94,11 @@ LifetimePosition GetLastResortSplitPosition(const
LiveRange* range,
for (UsePosition* pos = range->first_pos(); pos != nullptr;
pos = pos->next()) {
if (pos->type() != UsePositionType::kRequiresRegister) continue;
- LifetimePosition before = GetSplitPositionForInstruction(
- range, code, pos->pos().ToInstructionIndex());
+ LifetimePosition before =
+ GetSplitPositionForInstruction(range,
pos->pos().ToInstructionIndex());
if (before.IsValid()) return before;
LifetimePosition after = GetSplitPositionForInstruction(
- range, code, pos->pos().ToInstructionIndex() + 1);
+ range, pos->pos().ToInstructionIndex() + 1);
if (after.IsValid()) return after;
}
return LifetimePosition::Invalid();
@@ -261,6 +268,7 @@ void
GreedyAllocator::EvictAndRescheduleConflicts(unsigned reg_id,
DCHECK(conflict->HasRegisterAssigned());
CHECK(!conflict->TopLevel()->IsFixed());
conflict->UnsetAssignedRegister();
+ UnsetOperands(conflict, data());
UpdateWeightAtEviction(conflict);
scheduler().Schedule(conflict);
TRACE("Evicted range %d%d.\n", conflict->TopLevel()->vreg(),
@@ -292,7 +300,7 @@ void
GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
// Do not spill live range eagerly if use position that can benefit
from
// the register is too close to the start of live range.
auto split_pos = GetSplitPositionForInstruction(
- range, data()->code(), pos->pos().ToInstructionIndex());
+ range, pos->pos().ToInstructionIndex());
// There is no place to split, so we can't split and spill.
if (!split_pos.IsValid()) continue;
--
--
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.