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())); |
} |