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

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

Issue 1482283002: [runtime] [proxy] implementing [[Get]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: position of static 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/objects.h » ('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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 } 65 }
66 66
67 function DelegateCallAndConstruct(callTrap, constructTrap) { 67 function DelegateCallAndConstruct(callTrap, constructTrap) {
68 return function() { 68 return function() {
69 return %Apply(IS_UNDEFINED(new.target) ? callTrap : constructTrap, 69 return %Apply(IS_UNDEFINED(new.target) ? callTrap : constructTrap,
70 this, arguments, 0, %_ArgumentsLength()) 70 this, arguments, 0, %_ArgumentsLength())
71 } 71 }
72 } 72 }
73 73
74 function DerivedGetTrap(receiver, name) {
75 var desc = this.getPropertyDescriptor(name)
76 if (IS_UNDEFINED(desc)) { return desc }
77 if ('value' in desc) {
78 return desc.value
79 } else {
80 if (IS_UNDEFINED(desc.get)) { return desc.get }
81 // The proposal says: desc.get.call(receiver)
82 return %_Call(desc.get, receiver)
83 }
84 }
85
86 function DerivedSetTrap(receiver, name, val) { 74 function DerivedSetTrap(receiver, name, val) {
87 var desc = this.getOwnPropertyDescriptor(name) 75 var desc = this.getOwnPropertyDescriptor(name)
88 if (desc) { 76 if (desc) {
89 if ('writable' in desc) { 77 if ('writable' in desc) {
90 if (desc.writable) { 78 if (desc.writable) {
91 desc.value = val 79 desc.value = val
92 this.defineProperty(name, desc) 80 this.defineProperty(name, desc)
93 return true 81 return true
94 } else { 82 } else {
95 return false 83 return false
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // ------------------------------------------------------------------- 173 // -------------------------------------------------------------------
186 // Exports 174 // Exports
187 175
188 utils.Export(function(to) { 176 utils.Export(function(to) {
189 to.ProxyDelegateCallAndConstruct = DelegateCallAndConstruct; 177 to.ProxyDelegateCallAndConstruct = DelegateCallAndConstruct;
190 to.ProxyDerivedHasOwnTrap = DerivedHasOwnTrap; 178 to.ProxyDerivedHasOwnTrap = DerivedHasOwnTrap;
191 to.ProxyDerivedKeysTrap = DerivedKeysTrap; 179 to.ProxyDerivedKeysTrap = DerivedKeysTrap;
192 }); 180 });
193 181
194 %InstallToContext([ 182 %InstallToContext([
195 "derived_get_trap", DerivedGetTrap,
196 "proxy_enumerate", ProxyEnumerate, 183 "proxy_enumerate", ProxyEnumerate,
197 ]); 184 ]);
198 185
199 }) 186 })
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698