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

Unified Diff: src/compiler/typer.cc

Issue 968773004: [turbofan] Use the typer to statically detect Smis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « src/compiler/simplified-lowering.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('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 9af65597bf5527e9d60ca3c67b38300726cfe1bb..25597eec652c6b258e68822b687cc56eaebcc642 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -1616,16 +1616,15 @@ Bounds Typer::Visitor::TypeStringAdd(Node* node) {
}
-static Type* ChangeRepresentation(Type* type, Type* rep, Zone* zone) {
- // TODO(neis): Enable when expressible.
- /*
- return Type::Union(
- Type::Intersect(type, Type::Semantic(), zone),
- Type::Intersect(rep, Type::Representation(), zone), zone);
- */
- return type;
+namespace {
+
+Type* ChangeRepresentation(Type* type, Type* rep, Zone* zone) {
+ return Type::Union(Type::Semantic(type, zone),
+ Type::Representation(rep, zone), zone);
}
+} // namespace
+
Bounds Typer::Visitor::TypeChangeTaggedToInt32(Node* node) {
Bounds arg = Operand(node, 0);
@@ -1657,9 +1656,12 @@ Bounds Typer::Visitor::TypeChangeTaggedToFloat64(Node* node) {
Bounds Typer::Visitor::TypeChangeInt32ToTagged(Node* node) {
Bounds arg = Operand(node, 0);
// TODO(neis): DCHECK(arg.upper->Is(Type::Signed32()));
- return Bounds(
- ChangeRepresentation(arg.lower, Type::Tagged(), zone()),
- ChangeRepresentation(arg.upper, Type::Tagged(), zone()));
+ Type* lower_rep = arg.lower->Is(Type::SignedSmall()) ? Type::TaggedSigned()
+ : Type::Tagged();
+ Type* upper_rep = arg.upper->Is(Type::SignedSmall()) ? Type::TaggedSigned()
+ : Type::Tagged();
+ return Bounds(ChangeRepresentation(arg.lower, lower_rep, zone()),
+ ChangeRepresentation(arg.upper, upper_rep, zone()));
}
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698