Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: src/v8natives.js

Issue 7321004: Implement Object.keys for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (receiver == null && !IS_UNDETECTABLE(receiver)) { 301 if (receiver == null && !IS_UNDETECTABLE(receiver)) {
302 receiver = %GlobalReceiver(global); 302 receiver = %GlobalReceiver(global);
303 } 303 }
304 return %LookupAccessor(ToObject(receiver), ToString(name), SETTER); 304 return %LookupAccessor(ToObject(receiver), ToString(name), SETTER);
305 } 305 }
306 306
307 307
308 function ObjectKeys(obj) { 308 function ObjectKeys(obj) {
309 if (!IS_SPEC_OBJECT(obj)) 309 if (!IS_SPEC_OBJECT(obj))
310 throw MakeTypeError("obj_ctor_property_non_object", ["keys"]); 310 throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
311 if (%IsJSProxy(obj)) {
312 var handler = %GetHandler(obj);
313 var keys = handler.keys;
314 if (IS_UNDEFINED(keys)) keys = DerivedKeysTrap;
315 var names = keys.call(handler);
Mads Ager (chromium) 2011/07/12 13:28:19 Do you want to rely on Function.prototype.call her
rossberg 2011/07/13 10:11:52 Done, here and in a few other places. (Btw, who pi
Mads Ager (chromium) 2011/07/13 10:17:25 I don't remember. I would have preferred having th
316 return ToStringArray(names);
317 }
311 return %LocalKeys(obj); 318 return %LocalKeys(obj);
312 } 319 }
313 320
314 321
315 // ES5 8.10.1. 322 // ES5 8.10.1.
316 function IsAccessorDescriptor(desc) { 323 function IsAccessorDescriptor(desc) {
317 if (IS_UNDEFINED(desc)) return false; 324 if (IS_UNDEFINED(desc)) return false;
318 return desc.hasGetter() || desc.hasSetter(); 325 return desc.hasGetter() || desc.hasSetter();
319 } 326 }
320 327
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 // ---------------------------------------------------------------------------- 1464 // ----------------------------------------------------------------------------
1458 1465
1459 function SetupFunction() { 1466 function SetupFunction() {
1460 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1467 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1461 "bind", FunctionBind, 1468 "bind", FunctionBind,
1462 "toString", FunctionToString 1469 "toString", FunctionToString
1463 )); 1470 ));
1464 } 1471 }
1465 1472
1466 SetupFunction(); 1473 SetupFunction();
OLDNEW
« src/proxy.js ('K') | « src/proxy.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698