Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 93037822cf3553ca0b60b62b736430b96770520d..abc48ba1a0c160b76147b824de3a61c107dfb52f 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -2200,6 +2200,12 @@ bool Value::Equals(Handle<Value> that) const { |
ENTER_V8; |
i::Handle<i::Object> obj = Utils::OpenHandle(this); |
i::Handle<i::Object> other = Utils::OpenHandle(*that); |
+ // If both obj and other are JSObjects, we'd better compare by identity |
+ // immediately when going into JS builtin. The reason is Invoke |
+ // would overwrite global object receiver with global proxy. |
+ if (obj->IsJSObject() && other->IsJSObject()) { |
+ return *obj == *other; |
+ } |
i::Object** args[1] = { other.location() }; |
EXCEPTION_PREAMBLE(); |
i::Handle<i::Object> result = |