Reviewers: Jarin, Benedikt Meurer,

Description:
[turbofan] greedy: heuristic for memory operands

When we have a memory operand (HasSpillOperand() == true), and it
doesn't need a register immediately, split in an optimal position, which
is outside the outermost possible loop - just like Linear does.

This results in some modest improvements in perf, when compared
to baseline greedy. In particular Jetstream zlib x64: 4.66%, Life
(Emscripten x64) 11%; largest regression is in AreWeFastYet x64: 8% and
Corrections (Emsccripten x32) 10%

BUG=

Please review this at https://codereview.chromium.org/1306823005/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+6, -7 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 44f2d4f8160a4893cc3964e21fc0ecb6dd7629e5..5fdacb5e8236992e377c700f9ec9d5176fb8a7df 100644
--- a/src/compiler/greedy-allocator.cc
+++ b/src/compiler/greedy-allocator.cc
@@ -256,7 +256,7 @@ void GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
   for (size_t i = 0; i < initial_range_count; ++i) {
     auto range = data()->live_ranges()[i];
     if (!CanProcessRange(range)) continue;
-    if (range->HasNoSpillType()) continue;
+    if (!range->HasSpillOperand()) continue;

     LifetimePosition start = range->Start();
     TRACE("Live range %d:%d is defined by a spill operand.\n",
@@ -273,12 +273,11 @@ void GreedyAllocator::SplitAndSpillRangesDefinedByMemoryOperand() {
     } else if (pos->pos() > range->Start().NextStart()) {
// 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 = pos->pos();
-      if (data()->IsBlockBoundary(split_pos.Start())) {
-        split_pos = split_pos.Start();
-      } else {
-        split_pos = split_pos.PrevStart().End();
-      }
+      auto split_pos = GetSplitPositionForInstruction(
+          range, data()->code(), pos->pos().ToInstructionIndex());
+      split_pos =
+          FindOptimalSplitPos(range->Start().NextFullStart(), split_pos);
+
       Split(range, data(), split_pos);
       Spill(range);
     }


--
--
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.

Reply via email to