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

Unified Diff: src/v8natives.js

Issue 7321004: Implement Object.keys for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adressing Mads comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/proxy.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 831dd14ef84b233764946a02aef650ac86a8ea04..df918298d0216d59cb2a1c59cab26f06085bb7ac 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -308,6 +308,13 @@ function ObjectLookupSetter(name) {
function ObjectKeys(obj) {
if (!IS_SPEC_OBJECT(obj))
throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
+ if (%IsJSProxy(obj)) {
+ var handler = %GetHandler(obj);
+ var keys = handler.keys;
+ if (IS_UNDEFINED(keys)) keys = DerivedKeysTrap;
+ var names = %_CallFunction(handler, keys);
+ return ToStringArray(names);
+ }
return %LocalKeys(obj);
}
@@ -585,7 +592,7 @@ function GetProperty(obj, p) {
throw MakeTypeError("handler_trap_missing",
[handler, "getPropertyDescriptor"]);
}
- var descriptor = getProperty.call(handler, p);
+ var descriptor = %_CallFunction(handler, p, getProperty);
if (IS_UNDEFINED(descriptor)) return descriptor;
var desc = ToCompletePropertyDescriptor(descriptor);
if (!desc.configurable) {
@@ -608,7 +615,7 @@ function HasProperty(obj, p) {
var handler = %GetHandler(obj);
var has = handler.has;
if (IS_UNDEFINED(has)) has = DerivedHasTrap;
- return ToBoolean(has.call(handler, obj, p));
+ return ToBoolean(%_CallFunction(handler, obj, p, has));
}
var desc = GetProperty(obj, p);
return IS_UNDEFINED(desc) ? false : true;
@@ -636,7 +643,7 @@ function DefineProxyProperty(obj, p, attributes, should_throw) {
if (IS_UNDEFINED(defineProperty)) {
throw MakeTypeError("handler_trap_missing", [handler, "defineProperty"]);
}
- var result = defineProperty.call(handler, p, attributes);
+ var result = %_CallFunction(handler, p, attributes, defineProperty);
if (!ToBoolean(result)) {
if (should_throw) {
throw MakeTypeError("handler_failed", [handler, "defineProperty"]);
@@ -868,7 +875,7 @@ function ObjectGetOwnPropertyNames(obj) {
throw MakeTypeError("handler_trap_missing",
[handler, "getOwnPropertyNames"]);
}
- var names = getOwnPropertyNames.call(handler);
+ var names = %_CallFunction(handler, getOwnPropertyNames);
return ToStringArray(names, "getOwnPropertyNames");
}
« no previous file with comments | « src/proxy.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698