Reviewers: Benedikt Meurer,

Message:
How about this?

Description:
[Turbofan] Only weaken types for Phi nodes.

We also need to fix the weakening to weaken unions with ranges in them.

BUG=

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

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

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


Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index f3fdaadaa94e5e09b9521fcf040020a8bb21354a..15229b60d4cfa80bd4ade16a77c1f8b8bde2ab62 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -365,9 +365,11 @@ class Typer::Visitor : public Reducer {
     if (NodeProperties::IsTyped(node)) {
       // Widen the bounds of a previously typed node.
       Bounds previous = NodeProperties::GetBounds(node);
-      // Speed up termination in the presence of range types:
-      current.upper = Weaken(current.upper, previous.upper);
-      current.lower = Weaken(current.lower, previous.lower);
+      if (node->opcode() == IrOpcode::kPhi) {
+        // Speed up termination in the presence of range types:
+        current.upper = Weaken(current.upper, previous.upper);
+        current.lower = Weaken(current.lower, previous.lower);
+      }

       // Types should not get less precise.
       DCHECK(previous.lower->Is(current.lower));
@@ -1309,16 +1311,14 @@ Type* Typer::Visitor::Weaken(Type* current_type, Type* previous_type) {
     return current_type;
   }

-  Type* previous_number =
-      Type::Intersect(previous_type, typer_->integer, zone());
- Type* current_number = Type::Intersect(current_type, typer_->integer, zone());
-  if (!current_number->IsRange() || !previous_number->IsRange()) {
+  Type::RangeType* previous =
+      Type::Intersect(previous_type, typer_->integer, zone())->GetRange();
+  Type::RangeType* current =
+      Type::Intersect(current_type, typer_->integer, zone())->GetRange();
+  if (current == nullptr || previous == nullptr) {
     return current_type;
   }

-  Type::RangeType* previous = previous_number->AsRange();
-  Type::RangeType* current = current_number->AsRange();
-
   double current_min = current->Min();
   double new_min = current_min;
   // Find the closest lower entry in the list of allowed


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