OLD | NEW |
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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 | 125 |
126 // ES6 19.1.3.3 Object.prototype.isPrototypeOf(V) | 126 // ES6 19.1.3.3 Object.prototype.isPrototypeOf(V) |
127 function ObjectIsPrototypeOf(V) { | 127 function ObjectIsPrototypeOf(V) { |
128 if (!IS_RECEIVER(V)) return false; | 128 if (!IS_RECEIVER(V)) return false; |
129 var O = TO_OBJECT(this); | 129 var O = TO_OBJECT(this); |
130 return %HasInPrototypeChain(V, O); | 130 return %HasInPrototypeChain(V, O); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 // ES6 19.1.3.4 | |
135 function ObjectPropertyIsEnumerable(V) { | |
136 var P = TO_NAME(V); | |
137 return %PropertyIsEnumerable(TO_OBJECT(this), P); | |
138 } | |
139 | |
140 // ES6 7.3.9 | 134 // ES6 7.3.9 |
141 function GetMethod(obj, p) { | 135 function GetMethod(obj, p) { |
142 var func = obj[p]; | 136 var func = obj[p]; |
143 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; | 137 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; |
144 if (IS_CALLABLE(func)) return func; | 138 if (IS_CALLABLE(func)) return func; |
145 throw MakeTypeError(kCalledNonCallable, typeof func); | 139 throw MakeTypeError(kCalledNonCallable, typeof func); |
146 } | 140 } |
147 | 141 |
148 // ES6 section 19.1.2.18. | 142 // ES6 section 19.1.2.18. |
149 function ObjectSetPrototypeOf(obj, proto) { | 143 function ObjectSetPrototypeOf(obj, proto) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 188 |
195 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, | 189 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, |
196 DONT_ENUM); | 190 DONT_ENUM); |
197 | 191 |
198 // Set up non-enumerable functions on the Object.prototype object. | 192 // Set up non-enumerable functions on the Object.prototype object. |
199 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ | 193 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ |
200 "toString", ObjectToString, | 194 "toString", ObjectToString, |
201 "toLocaleString", ObjectToLocaleString, | 195 "toLocaleString", ObjectToLocaleString, |
202 "valueOf", ObjectValueOf, | 196 "valueOf", ObjectValueOf, |
203 "isPrototypeOf", ObjectIsPrototypeOf, | 197 "isPrototypeOf", ObjectIsPrototypeOf, |
204 "propertyIsEnumerable", ObjectPropertyIsEnumerable, | 198 // propertyIsEnumerable is added in bootstrapper.cc. |
205 // __defineGetter__ is added in bootstrapper.cc. | 199 // __defineGetter__ is added in bootstrapper.cc. |
206 // __lookupGetter__ is added in bootstrapper.cc. | 200 // __lookupGetter__ is added in bootstrapper.cc. |
207 // __defineSetter__ is added in bootstrapper.cc. | 201 // __defineSetter__ is added in bootstrapper.cc. |
208 // __lookupSetter__ is added in bootstrapper.cc. | 202 // __lookupSetter__ is added in bootstrapper.cc. |
209 ]); | 203 ]); |
210 utils.InstallGetterSetter( | 204 utils.InstallGetterSetter( |
211 GlobalObject.prototype, "__proto__", ObjectGetProto, ObjectSetProto); | 205 GlobalObject.prototype, "__proto__", ObjectGetProto, ObjectSetProto); |
212 | 206 |
213 // Set up non-enumerable functions in the Object object. | 207 // Set up non-enumerable functions in the Object object. |
214 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ | 208 utils.InstallFunctions(GlobalObject, DONT_ENUM, [ |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 to.NumberIsNaN = NumberIsNaN; | 308 to.NumberIsNaN = NumberIsNaN; |
315 to.NumberIsInteger = NumberIsInteger; | 309 to.NumberIsInteger = NumberIsInteger; |
316 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; | 310 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; |
317 }); | 311 }); |
318 | 312 |
319 %InstallToContext([ | 313 %InstallToContext([ |
320 "object_value_of", ObjectValueOf, | 314 "object_value_of", ObjectValueOf, |
321 ]); | 315 ]); |
322 | 316 |
323 }) | 317 }) |
OLD | NEW |