Index: src/types.cc |
diff --git a/src/types.cc b/src/types.cc |
index 70ddccd6a74eeebf9f3ee0c3b3ceb941f2c80ca8..0086313eee83970539e77644ad930ab5b6eaef1c 100644 |
--- a/src/types.cc |
+++ b/src/types.cc |
@@ -128,11 +128,18 @@ int Type::LubBitset() { |
Handle<v8::internal::Object> value = this->as_constant(); |
if (value->IsSmi()) return kSmi; |
map = HeapObject::cast(*value)->map(); |
+ if (map->instance_type() == HEAP_NUMBER_TYPE) { |
+ int32_t i; |
+ uint32_t u; |
+ if (value->ToInt32(&i)) return Smi::IsValid(i) ? kSmi : kOtherSigned32; |
+ if (value->ToUint32(&u)) return kUnsigned32; |
+ return kDouble; |
+ } |
if (map->instance_type() == ODDBALL_TYPE) { |
if (value->IsUndefined()) return kUndefined; |
if (value->IsNull()) return kNull; |
if (value->IsTrue() || value->IsFalse()) return kBoolean; |
- if (value->IsTheHole()) return kAny; |
+ if (value->IsTheHole()) return kAny; // TODO(rossberg): kNone? |
} |
} |
switch (map->instance_type()) { |
@@ -162,9 +169,8 @@ int Type::LubBitset() { |
case SYMBOL_TYPE: |
return kSymbol; |
case ODDBALL_TYPE: |
- return kOddball; |
case HEAP_NUMBER_TYPE: |
- return kDouble; |
+ UNREACHABLE(); |
case JS_VALUE_TYPE: |
case JS_DATE_TYPE: |
case JS_OBJECT_TYPE: |