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

Unified Diff: src/compiler/typer.cc

Issue 1319703006: When typing phi nodes, weaken union of integer constants to a range. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed superfluous argument. Created 5 years, 3 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 | src/types.h » ('j') | 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 594e4bd61369e5b0caa6830127ab211a698722ed..cbf23f7ff98d85acb227613826c12f7726488351 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -197,6 +197,7 @@ class Typer::Visitor : public Reducer {
Bounds WrapContextBoundsForInput(Node* node);
Type* Weaken(Node* node, Type* current_type, Type* previous_type);
+ Type* WeakenConstants(Type* type);
Zone* zone() { return typer_->zone(); }
Isolate* isolate() { return typer_->isolate(); }
@@ -555,11 +556,26 @@ Bounds Typer::Visitor::TypeSelect(Node* node) {
}
+Type* Typer::Visitor::WeakenConstants(Type* type) {
+ Type* const integer = typer_->cache_.kInteger;
+ if (!type->Maybe(integer)) return type;
+ Type* myinteger = Type::Intersect(type, integer, zone());
Jarin 2015/09/14 08:06:29 Could you come up with a better name than myintege
+ if (myinteger->NumConstants() <= 1) return type;
+ return Type::Union(
+ type, Type::Range(myinteger->Min(), myinteger->Max(), typer_->zone()),
+ typer_->zone());
+}
+
+
Bounds Typer::Visitor::TypePhi(Node* node) {
int arity = node->op()->ValueInputCount();
Bounds bounds = Operand(node, 0);
for (int i = 1; i < arity; ++i) {
bounds = Bounds::Either(bounds, Operand(node, i), zone());
+ // In order to avoid huge unions, we weaken multiple integer constants
+ // to a single range.
+ bounds.upper = WeakenConstants(bounds.upper);
+ bounds.lower = WeakenConstants(bounds.lower);
}
return bounds;
}
« no previous file with comments | « no previous file | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698