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

Side by Side Diff: src/v8natives.js

Issue 1211663002: Fix evaluation order of Object.prototype.hasOwnProperty (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/has-own-property-evaluation-order.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 $functionSourceString; 5 var $functionSourceString;
6 var $globalEval; 6 var $globalEval;
7 var $objectDefineOwnProperty; 7 var $objectDefineOwnProperty;
8 var $objectGetOwnPropertyDescriptor; 8 var $objectGetOwnPropertyDescriptor;
9 var $toCompletePropertyDescriptor; 9 var $toCompletePropertyDescriptor;
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 169
170 // ECMA-262 - 15.2.4.4 170 // ECMA-262 - 15.2.4.4
171 function ObjectValueOf() { 171 function ObjectValueOf() {
172 return TO_OBJECT_INLINE(this); 172 return TO_OBJECT_INLINE(this);
173 } 173 }
174 174
175 175
176 // ECMA-262 - 15.2.4.5 176 // ECMA-262 - 15.2.4.5
177 function ObjectHasOwnProperty(V) { 177 function ObjectHasOwnProperty(value) {
178 if (%_IsJSProxy(this)) { 178 var name = $toName(value);
179 var object = TO_OBJECT_INLINE(this);
180
181 if (%_IsJSProxy(object)) {
179 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 182 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
180 if (IS_SYMBOL(V)) return false; 183 if (IS_SYMBOL(value)) return false;
181 184
182 var handler = %GetHandler(this); 185 var handler = %GetHandler(object);
183 return CallTrap1(handler, "hasOwn", ProxyDerivedHasOwnTrap, $toName(V)); 186 return CallTrap1(handler, "hasOwn", ProxyDerivedHasOwnTrap, name);
184 } 187 }
185 return %HasOwnProperty(TO_OBJECT_INLINE(this), $toName(V)); 188 return %HasOwnProperty(object, name);
186 } 189 }
187 190
188 191
189 // ECMA-262 - 15.2.4.6 192 // ECMA-262 - 15.2.4.6
190 function ObjectIsPrototypeOf(V) { 193 function ObjectIsPrototypeOf(V) {
191 if (!IS_SPEC_OBJECT(V)) return false; 194 if (!IS_SPEC_OBJECT(V)) return false;
192 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.isPrototypeOf"); 195 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.isPrototypeOf");
193 return %IsInPrototypeChain(this, V); 196 return %IsInPrototypeChain(this, V);
194 } 197 }
195 198
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; 1873 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys;
1871 to.ObjectHasOwnProperty = ObjectHasOwnProperty; 1874 to.ObjectHasOwnProperty = ObjectHasOwnProperty;
1872 to.ObjectIsFrozen = ObjectIsFrozen; 1875 to.ObjectIsFrozen = ObjectIsFrozen;
1873 to.ObjectIsSealed = ObjectIsSealed; 1876 to.ObjectIsSealed = ObjectIsSealed;
1874 to.ObjectToString = ObjectToString; 1877 to.ObjectToString = ObjectToString;
1875 to.OwnPropertyKeys = OwnPropertyKeys; 1878 to.OwnPropertyKeys = OwnPropertyKeys;
1876 to.ToNameArray = ToNameArray; 1879 to.ToNameArray = ToNameArray;
1877 }); 1880 });
1878 1881
1879 }) 1882 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/has-own-property-evaluation-order.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698