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

Unified Diff: src/compiler/type-cache.h

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 | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/type-cache.h
diff --git a/src/compiler/type-cache.h b/src/compiler/type-cache.h
index 1f2dda816df3fd295ee83a54d9146abde1aeac56..f93907fe95ed0e299a10a7d045c158fed1e79706 100644
--- a/src/compiler/type-cache.h
+++ b/src/compiler/type-cache.h
@@ -104,12 +104,46 @@ class TypeCache final {
Type* const kStringLengthType =
CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned());
- // The JSDate::value properties always contains a tagged number in the range
+ // The JSDate::day property always contains a tagged number in the range
+ // [1, 31] or NaN.
+ Type* const kJSDateDayType =
+ Type::Union(CreateRange(1, 31.0), Type::NaN(), zone());
+
+ // The JSDate::hour property always contains a tagged number in the range
+ // [0, 23] or NaN.
+ Type* const kJSDateHourType =
+ Type::Union(CreateRange(0, 23.0), Type::NaN(), zone());
+
+ // The JSDate::minute property always contains a tagged number in the range
+ // [0, 59] or NaN.
+ Type* const kJSDateMinuteType =
+ Type::Union(CreateRange(0, 59.0), Type::NaN(), zone());
+
+ // The JSDate::month property always contains a tagged number in the range
+ // [0, 11] or NaN.
+ Type* const kJSDateMonthType =
+ Type::Union(CreateRange(0, 11.0), Type::NaN(), zone());
+
+ // The JSDate::second property always contains a tagged number in the range
+ // [0, 59] or NaN.
+ Type* const kJSDateSecondType = kJSDateMinuteType;
+
+ // The JSDate::value property always contains a tagged number in the range
// [-kMaxTimeInMs, kMaxTimeInMs] or NaN.
Type* const kJSDateValueType = Type::Union(
CreateRange(-DateCache::kMaxTimeInMs, DateCache::kMaxTimeInMs),
Type::NaN(), zone());
+ // The JSDate::weekday property always contains a tagged number in the range
+ // [0, 6] or NaN.
+ Type* const kJSDateWeekdayType =
+ Type::Union(CreateRange(0, 6.0), Type::NaN(), zone());
+
+ // The JSDate::year property always contains a tagged number in the signed
+ // small range or NaN.
+ Type* const kJSDateYearType =
+ Type::Union(Type::SignedSmall(), Type::NaN(), zone());
+
#define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \
Type* const k##TypeName##Array = CreateArray(k##TypeName);
TYPED_ARRAYS(TYPED_ARRAY)
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698