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