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

Unified Diff: src/compiler/typer.cc

Issue 2296593002: [turbofan] Sanitize typing of Date builtins. (Closed)
Patch Set: Fix comment. Created 4 years, 4 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/type-cache.h ('k') | src/objects.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 543a40a47f604b89dd0e5ad6a710a5873c4b01cc..6a52cc7e79f1df42683d7c255805b17bff550953 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -1336,24 +1336,23 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
case kMathClz32:
return t->cache_.kZeroToThirtyTwo;
// Date functions.
- case kDateGetFullYear:
- return Type::Union(Type::Range(-271821.0, 275760.0, t->zone()),
- Type::NaN(), t->zone());
case kDateGetDate:
- return Type::Union(Type::Range(1.0, 31.0, t->zone()), Type::NaN(),
- t->zone());
+ return t->cache_.kJSDateDayType;
+ case kDateGetDay:
+ return t->cache_.kJSDateWeekdayType;
+ case kDateGetFullYear:
+ return t->cache_.kJSDateYearType;
case kDateGetHours:
- return Type::Union(Type::Range(0.0, 23.0, t->zone()), Type::NaN(),
- t->zone());
+ return t->cache_.kJSDateHourType;
case kDateGetMilliseconds:
- return Type::Union(Type::Range(0.0, 59.0, t->zone()), Type::NaN(),
+ return Type::Union(Type::Range(0.0, 999.0, t->zone()), Type::NaN(),
t->zone());
+ case kDateGetMinutes:
+ return t->cache_.kJSDateMinuteType;
case kDateGetMonth:
- return Type::Union(Type::Range(0.0, 11.0, t->zone()), Type::NaN(),
- t->zone());
+ return t->cache_.kJSDateMonthType;
case kDateGetSeconds:
- return Type::Union(Type::Range(0.0, 59.0, t->zone()), Type::NaN(),
- t->zone());
+ return t->cache_.kJSDateSecondType;
case kDateGetTime:
return t->cache_.kJSDateValueType;
// Number functions.
« no previous file with comments | « src/compiler/type-cache.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698