Object.is should use SameValue
authorwingo@igalia.com <wingo@igalia.com>
Thu, 16 Oct 2014 11:24:45 +0000 (11:24 +0000)
committerwingo@igalia.com <wingo@igalia.com>
Thu, 16 Oct 2014 11:24:45 +0000 (11:24 +0000)
BUG=v8:3576
LOG=
R=arv@chromium.org, svenpanne@chromium.org, wingo@igalia.com

Review URL: https://codereview.chromium.org/626323002

Patch from Diego Pino <dpino@igalia.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24658 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/v8natives.js
test/mjsunit/object-is.js

index 92a889a..92f377c 100644 (file)
@@ -1363,13 +1363,9 @@ function ObjectIsExtensible(obj) {
 }
 
 
-// Harmony egal.
+// ECMA-262, Edition 6, section 19.1.2.10
 function ObjectIs(obj1, obj2) {
-  if (obj1 === obj2) {
-    return (obj1 !== 0) || (1 / obj1 === 1 / obj2);
-  } else {
-    return (obj1 !== obj1) && (obj2 !== obj2);
-  }
+  return SameValue(obj1, obj2);
 }
 
 
index b9fdc84..c57542f 100644 (file)
@@ -32,8 +32,8 @@ function TestEgal(expected, x, y) {
   assertSame(expected, Object.is(x, y));
 }
 
-var test_set = [ {}, [], 1/0, -1/0, "s", 0, 0/-1, null, undefined ];
-print(test_set);
+var test_set = [ {}, [], Infinity, -Infinity, "s", "ア", 0, 0/-1, null,
+    undefined, true, false, Symbol("foo"), NaN ];
 for (var i = 0; i < test_set.length; i++) {
   for (var j = 0; j < test_set.length; j++) {
     if (i == j) {