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