| 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 "src/types.h" | 5 #include "src/types.h" |
| 6 | 6 |
| 7 #include "src/ostreams.h" | 7 #include "src/ostreams.h" |
| 8 #include "src/types-inl.h" | 8 #include "src/types-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 return Lub(i::HeapObject::cast(value)->map()); | 117 return Lub(i::HeapObject::cast(value)->map()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 template<class Config> | 121 template<class Config> |
| 122 int TypeImpl<Config>::BitsetType::Lub(double value) { | 122 int TypeImpl<Config>::BitsetType::Lub(double value) { |
| 123 DisallowHeapAllocation no_allocation; | 123 DisallowHeapAllocation no_allocation; |
| 124 if (i::IsMinusZero(value)) return kMinusZero; | 124 if (i::IsMinusZero(value)) return kMinusZero; |
| 125 if (std::isnan(value)) return kNaN; | 125 if (std::isnan(value)) return kNaN; |
| 126 if (IsUint32Double(value)) { | 126 if (IsUint32Double(value)) return Lub(FastD2UI(value)); |
| 127 uint32_t u = FastD2UI(value); | 127 if (IsInt32Double(value)) return Lub(FastD2I(value)); |
| 128 if (u < 0x40000000u) return kUnsignedSmall; | |
| 129 if (u < 0x80000000u) { | |
| 130 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; | |
| 131 } | |
| 132 return kOtherUnsigned32; | |
| 133 } | |
| 134 if (IsInt32Double(value)) { | |
| 135 int32_t i = FastD2I(value); | |
| 136 DCHECK(i < 0); | |
| 137 if (i >= -0x40000000) return kOtherSignedSmall; | |
| 138 return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall; | |
| 139 } | |
| 140 return kOtherNumber; | 128 return kOtherNumber; |
| 141 } | 129 } |
| 142 | 130 |
| 143 | 131 |
| 132 template<class Config> |
| 133 int TypeImpl<Config>::BitsetType::Lub(int32_t value) { |
| 134 if (value >= 0x40000000) { |
| 135 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; |
| 136 } |
| 137 if (value >= 0) return kUnsignedSmall; |
| 138 if (value >= -0x40000000) return kOtherSignedSmall; |
| 139 return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall; |
| 140 } |
| 141 |
| 142 |
| 143 template<class Config> |
| 144 int TypeImpl<Config>::BitsetType::Lub(uint32_t value) { |
| 145 DisallowHeapAllocation no_allocation; |
| 146 if (value >= 0x80000000u) return kOtherUnsigned32; |
| 147 if (value >= 0x40000000u) { |
| 148 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; |
| 149 } |
| 150 return kUnsignedSmall; |
| 151 } |
| 152 |
| 153 |
| 144 template<class Config> | 154 template<class Config> |
| 145 int TypeImpl<Config>::BitsetType::Lub(i::Map* map) { | 155 int TypeImpl<Config>::BitsetType::Lub(i::Map* map) { |
| 146 DisallowHeapAllocation no_allocation; | 156 DisallowHeapAllocation no_allocation; |
| 147 switch (map->instance_type()) { | 157 switch (map->instance_type()) { |
| 148 case STRING_TYPE: | 158 case STRING_TYPE: |
| 149 case ASCII_STRING_TYPE: | 159 case ASCII_STRING_TYPE: |
| 150 case CONS_STRING_TYPE: | 160 case CONS_STRING_TYPE: |
| 151 case CONS_ASCII_STRING_TYPE: | 161 case CONS_ASCII_STRING_TYPE: |
| 152 case SLICED_STRING_TYPE: | 162 case SLICED_STRING_TYPE: |
| 153 case SLICED_ASCII_STRING_TYPE: | 163 case SLICED_ASCII_STRING_TYPE: |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; | 960 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; |
| 951 | 961 |
| 952 template TypeImpl<ZoneTypeConfig>::TypeHandle | 962 template TypeImpl<ZoneTypeConfig>::TypeHandle |
| 953 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( | 963 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( |
| 954 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); | 964 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); |
| 955 template TypeImpl<HeapTypeConfig>::TypeHandle | 965 template TypeImpl<HeapTypeConfig>::TypeHandle |
| 956 TypeImpl<HeapTypeConfig>::Convert<Type>( | 966 TypeImpl<HeapTypeConfig>::Convert<Type>( |
| 957 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); | 967 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); |
| 958 | 968 |
| 959 } } // namespace v8::internal | 969 } } // namespace v8::internal |
| OLD | NEW |