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

Side by Side Diff: src/proxy.js

Issue 1154743003: Revert of Hook up more import/exports in natives. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/promise.js ('k') | src/regexp.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 var $proxyDelegateCallAndConstruct;
5 var $proxyDerivedGetTrap; 6 var $proxyDerivedGetTrap;
6 var $proxyDerivedHasTrap; 7 var $proxyDerivedHasTrap;
8 var $proxyDerivedHasOwnTrap;
9 var $proxyDerivedKeysTrap;
7 var $proxyDerivedSetTrap; 10 var $proxyDerivedSetTrap;
8 var $proxyEnumerate; 11 var $proxyEnumerate;
9 12
10 (function(global, utils) { 13 (function(global, utils) {
11 14
12 "use strict"; 15 "use strict";
13 16
14 %CheckIsBootstrapping(); 17 %CheckIsBootstrapping();
15 18
16 // ----------------------------------------------------------------------------
17 // Imports
18
19 var GlobalFunction = global.Function; 19 var GlobalFunction = global.Function;
20 var GlobalObject = global.Object; 20 var GlobalObject = global.Object;
21 21
22 var ToNameArray; 22 // -------------------------------------------------------------------
23
24 utils.Import(function(from) {
25 ToNameArray = from.ToNameArray;
26 });
27
28 //----------------------------------------------------------------------------
29 23
30 function ProxyCreate(handler, proto) { 24 function ProxyCreate(handler, proto) {
31 if (!IS_SPEC_OBJECT(handler)) 25 if (!IS_SPEC_OBJECT(handler))
32 throw MakeTypeError(kProxyHandlerNonObject, "create") 26 throw MakeTypeError(kProxyHandlerNonObject, "create")
33 if (IS_UNDEFINED(proto)) 27 if (IS_UNDEFINED(proto))
34 proto = null 28 proto = null
35 else if (!(IS_SPEC_OBJECT(proto) || IS_NULL(proto))) 29 else if (!(IS_SPEC_OBJECT(proto) || IS_NULL(proto)))
36 throw MakeTypeError(kProxyProtoNonObject) 30 throw MakeTypeError(kProxyProtoNonObject)
37 return %CreateJSProxy(handler, proto) 31 return %CreateJSProxy(handler, proto)
38 } 32 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 168 }
175 } 169 }
176 return enumerableNames 170 return enumerableNames
177 } 171 }
178 172
179 function ProxyEnumerate(proxy) { 173 function ProxyEnumerate(proxy) {
180 var handler = %GetHandler(proxy) 174 var handler = %GetHandler(proxy)
181 if (IS_UNDEFINED(handler.enumerate)) { 175 if (IS_UNDEFINED(handler.enumerate)) {
182 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0) 176 return %Apply(DerivedEnumerateTrap, handler, [], 0, 0)
183 } else { 177 } else {
184 return ToNameArray(handler.enumerate(), "enumerate", false) 178 return $toNameArray(handler.enumerate(), "enumerate", false)
185 } 179 }
186 } 180 }
187 181
188 //------------------------------------------------------------------- 182 //-------------------------------------------------------------------
189 183
190 var Proxy = new GlobalObject(); 184 var Proxy = new GlobalObject();
191 %AddNamedProperty(global, "Proxy", Proxy, DONT_ENUM); 185 %AddNamedProperty(global, "Proxy", Proxy, DONT_ENUM);
192 186
193 //Set up non-enumerable properties of the Proxy object. 187 //Set up non-enumerable properties of the Proxy object.
194 utils.InstallFunctions(Proxy, DONT_ENUM, [ 188 $installFunctions(Proxy, DONT_ENUM, [
195 "create", ProxyCreate, 189 "create", ProxyCreate,
196 "createFunction", ProxyCreateFunction 190 "createFunction", ProxyCreateFunction
197 ]) 191 ])
198 192
199 // ------------------------------------------------------------------- 193 $proxyDelegateCallAndConstruct = DelegateCallAndConstruct;
200 // Exports
201
202 $proxyDerivedGetTrap = DerivedGetTrap; 194 $proxyDerivedGetTrap = DerivedGetTrap;
203 $proxyDerivedHasTrap = DerivedHasTrap; 195 $proxyDerivedHasTrap = DerivedHasTrap;
196 $proxyDerivedHasOwnTrap = DerivedHasOwnTrap;
197 $proxyDerivedKeysTrap = DerivedKeysTrap;
204 $proxyDerivedSetTrap = DerivedSetTrap; 198 $proxyDerivedSetTrap = DerivedSetTrap;
205 $proxyEnumerate = ProxyEnumerate; 199 $proxyEnumerate = ProxyEnumerate;
206 200
207 utils.Export(function(to) {
208 to.ProxyDelegateCallAndConstruct = DelegateCallAndConstruct;
209 to.ProxyDerivedHasOwnTrap = DerivedHasOwnTrap;
210 to.ProxyDerivedKeysTrap = DerivedKeysTrap;
211 });
212
213 }) 201 })
OLDNEW
« no previous file with comments | « src/promise.js ('k') | src/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698