Revision: 24495
Author:   [email protected]
Date:     Thu Oct  9 13:19:02 2014 UTC
Log:      Convert `obj` ToObject in Object.keys()

BUG=v8:3587
LOG=Y
[email protected], [email protected]

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

Patch from Caitlin Potter <[email protected]>.
https://code.google.com/p/v8/source/detail?r=24495

Modified:
 /branches/bleeding_edge/AUTHORS
 /branches/bleeding_edge/src/v8natives.js
 /branches/bleeding_edge/test/mjsunit/third_party/object-keys.js
 /branches/bleeding_edge/test/test262/test262.status

=======================================
--- /branches/bleeding_edge/AUTHORS     Mon Sep 29 16:51:54 2014 UTC
+++ /branches/bleeding_edge/AUTHORS     Thu Oct  9 13:19:02 2014 UTC
@@ -27,6 +27,7 @@
 Baptiste Afsa <[email protected]>
 Bert Belder <[email protected]>
 Burcu Dogan <[email protected]>
+Caitlin Potter <[email protected]>
 Craig Schlenter <[email protected]>
 Chunyang Dai <[email protected]>
 Daniel Andersson <[email protected]>
=======================================
--- /branches/bleeding_edge/src/v8natives.js    Wed Oct  8 14:48:48 2014 UTC
+++ /branches/bleeding_edge/src/v8natives.js    Thu Oct  9 13:19:02 2014 UTC
@@ -325,9 +325,7 @@


 function ObjectKeys(obj) {
-  if (!IS_SPEC_OBJECT(obj)) {
-    throw MakeTypeError("called_on_non_object", ["Object.keys"]);
-  }
+  obj = ToObject(obj);
   if (%IsJSProxy(obj)) {
     var handler = %GetHandler(obj);
     var names = CallTrap0(handler, "keys", DerivedKeysTrap);
=======================================
--- /branches/bleeding_edge/test/mjsunit/third_party/object-keys.js Mon Sep 29 07:30:41 2014 UTC +++ /branches/bleeding_edge/test/mjsunit/third_party/object-keys.js Thu Oct 9 13:19:02 2014 UTC
@@ -31,8 +31,8 @@

 // Based on LayoutTests/fast/js/Object-keys.html

-assertThrows(function () { Object.keys(2) }, TypeError);
-assertThrows(function () { Object.keys("foo") }, TypeError);
+assertEquals(Object.keys(2), []);
+assertEquals(Object.keys("foo"), ["0", "1", "2"]);
 assertThrows(function () { Object.keys(null) }, TypeError);
 assertThrows(function () { Object.keys(undefined) }, TypeError);

=======================================
--- /branches/bleeding_edge/test/test262/test262.status Tue Aug 26 08:44:25 2014 UTC +++ /branches/bleeding_edge/test/test262/test262.status Thu Oct 9 13:19:02 2014 UTC
@@ -87,6 +87,12 @@
   'S15.9.3.1_A5_T5': [PASS, FAIL_OK],
   'S15.9.3.1_A5_T6': [PASS, FAIL_OK],

+ # ObjectKeys() no longer throws TypeError when passed a primitive value which
+  # is not null or undefined (per ES6).
+  '15.2.3.14-1-1': [SKIP],
+  '15.2.3.14-1-2': [SKIP],
+  '15.2.3.14-1-3': [SKIP],
+
   ############################ SKIPPED TESTS #############################

   # These tests take a looong time to run in debug mode.

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to