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 #include <iomanip> | 5 #include <iomanip> |
6 | 6 |
7 #include "src/types.h" | 7 #include "src/types.h" |
8 | 8 |
9 #include "src/ostreams.h" | 9 #include "src/ostreams.h" |
10 #include "src/types-inl.h" | 10 #include "src/types-inl.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 TypeImpl<Config>::BitsetType::Lub(double value) { | 276 TypeImpl<Config>::BitsetType::Lub(double value) { |
277 DisallowHeapAllocation no_allocation; | 277 DisallowHeapAllocation no_allocation; |
278 if (i::IsMinusZero(value)) return kMinusZero; | 278 if (i::IsMinusZero(value)) return kMinusZero; |
279 if (std::isnan(value)) return kNaN; | 279 if (std::isnan(value)) return kNaN; |
280 if (IsUint32Double(value) || IsInt32Double(value)) return Lub(value, value); | 280 if (IsUint32Double(value) || IsInt32Double(value)) return Lub(value, value); |
281 return kOtherNumber; | 281 return kOtherNumber; |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 // Minimum values of regular numeric bitsets when SmiValuesAre31Bits. | 285 // Minimum values of regular numeric bitsets when SmiValuesAre31Bits. |
286 template<class Config> | 286 template <class Config> |
287 const typename TypeImpl<Config>::BitsetType::BitsetMin | 287 const typename TypeImpl<Config>::BitsetType::BitsetMin |
288 TypeImpl<Config>::BitsetType::BitsetMins31[] = { | 288 TypeImpl<Config>::BitsetType::BitsetMins31[] = { |
289 {kOtherNumber, -V8_INFINITY}, | 289 {kOtherNumber, -V8_INFINITY}, |
290 {kOtherSigned32, kMinInt}, | 290 {kOtherSigned32, kMinInt}, |
291 {kOtherSignedSmall, -0x40000000}, | 291 {kNegativeSignedSmall, -0x40000000}, |
292 {kUnsignedSmall, 0}, | 292 {kUnsignedSmall, 0}, |
293 {kOtherUnsigned31, 0x40000000}, | 293 {kOtherUnsigned31, 0x40000000}, |
294 {kOtherUnsigned32, 0x80000000}, | 294 {kOtherUnsigned32, 0x80000000}, |
295 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1} | 295 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}}; |
296 }; | |
297 | 296 |
298 | 297 |
299 // Minimum values of regular numeric bitsets when SmiValuesAre32Bits. | 298 // Minimum values of regular numeric bitsets when SmiValuesAre32Bits. |
300 // OtherSigned32 and OtherUnsigned31 are empty (see the diagrams in types.h). | 299 // OtherSigned32 and OtherUnsigned31 are empty (see the diagrams in types.h). |
301 template<class Config> | 300 template <class Config> |
302 const typename TypeImpl<Config>::BitsetType::BitsetMin | 301 const typename TypeImpl<Config>::BitsetType::BitsetMin |
303 TypeImpl<Config>::BitsetType::BitsetMins32[] = { | 302 TypeImpl<Config>::BitsetType::BitsetMins32[] = { |
304 {kOtherNumber, -V8_INFINITY}, | 303 {kOtherNumber, -V8_INFINITY}, |
305 {kOtherSignedSmall, kMinInt}, | 304 {kNegativeSignedSmall, kMinInt}, |
306 {kUnsignedSmall, 0}, | 305 {kUnsignedSmall, 0}, |
307 {kOtherUnsigned32, 0x80000000}, | 306 {kOtherUnsigned32, 0x80000000}, |
308 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1} | 307 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}}; |
309 }; | |
310 | 308 |
311 | 309 |
312 template<class Config> | 310 template<class Config> |
313 typename TypeImpl<Config>::bitset | 311 typename TypeImpl<Config>::bitset |
314 TypeImpl<Config>::BitsetType::Lub(double min, double max) { | 312 TypeImpl<Config>::BitsetType::Lub(double min, double max) { |
315 DisallowHeapAllocation no_allocation; | 313 DisallowHeapAllocation no_allocation; |
316 int lub = kNone; | 314 int lub = kNone; |
317 const BitsetMin* mins = BitsetMins(); | 315 const BitsetMin* mins = BitsetMins(); |
318 | 316 |
| 317 // Make sure the min-max range touches 0, so we are guaranteed no holes |
| 318 // in unions of valid bitsets. |
| 319 if (max < -1) max = -1; |
| 320 if (min > 0) min = 0; |
| 321 |
319 for (size_t i = 1; i < BitsetMinsSize(); ++i) { | 322 for (size_t i = 1; i < BitsetMinsSize(); ++i) { |
320 if (min < mins[i].min) { | 323 if (min < mins[i].min) { |
321 lub |= mins[i-1].bits; | 324 lub |= mins[i-1].bits; |
322 if (max < mins[i].min) return lub; | 325 if (max < mins[i].min) return lub; |
323 } | 326 } |
324 } | 327 } |
325 return lub |= mins[BitsetMinsSize()-1].bits; | 328 return lub |= mins[BitsetMinsSize()-1].bits; |
326 } | 329 } |
327 | 330 |
328 | 331 |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 os << name; | 982 os << name; |
980 return; | 983 return; |
981 } | 984 } |
982 | 985 |
983 static const bitset named_bitsets[] = { | 986 static const bitset named_bitsets[] = { |
984 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type), | 987 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type), |
985 REPRESENTATION_BITSET_TYPE_LIST(BITSET_CONSTANT) | 988 REPRESENTATION_BITSET_TYPE_LIST(BITSET_CONSTANT) |
986 #undef BITSET_CONSTANT | 989 #undef BITSET_CONSTANT |
987 | 990 |
988 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type), | 991 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type), |
| 992 INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT) |
989 SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT) | 993 SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT) |
990 #undef BITSET_CONSTANT | 994 #undef BITSET_CONSTANT |
991 }; | 995 }; |
992 | 996 |
993 bool is_first = true; | 997 bool is_first = true; |
994 os << "("; | 998 os << "("; |
995 for (int i(arraysize(named_bitsets) - 1); bits != 0 && i >= 0; --i) { | 999 for (int i(arraysize(named_bitsets) - 1); bits != 0 && i >= 0; --i) { |
996 bitset subset = named_bitsets[i]; | 1000 bitset subset = named_bitsets[i]; |
997 if ((bits & subset) == subset) { | 1001 if ((bits & subset) == subset) { |
998 if (!is_first) os << " | "; | 1002 if (!is_first) os << " | "; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; | 1096 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; |
1093 | 1097 |
1094 template TypeImpl<ZoneTypeConfig>::TypeHandle | 1098 template TypeImpl<ZoneTypeConfig>::TypeHandle |
1095 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( | 1099 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( |
1096 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); | 1100 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); |
1097 template TypeImpl<HeapTypeConfig>::TypeHandle | 1101 template TypeImpl<HeapTypeConfig>::TypeHandle |
1098 TypeImpl<HeapTypeConfig>::Convert<Type>( | 1102 TypeImpl<HeapTypeConfig>::Convert<Type>( |
1099 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); | 1103 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); |
1100 | 1104 |
1101 } } // namespace v8::internal | 1105 } } // namespace v8::internal |
OLD | NEW |