Reviewers: Jarin, Benedikt Meurer,

Description:
[turbofan] Break dependency on RegisterAllocationData from Merge.

Found this while working on the unit tests for split/splinter/merge. The
dependency is unnecessary and hinders testability.

BUG=

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

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

Affected files (+6, -8 lines):
  M src/compiler/live-range-separator.cc
  M src/compiler/register-allocator.h
  M src/compiler/register-allocator.cc


Index: src/compiler/live-range-separator.cc
diff --git a/src/compiler/live-range-separator.cc b/src/compiler/live-range-separator.cc index a80259535a955a2c1cc0323cb84a8ae26808dca1..f34b0d41ce5a3e69a3b66b9e283d7405df936022 100644
--- a/src/compiler/live-range-separator.cc
+++ b/src/compiler/live-range-separator.cc
@@ -153,7 +153,9 @@ void LiveRangeMerger::Merge() {
     }
     TopLevelLiveRange *splinter_parent = range->splintered_from();

-    splinter_parent->Merge(range, data());
+    int to_remove = range->vreg();
+    splinter_parent->Merge(range, data()->allocation_zone());
+    data()->live_ranges()[to_remove] = nullptr;
   }
 }

Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc index f6c339234abb4d8a143d4858134e16fa272d5dac..8438b5534278dc186403848991f26017ee305180 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -887,13 +887,10 @@ void TopLevelLiveRange::UpdateSpillRangePostMerge(TopLevelLiveRange* merged) {
 }


-void TopLevelLiveRange::Merge(TopLevelLiveRange* other,
-                              RegisterAllocationData* data) {
+void TopLevelLiveRange::Merge(TopLevelLiveRange* other, Zone* zone) {
   DCHECK(Start() < other->Start());
   DCHECK(other->splintered_from() == this);

-  data->live_ranges()[other->vreg()] = nullptr;
-
   LiveRange* last_other = other->last_child();
   LiveRange* last_me = last_child();

@@ -919,8 +916,7 @@ void TopLevelLiveRange::Merge(TopLevelLiveRange* other,
   // register allocation splitting.
   LiveRange* after = last_insertion_point_->next();
   if (last_insertion_point_->End() > other->Start()) {
-    LiveRange* new_after =
- last_insertion_point_->SplitAt(other->Start(), data->allocation_zone()); + LiveRange* new_after = last_insertion_point_->SplitAt(other->Start(), zone);
     new_after->set_spilled(last_insertion_point_->spilled());
     if (!new_after->spilled())
       new_after->set_assigned_register(
Index: src/compiler/register-allocator.h
diff --git a/src/compiler/register-allocator.h b/src/compiler/register-allocator.h index cffe54778ac33ae2e337edf58bc1e135bdc3093d..9346fa65adeb89aa780b983baf2635114990f223 100644
--- a/src/compiler/register-allocator.h
+++ b/src/compiler/register-allocator.h
@@ -471,7 +471,7 @@ class TopLevelLiveRange final : public LiveRange {

   // Assuming other was splintered from this range, embeds other and its
   // children as part of the children sequence of this range.
-  void Merge(TopLevelLiveRange* other, RegisterAllocationData* data);
+  void Merge(TopLevelLiveRange* other, Zone* zone);

   // Spill range management.
   void SetSpillRange(SpillRange* 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