Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 100cbf90b3493860d8bd0c5c5b4246d8f57e495d..99b0ab70de998065185c0d504ba487f31b6a08a7 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -798,10 +798,16 @@ Map* Object::GetRootMap(Isolate* isolate) { |
Object* Object::GetHash() { |
// The object is either a number, a name, an odd-ball, |
// a real JS object, or a Harmony proxy. |
- if (IsNumber()) { |
- uint32_t hash = std::isnan(Number()) |
- ? Smi::kMaxValue |
- : ComputeLongHash(double_to_uint64(Number())); |
+ if (IsSmi()) { |
+ int num = Smi::cast(this)->value(); |
+ uint32_t hash = ComputeLongHash(double_to_uint64(static_cast<double>(num))); |
+ return Smi::FromInt(hash & Smi::kMaxValue); |
+ } |
+ if (IsHeapNumber()) { |
+ double num = HeapNumber::cast(this)->value(); |
+ if (std::isnan(num)) return Smi::FromInt(Smi::kMaxValue); |
+ if (i::IsMinusZero(num)) num = 0; |
+ uint32_t hash = ComputeLongHash(double_to_uint64(num)); |
return Smi::FromInt(hash & Smi::kMaxValue); |
} |
if (IsName()) { |