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

Unified Diff: src/objects.cc

Issue 1717893002: Remove the Proxy enumerate trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests Created 4 years, 10 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/objects.h ('k') | test/mjsunit/for-in-opt.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 0ce4a7317146cff8e1779b227b2c80ad8326bc44..2fc752ab62aa7d9ee28ce1221e6bf66505b2831e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8670,15 +8670,9 @@ static Maybe<bool> GetKeys_Internal(Isolate* isolate,
PrototypeIterator::GetCurrent<JSReceiver>(iter);
Maybe<bool> result = Just(false); // Dummy initialization.
if (current->IsJSProxy()) {
- if (type == OWN_ONLY) {
- result = JSProxy::OwnPropertyKeys(isolate, receiver,
- Handle<JSProxy>::cast(current),
- filter, accumulator);
- } else {
- DCHECK(type == INCLUDE_PROTOS);
- result = JSProxy::Enumerate(
- isolate, receiver, Handle<JSProxy>::cast(current), accumulator);
- }
+ result = JSProxy::OwnPropertyKeys(isolate, receiver,
+ Handle<JSProxy>::cast(current), filter,
+ accumulator);
} else {
DCHECK(current->IsJSObject());
result = GetKeysFromJSObject(isolate, receiver,
@@ -8692,54 +8686,6 @@ static Maybe<bool> GetKeys_Internal(Isolate* isolate,
}
-// ES6 9.5.11
-// Returns false in case of exception.
-// static
-Maybe<bool> JSProxy::Enumerate(Isolate* isolate, Handle<JSReceiver> receiver,
- Handle<JSProxy> proxy,
- KeyAccumulator* accumulator) {
- STACK_CHECK(Nothing<bool>());
- // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
- Handle<Object> handler(proxy->handler(), isolate);
- // 2. If handler is null, throw a TypeError exception.
- // 3. Assert: Type(handler) is Object.
- if (proxy->IsRevoked()) {
- isolate->Throw(*isolate->factory()->NewTypeError(
- MessageTemplate::kProxyRevoked,
- isolate->factory()->enumerate_string()));
- return Nothing<bool>();
- }
- // 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
- Handle<JSReceiver> target(proxy->target(), isolate);
- // 5. Let trap be ? GetMethod(handler, "enumerate").
- Handle<Object> trap;
- ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate, trap, Object::GetMethod(Handle<JSReceiver>::cast(handler),
- isolate->factory()->enumerate_string()),
- Nothing<bool>());
- // 6. If trap is undefined, then
- if (trap->IsUndefined()) {
- // 6a. Return target.[[Enumerate]]().
- return GetKeys_Internal(isolate, receiver, target, INCLUDE_PROTOS,
- ENUMERABLE_STRINGS, accumulator);
- }
- // The "proxy_enumerate" helper calls the trap (steps 7 - 9), which returns
- // a generator; it then iterates over that generator until it's exhausted
- // and returns an array containing the generated values.
- Handle<Object> trap_result_array;
- Handle<Object> args[] = {trap, handler, target};
- ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate, trap_result_array,
- Execution::Call(isolate, isolate->proxy_enumerate(),
- isolate->factory()->undefined_value(), arraysize(args),
- args),
- Nothing<bool>());
- accumulator->NextPrototype();
- accumulator->AddKeysFromProxy(Handle<JSObject>::cast(trap_result_array));
- return Just(true);
-}
-
-
// ES6 9.5.12
// Returns |true| on success, |nothing| in case of exception.
// static
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/for-in-opt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698