Reviewers: Jarin, Benedikt Meurer,

Description:
[turbofan] Re-wire greedy.

We completely un-wired the greedy allocator to focus on the
stackchecks in loops (splintering) work. This change re-wires greedy,
still behind its flag. For now, enabling the greedy allocator disables
the stackchecks in loops feature (and range splintering), so that we are
at the baseline we left it at.

The main contribution in this change is adapting the codebase after
the live range model refactoring, whereby RegisterAllocationData's
live_ranges() contains just top-level ranges, and children are accessed
via their parents.

BUG=

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

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

Affected files (+17, -9 lines):
  M src/compiler/greedy-allocator.cc
  M src/compiler/pipeline.cc
  M src/flag-definitions.h


Index: src/compiler/greedy-allocator.cc
diff --git a/src/compiler/greedy-allocator.cc b/src/compiler/greedy-allocator.cc index e1f13a64d4d8173850a7c8370071ca0260378410..44f2d4f8160a4893cc3964e21fc0ecb6dd7629e5 100644
--- a/src/compiler/greedy-allocator.cc
+++ b/src/compiler/greedy-allocator.cc
@@ -164,8 +164,12 @@ void GreedyAllocator::PreallocateFixedRanges() {

 void GreedyAllocator::ScheduleAllocationCandidates() {
   for (auto range : data()->live_ranges()) {
-    if (CanProcessRange(range) && !range->spilled()) {
-      scheduler().Schedule(range);
+    if (CanProcessRange(range)) {
+ for (LiveRange* child = range; child != nullptr; child = child->next()) {
+        if (!child->spilled()) {
+          scheduler().Schedule(child);
+        }
+      }
     }
   }
 }
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 1cbd1594195c198882cd305a0e58e02729b43479..bd03020965aafd5f6d0c4c96e66c4ef0610a0672 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -1354,9 +1354,13 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
     Run<SplinterLiveRangesPhase>();
   }

- // TODO(mtrofin): re-enable greedy once we have bots for range preprocessing.
-  Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>();
-  Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>();
+  if (FLAG_turbo_greedy_regalloc) {
+    Run<AllocateGeneralRegistersPhase<GreedyAllocator>>();
+    Run<AllocateDoubleRegistersPhase<GreedyAllocator>>();
+  } else {
+    Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>();
+    Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>();
+  }

   if (FLAG_turbo_preprocess_ranges) {
     Run<MergeSplintersPhase>();
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 19769f16047c29f7cc0e625a0ef8718138f3259b..f0d8d4698dc819dfdc5bbabbf2586cb1f311e5cb 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -409,10 +409,10 @@ DEFINE_BOOL(turbo_greedy_regalloc, false, "use the greedy register allocator")
 DEFINE_BOOL(turbo_preprocess_ranges, true,
             "run pre-register allocation heuristics")
 DEFINE_BOOL(turbo_loop_stackcheck, true, "enable stack checks in loops")
-// TODO(mtrofin): remove these implications, as they are here just for trybot
-// purposes.
-DEFINE_IMPLICATION(turbo_greedy_regalloc, turbo_preprocess_ranges)
-DEFINE_IMPLICATION(turbo_greedy_regalloc, turbo_loop_stackcheck)
+
+// TODO(mtrofin): remove the 2 implications.
+DEFINE_NEG_IMPLICATION(turbo_greedy_regalloc, turbo_preprocess_ranges)
+DEFINE_NEG_IMPLICATION(turbo_greedy_regalloc, turbo_loop_stackcheck)

 DEFINE_IMPLICATION(turbo, turbo_asm_deoptimization)
DEFINE_STRING(turbo_filter, "~~", "optimization filter for TurboFan compiler")


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