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

Side by Side Diff: src/js/proxy.js

Issue 1488873003: [proxies] Implement Symbol/DONT_ENUM filtering for GetKeys() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moved filtering into KeyAccumulator Created 5 years 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
« no previous file with comments | « no previous file | src/js/v8natives.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 writable: true, 127 writable: true,
128 enumerable: true, 128 enumerable: true,
129 configurable: true}); 129 configurable: true});
130 return true; 130 return true;
131 } 131 }
132 132
133 function DerivedHasOwnTrap(name) { 133 function DerivedHasOwnTrap(name) {
134 return !!this.getOwnPropertyDescriptor(name) 134 return !!this.getOwnPropertyDescriptor(name)
135 } 135 }
136 136
137 function DerivedKeysTrap() {
138 var names = this.getOwnPropertyNames()
139 var enumerableNames = []
140 for (var i = 0, count = 0; i < names.length; ++i) {
141 var name = names[i]
142 if (IS_SYMBOL(name)) continue
143 var desc = this.getOwnPropertyDescriptor(TO_STRING(name))
144 if (!IS_UNDEFINED(desc) && desc.enumerable) {
145 enumerableNames[count++] = names[i]
146 }
147 }
148 return enumerableNames
149 }
150 137
151 // Implements part of ES6 9.5.11 Proxy.[[Enumerate]]: 138 // Implements part of ES6 9.5.11 Proxy.[[Enumerate]]:
152 // Call the trap, which should return an iterator, exhaust the iterator, 139 // Call the trap, which should return an iterator, exhaust the iterator,
153 // and return an array containing the values. 140 // and return an array containing the values.
154 function ProxyEnumerate(trap, handler, target) { 141 function ProxyEnumerate(trap, handler, target) {
155 // 7. Let trapResult be ? Call(trap, handler, «target»). 142 // 7. Let trapResult be ? Call(trap, handler, «target»).
156 var trap_result = %_Call(trap, handler, target); 143 var trap_result = %_Call(trap, handler, target);
157 // 8. If Type(trapResult) is not Object, throw a TypeError exception. 144 // 8. If Type(trapResult) is not Object, throw a TypeError exception.
158 if (!IS_SPEC_OBJECT(trap_result)) { 145 if (!IS_SPEC_OBJECT(trap_result)) {
159 throw MakeTypeError(kProxyHandlerReturned, handler, "non-Object", 146 throw MakeTypeError(kProxyHandlerReturned, handler, "non-Object",
(...skipping 21 matching lines...) Expand all
181 utils.InstallFunctions(GlobalProxy, DONT_ENUM, [ 168 utils.InstallFunctions(GlobalProxy, DONT_ENUM, [
182 "createFunction", ProxyCreateFunction 169 "createFunction", ProxyCreateFunction
183 ]); 170 ]);
184 171
185 // ------------------------------------------------------------------- 172 // -------------------------------------------------------------------
186 // Exports 173 // Exports
187 174
188 utils.Export(function(to) { 175 utils.Export(function(to) {
189 to.ProxyDelegateCallAndConstruct = DelegateCallAndConstruct; 176 to.ProxyDelegateCallAndConstruct = DelegateCallAndConstruct;
190 to.ProxyDerivedHasOwnTrap = DerivedHasOwnTrap; 177 to.ProxyDerivedHasOwnTrap = DerivedHasOwnTrap;
191 to.ProxyDerivedKeysTrap = DerivedKeysTrap;
192 }); 178 });
193 179
194 %InstallToContext([ 180 %InstallToContext([
195 "derived_get_trap", DerivedGetTrap, 181 "derived_get_trap", DerivedGetTrap,
196 "derived_set_trap", DerivedSetTrap, 182 "derived_set_trap", DerivedSetTrap,
197 "proxy_enumerate", ProxyEnumerate, 183 "proxy_enumerate", ProxyEnumerate,
198 ]); 184 ]);
199 185
200 }) 186 })
OLDNEW
« no previous file with comments | « no previous file | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698