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

Unified Diff: src/compiler/typer.cc

Issue 1848243002: [turbofan] Introduce JSToInteger and JSToLength operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/compiler/operator-properties.cc ('k') | src/compiler/verifier.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 44a6a0834051182626164bb38bc5ccd464615aab..adaec2830642c69334f7433ff477440ff6d629a1 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -421,6 +421,11 @@ Type* Typer::Visitor::ToInteger(Type* type, Typer* t) {
// ES6 section 7.1.4 ToInteger ( argument )
type = ToNumber(type, t);
if (type->Is(t->cache_.kIntegerOrMinusZero)) return type;
+ if (type->Is(t->cache_.kIntegerOrMinusZeroOrNaN)) {
+ return Type::Union(
+ Type::Intersect(type, t->cache_.kIntegerOrMinusZero, t->zone()),
+ t->cache_.kSingletonZero, t->zone());
+ }
return t->cache_.kIntegerOrMinusZero;
}
@@ -1245,26 +1250,29 @@ Type* Typer::Visitor::TypeJSToBoolean(Node* node) {
return TypeUnaryOp(node, ToBoolean);
}
-
-Type* Typer::Visitor::TypeJSToNumber(Node* node) {
- return TypeUnaryOp(node, ToNumber);
+Type* Typer::Visitor::TypeJSToInteger(Node* node) {
+ return TypeUnaryOp(node, ToInteger);
}
-
-Type* Typer::Visitor::TypeJSToString(Node* node) {
- return TypeUnaryOp(node, ToString);
+Type* Typer::Visitor::TypeJSToLength(Node* node) {
+ return TypeUnaryOp(node, ToLength);
}
-
Type* Typer::Visitor::TypeJSToName(Node* node) {
return TypeUnaryOp(node, ToName);
}
+Type* Typer::Visitor::TypeJSToNumber(Node* node) {
+ return TypeUnaryOp(node, ToNumber);
+}
Type* Typer::Visitor::TypeJSToObject(Node* node) {
return TypeUnaryOp(node, ToObject);
}
+Type* Typer::Visitor::TypeJSToString(Node* node) {
+ return TypeUnaryOp(node, ToString);
+}
// JS object operators.
« no previous file with comments | « src/compiler/operator-properties.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698