Index: src/types.cc |
diff --git a/src/types.cc b/src/types.cc |
index 6205c4a8d810ddd76c8c3f6045a551f018ce81ef..c4e32f7823e6a15ac684a163c864b5de929bcc25 100644 |
--- a/src/types.cc |
+++ b/src/types.cc |
@@ -123,21 +123,31 @@ int TypeImpl<Config>::BitsetType::Lub(double value) { |
DisallowHeapAllocation no_allocation; |
if (i::IsMinusZero(value)) return kMinusZero; |
if (std::isnan(value)) return kNaN; |
- if (IsUint32Double(value)) { |
- uint32_t u = FastD2UI(value); |
- if (u < 0x40000000u) return kUnsignedSmall; |
- if (u < 0x80000000u) { |
- return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; |
- } |
- return kOtherUnsigned32; |
+ if (IsUint32Double(value)) return Lub(FastD2UI(value)); |
+ if (IsInt32Double(value)) return Lub(FastD2I(value)); |
+ return kOtherNumber; |
+} |
+ |
+ |
+template<class Config> |
+int TypeImpl<Config>::BitsetType::Lub(int32_t value) { |
+ if (value >= 0x40000000) { |
+ return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; |
} |
- if (IsInt32Double(value)) { |
- int32_t i = FastD2I(value); |
- DCHECK(i < 0); |
- if (i >= -0x40000000) return kOtherSignedSmall; |
- return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall; |
+ if (value >= 0) return kUnsignedSmall; |
+ if (value >= -0x40000000) return kOtherSignedSmall; |
+ return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall; |
+} |
+ |
+ |
+template<class Config> |
+int TypeImpl<Config>::BitsetType::Lub(uint32_t value) { |
+ DisallowHeapAllocation no_allocation; |
+ if (value >= 0x80000000u) return kOtherUnsigned32; |
+ if (value >= 0x40000000u) { |
+ return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall; |
} |
- return kOtherNumber; |
+ return kUnsignedSmall; |
} |