| OLD | NEW |
| 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/date.h" | 8 #include "src/date.h" |
| 9 #include "src/types.h" | 9 #include "src/types.h" |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // The JSDate::weekday property always contains a tagged number in the range | 129 // The JSDate::weekday property always contains a tagged number in the range |
| 130 // [0, 6] or NaN. | 130 // [0, 6] or NaN. |
| 131 Type* const kJSDateWeekdayType = | 131 Type* const kJSDateWeekdayType = |
| 132 Type::Union(CreateRange(0, 6.0), Type::NaN(), zone()); | 132 Type::Union(CreateRange(0, 6.0), Type::NaN(), zone()); |
| 133 | 133 |
| 134 // The JSDate::year property always contains a tagged number in the signed | 134 // The JSDate::year property always contains a tagged number in the signed |
| 135 // small range or NaN. | 135 // small range or NaN. |
| 136 Type* const kJSDateYearType = | 136 Type* const kJSDateYearType = |
| 137 Type::Union(Type::SignedSmall(), Type::NaN(), zone()); | 137 Type::Union(Type::SignedSmall(), Type::NaN(), zone()); |
| 138 | 138 |
| 139 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ | |
| 140 Type* const k##TypeName##Array = CreateArray(k##TypeName); | |
| 141 TYPED_ARRAYS(TYPED_ARRAY) | |
| 142 #undef TYPED_ARRAY | |
| 143 | |
| 144 private: | 139 private: |
| 145 Type* CreateArray(Type* element) { return Type::Array(element, zone()); } | |
| 146 | |
| 147 Type* CreateArrayFunction(Type* array) { | |
| 148 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone()); | |
| 149 Type* arg2 = Type::Union(Type::Unsigned32(), Type::Undefined(), zone()); | |
| 150 Type* arg3 = arg2; | |
| 151 return Type::Function(array, arg1, arg2, arg3, zone()); | |
| 152 } | |
| 153 | |
| 154 template <typename T> | 140 template <typename T> |
| 155 Type* CreateRange() { | 141 Type* CreateRange() { |
| 156 return CreateRange(std::numeric_limits<T>::min(), | 142 return CreateRange(std::numeric_limits<T>::min(), |
| 157 std::numeric_limits<T>::max()); | 143 std::numeric_limits<T>::max()); |
| 158 } | 144 } |
| 159 | 145 |
| 160 Type* CreateRange(double min, double max) { | 146 Type* CreateRange(double min, double max) { |
| 161 return Type::Range(min, max, zone()); | 147 return Type::Range(min, max, zone()); |
| 162 } | 148 } |
| 163 | 149 |
| 164 Zone* zone() { return &zone_; } | 150 Zone* zone() { return &zone_; } |
| 165 }; | 151 }; |
| 166 | 152 |
| 167 } // namespace compiler | 153 } // namespace compiler |
| 168 } // namespace internal | 154 } // namespace internal |
| 169 } // namespace v8 | 155 } // namespace v8 |
| 170 | 156 |
| 171 #endif // V8_COMPILER_TYPE_CACHE_H_ | 157 #endif // V8_COMPILER_TYPE_CACHE_H_ |
| OLD | NEW |