Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: src/compiler/typer.cc

Issue 1011103003: [Turbofan] Only weaken types for Phi nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698