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

Side by Side Diff: src/compiler/type-cache.h

Issue 2528853003: [turbofan] Infer proper type for calls to Date.now. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_TYPE_CACHE_H_ 5 #ifndef V8_COMPILER_TYPE_CACHE_H_
6 #define V8_COMPILER_TYPE_CACHE_H_ 6 #define V8_COMPILER_TYPE_CACHE_H_
7 7
8 #include "src/compiler/types.h" 8 #include "src/compiler/types.h"
9 #include "src/date.h" 9 #include "src/date.h"
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 Type* const kJSArrayLengthType = Type::Unsigned32(); 90 Type* const kJSArrayLengthType = Type::Unsigned32();
91 91
92 // The JSTyped::length property always contains a tagged number in the range 92 // The JSTyped::length property always contains a tagged number in the range
93 // [0, kMaxSmiValue]. 93 // [0, kMaxSmiValue].
94 Type* const kJSTypedArrayLengthType = Type::UnsignedSmall(); 94 Type* const kJSTypedArrayLengthType = Type::UnsignedSmall();
95 95
96 // The String::length property always contains a smi in the range 96 // The String::length property always contains a smi in the range
97 // [0, String::kMaxLength]. 97 // [0, String::kMaxLength].
98 Type* const kStringLengthType = CreateRange(0.0, String::kMaxLength); 98 Type* const kStringLengthType = CreateRange(0.0, String::kMaxLength);
99 99
100 // A time value always contains a tagged number in the range
101 // [-kMaxTimeInMs, kMaxTimeInMs].
102 Type* const kTimeValueType =
103 CreateRange(-DateCache::kMaxTimeInMs, DateCache::kMaxTimeInMs);
104
100 // The JSDate::day property always contains a tagged number in the range 105 // The JSDate::day property always contains a tagged number in the range
101 // [1, 31] or NaN. 106 // [1, 31] or NaN.
102 Type* const kJSDateDayType = 107 Type* const kJSDateDayType =
103 Type::Union(CreateRange(1, 31.0), Type::NaN(), zone()); 108 Type::Union(CreateRange(1, 31.0), Type::NaN(), zone());
104 109
105 // The JSDate::hour property always contains a tagged number in the range 110 // The JSDate::hour property always contains a tagged number in the range
106 // [0, 23] or NaN. 111 // [0, 23] or NaN.
107 Type* const kJSDateHourType = 112 Type* const kJSDateHourType =
108 Type::Union(CreateRange(0, 23.0), Type::NaN(), zone()); 113 Type::Union(CreateRange(0, 23.0), Type::NaN(), zone());
109 114
110 // The JSDate::minute property always contains a tagged number in the range 115 // The JSDate::minute property always contains a tagged number in the range
111 // [0, 59] or NaN. 116 // [0, 59] or NaN.
112 Type* const kJSDateMinuteType = 117 Type* const kJSDateMinuteType =
113 Type::Union(CreateRange(0, 59.0), Type::NaN(), zone()); 118 Type::Union(CreateRange(0, 59.0), Type::NaN(), zone());
114 119
115 // The JSDate::month property always contains a tagged number in the range 120 // The JSDate::month property always contains a tagged number in the range
116 // [0, 11] or NaN. 121 // [0, 11] or NaN.
117 Type* const kJSDateMonthType = 122 Type* const kJSDateMonthType =
118 Type::Union(CreateRange(0, 11.0), Type::NaN(), zone()); 123 Type::Union(CreateRange(0, 11.0), Type::NaN(), zone());
119 124
120 // The JSDate::second property always contains a tagged number in the range 125 // The JSDate::second property always contains a tagged number in the range
121 // [0, 59] or NaN. 126 // [0, 59] or NaN.
122 Type* const kJSDateSecondType = kJSDateMinuteType; 127 Type* const kJSDateSecondType = kJSDateMinuteType;
123 128
124 // The JSDate::value property always contains a tagged number in the range 129 // The JSDate::value property always contains a tagged number in the range
125 // [-kMaxTimeInMs, kMaxTimeInMs] or NaN. 130 // [-kMaxTimeInMs, kMaxTimeInMs] or NaN.
126 Type* const kJSDateValueType = Type::Union( 131 Type* const kJSDateValueType =
127 CreateRange(-DateCache::kMaxTimeInMs, DateCache::kMaxTimeInMs), 132 Type::Union(kTimeValueType, Type::NaN(), zone());
128 Type::NaN(), zone());
129 133
130 // The JSDate::weekday property always contains a tagged number in the range 134 // The JSDate::weekday property always contains a tagged number in the range
131 // [0, 6] or NaN. 135 // [0, 6] or NaN.
132 Type* const kJSDateWeekdayType = 136 Type* const kJSDateWeekdayType =
133 Type::Union(CreateRange(0, 6.0), Type::NaN(), zone()); 137 Type::Union(CreateRange(0, 6.0), Type::NaN(), zone());
134 138
135 // The JSDate::year property always contains a tagged number in the signed 139 // The JSDate::year property always contains a tagged number in the signed
136 // small range or NaN. 140 // small range or NaN.
137 Type* const kJSDateYearType = 141 Type* const kJSDateYearType =
138 Type::Union(Type::SignedSmall(), Type::NaN(), zone()); 142 Type::Union(Type::SignedSmall(), Type::NaN(), zone());
(...skipping 10 matching lines...) Expand all
149 } 153 }
150 154
151 Zone* zone() { return &zone_; } 155 Zone* zone() { return &zone_; }
152 }; 156 };
153 157
154 } // namespace compiler 158 } // namespace compiler
155 } // namespace internal 159 } // namespace internal
156 } // namespace v8 160 } // namespace v8
157 161
158 #endif // V8_COMPILER_TYPE_CACHE_H_ 162 #endif // V8_COMPILER_TYPE_CACHE_H_
OLDNEW
« 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