Reviewers: Benedikt Meurer, Jarin,
Description:
[turbofan] Split before loops.
If the range doesn't have calls, but still fails to allocate, try and find a
split
position outside a loop.
BUG=
Please review this at https://codereview.chromium.org/1301393012/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+20, -1 lines):
M src/compiler/greedy-allocator.h
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
d6f48a2716e2be223b05c46c526dcbc4ca5a7a79..4eb6f16da950b85579a01173c01e1eb5900dc39c
100644
--- a/src/compiler/greedy-allocator.cc
+++ b/src/compiler/greedy-allocator.cc
@@ -476,9 +476,25 @@ LifetimePosition
GreedyAllocator::FindSplitPositionAfterCall(
}
+LifetimePosition GreedyAllocator::FindSplitPositionBeforeLoops(
+ LiveRange* range) {
+ LifetimePosition end = range->End();
+ if (end.ToInstructionIndex() >= code()->LastInstructionIndex()) {
+ end =
+ LifetimePosition::GapFromInstructionIndex(end.ToInstructionIndex()
- 1);
+ }
+ LifetimePosition pos = FindOptimalSplitPos(range->Start(), end);
+ pos = GetSplitPositionForInstruction(range, pos.ToInstructionIndex());
+ return pos;
+}
+
+
void GreedyAllocator::SplitOrSpillBlockedRange(LiveRange* range) {
if (TrySplitAroundCalls(range)) return;
- auto pos = GetLastResortSplitPosition(range, code());
+
+ LifetimePosition pos = FindSplitPositionBeforeLoops(range);
+
+ if (!pos.IsValid()) pos = GetLastResortSplitPosition(range, code());
if (pos.IsValid()) {
LiveRange* tail = Split(range, data(), pos);
DCHECK(tail != range);
Index: src/compiler/greedy-allocator.h
diff --git a/src/compiler/greedy-allocator.h
b/src/compiler/greedy-allocator.h
index
7b808cf8fb31fe3d6786b8a04e10b3aededdc0f5..8ac0bf138a28a611e14e88c31922271d977474a7
100644
--- a/src/compiler/greedy-allocator.h
+++ b/src/compiler/greedy-allocator.h
@@ -132,6 +132,9 @@ class GreedyAllocator final : public RegisterAllocator {
// were made, or false if no calls were found.
bool TrySplitAroundCalls(LiveRange* range);
+ // Find a split position at the outmost loop.
+ LifetimePosition FindSplitPositionBeforeLoops(LiveRange* range);
+
// Finds the first call instruction in the path of this range. Splits
before
// and requeues that segment (if any), spills the section over the call,
and
// returns the section after the call. The return is:
--
--
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.