Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index e53df91d0ba67f99ba9bb1f422a4b68ff9fed72d..97c8b65a465a7f25746301ded12ee29e239dd110 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -683,13 +683,7 @@ bool Object::SameValue(Object* other) { |
// The object is either a number, a name, an odd-ball, |
// a real JS object, or a Harmony proxy. |
if (IsNumber() && other->IsNumber()) { |
- double this_value = Number(); |
- double other_value = other->Number(); |
- bool equal = this_value == other_value; |
- // SameValue(NaN, NaN) is true. |
- if (!equal) return std::isnan(this_value) && std::isnan(other_value); |
- // SameValue(0.0, -0.0) is false. |
- return (this_value != 0) || ((1 / this_value) == (1 / other_value)); |
+ return v8::internal::SameValue(Number(), other->Number()); |
} |
if (IsString() && other->IsString()) { |
return String::cast(this)->Equals(String::cast(other)); |
@@ -704,11 +698,7 @@ bool Object::SameValueZero(Object* other) { |
// The object is either a number, a name, an odd-ball, |
// a real JS object, or a Harmony proxy. |
if (IsNumber() && other->IsNumber()) { |
- double this_value = Number(); |
- double other_value = other->Number(); |
- // +0 == -0 is true |
- return this_value == other_value |
- || (std::isnan(this_value) && std::isnan(other_value)); |
+ return v8::internal::SameValueZero(Number(), other->Number()); |
} |
if (IsString() && other->IsString()) { |
return String::cast(this)->Equals(String::cast(other)); |