Reviewers: Benedikt Meurer, Jarin (OOO),

Description:
[turbofan] Optimize Splinter by remembering where it left
off.

Splintering relies on DetachAt, which in turn relies on
FirstSearchIntervalForPosition to find the first UseInterval
to split, given a position. The later API (Find...) has an
optimization for linear traversals. Splintering traverses
linearly (block by block), so we leverage the same
optimization by moving current_interval_ forward.

(Also added an unrelated TODO.)

BUG=

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

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

Affected files (+10, -0 lines):
  M src/compiler/register-allocator.cc


Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc index f6c339234abb4d8a143d4858134e16fa272d5dac..563c9a276d8d0da93cf1b7b0791f86566e22029b 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -825,6 +825,12 @@ void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,
   result->set_spill_type(spill_type());

   if (start <= Start()) {
+ // TODO(mtrofin): here, the TopLevel part is in the deferred range, so we + // may want to continue processing the splinter. However, if the value is + // defined in a cold block, and then used in a hot block, it follows that
+    // it should terminate on the RHS of a phi, defined on the hot path. We
+ // should check this, however, this may not be the place, because we don't
+    // have access to the instruction sequence.
     DCHECK(end < End());
     DetachAt(end, result, zone);
     next_ = nullptr;
@@ -844,6 +850,10 @@ void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,

     next_ = end_part.next_;
     last_interval_->set_next(end_part.first_interval_);
+ // The next splinter will happen either at or after the current interval.
+    // We can optimize DetachAt by setting current_interval_ accordingly,
+    // which will then be picked up by FirstSearchIntervalForPosition.
+    current_interval_ = last_interval_;
     last_interval_ = end_part.last_interval_;




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