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()) { |
arv (Not doing code reviews)
2015/02/20 19:19:08
IsNumber() checked IsSmi() || IsHeapNumber()
If i
|
+ int num = Smi::cast(this)->value(); |
+ uint32_t hash = ComputeLongHash(double_to_uint64(static_cast<double>(num))); |
arv (Not doing code reviews)
2015/02/20 19:19:08
I tried a few other approaches here but it is impo
adamk
2015/02/20 19:50:03
This is fine for now, and the right approach for t
|
+ 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; |
adamk
2015/02/20 19:50:03
Nit: shouldn't need the "i::" prefix here.
arv (Not doing code reviews)
2015/02/20 20:05:34
It is needed. There is a class function with the s
|
+ uint32_t hash = ComputeLongHash(double_to_uint64(num)); |
return Smi::FromInt(hash & Smi::kMaxValue); |
} |
if (IsName()) { |