Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 8fa2e2c30d7f3accbfab88f286194458731a2d7b..46cac758f08ba3c75a0bc0767554f7bb431ea426 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3405,33 +3405,9 @@ bool Value::Equals(Local<Value> that) const { |
bool Value::StrictEquals(Local<Value> that) const { |
- i::Handle<i::Object> obj = Utils::OpenHandle(this); |
- i::Handle<i::Object> other = Utils::OpenHandle(*that); |
- if (obj->IsSmi()) { |
- return other->IsNumber() && obj->Number() == other->Number(); |
- } |
- i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); |
- LOG_API(isolate, "StrictEquals"); |
- // Must check HeapNumber first, since NaN !== NaN. |
- if (obj->IsHeapNumber()) { |
- if (!other->IsNumber()) return false; |
- double x = obj->Number(); |
- double y = other->Number(); |
- // Must check explicitly for NaN:s on Windows, but -0 works fine. |
- return x == y && !std::isnan(x) && !std::isnan(y); |
- } else if (*obj == *other) { // Also covers Booleans. |
- return true; |
- } else if (obj->IsSmi()) { |
- return other->IsNumber() && obj->Number() == other->Number(); |
- } else if (obj->IsString()) { |
- return other->IsString() && |
- i::String::Equals(i::Handle<i::String>::cast(obj), |
- i::Handle<i::String>::cast(other)); |
- } else if (obj->IsUndefined() || obj->IsUndetectableObject()) { |
- return other->IsUndefined() || other->IsUndetectableObject(); |
Yang
2015/08/17 07:13:32
This undetectable check is lost. I guess this is i
Benedikt Meurer
2015/08/17 07:59:49
Yes. The code stub has an explicit comment that st
|
- } else { |
- return false; |
- } |
+ auto self = Utils::OpenHandle(this); |
+ auto other = Utils::OpenHandle(*that); |
+ return self->StrictEquals(*other); |
} |