| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 | 98 |
| 99 // ES6 7.3.9 | 99 // ES6 7.3.9 |
| 100 function GetMethod(obj, p) { | 100 function GetMethod(obj, p) { |
| 101 var func = obj[p]; | 101 var func = obj[p]; |
| 102 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; | 102 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; |
| 103 if (IS_CALLABLE(func)) return func; | 103 if (IS_CALLABLE(func)) return func; |
| 104 throw %make_type_error(kCalledNonCallable, typeof func); | 104 throw %make_type_error(kCalledNonCallable, typeof func); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // ES6 B.2.2.1.1 | |
| 108 function ObjectGetProto() { | |
| 109 return %object_get_prototype_of(this); | |
| 110 } | |
| 111 | |
| 112 | |
| 113 // ES6 B.2.2.1.2 | |
| 114 function ObjectSetProto(proto) { | |
| 115 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__"); | |
| 116 | |
| 117 if ((IS_RECEIVER(proto) || IS_NULL(proto)) && IS_RECEIVER(this)) { | |
| 118 %SetPrototype(this, proto); | |
| 119 } | |
| 120 } | |
| 121 | |
| 122 | |
| 123 // ES6 19.1.1.1 | 107 // ES6 19.1.1.1 |
| 124 function ObjectConstructor(x) { | 108 function ObjectConstructor(x) { |
| 125 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) { | 109 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) { |
| 126 return this; | 110 return this; |
| 127 } | 111 } |
| 128 if (IS_NULL(x) || IS_UNDEFINED(x)) return {}; | 112 if (IS_NULL(x) || IS_UNDEFINED(x)) return {}; |
| 129 return TO_OBJECT(x); | 113 return TO_OBJECT(x); |
| 130 } | 114 } |
| 131 | 115 |
| 132 | 116 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 144 "toString", ObjectToString, | 128 "toString", ObjectToString, |
| 145 "toLocaleString", ObjectToLocaleString, | 129 "toLocaleString", ObjectToLocaleString, |
| 146 "valueOf", ObjectValueOf, | 130 "valueOf", ObjectValueOf, |
| 147 "isPrototypeOf", ObjectIsPrototypeOf, | 131 "isPrototypeOf", ObjectIsPrototypeOf, |
| 148 // propertyIsEnumerable is added in bootstrapper.cc. | 132 // propertyIsEnumerable is added in bootstrapper.cc. |
| 149 // __defineGetter__ is added in bootstrapper.cc. | 133 // __defineGetter__ is added in bootstrapper.cc. |
| 150 // __lookupGetter__ is added in bootstrapper.cc. | 134 // __lookupGetter__ is added in bootstrapper.cc. |
| 151 // __defineSetter__ is added in bootstrapper.cc. | 135 // __defineSetter__ is added in bootstrapper.cc. |
| 152 // __lookupSetter__ is added in bootstrapper.cc. | 136 // __lookupSetter__ is added in bootstrapper.cc. |
| 153 ]); | 137 ]); |
| 154 utils.InstallGetterSetter( | |
| 155 GlobalObject.prototype, "__proto__", ObjectGetProto, ObjectSetProto); | |
| 156 | 138 |
| 157 | 139 |
| 158 // ---------------------------------------------------------------------------- | 140 // ---------------------------------------------------------------------------- |
| 159 // Number | 141 // Number |
| 160 | 142 |
| 161 utils.InstallConstants(GlobalNumber, [ | 143 utils.InstallConstants(GlobalNumber, [ |
| 162 // ECMA-262 section 15.7.3.1. | 144 // ECMA-262 section 15.7.3.1. |
| 163 "MAX_VALUE", 1.7976931348623157e+308, | 145 "MAX_VALUE", 1.7976931348623157e+308, |
| 164 // ECMA-262 section 15.7.3.2. | 146 // ECMA-262 section 15.7.3.2. |
| 165 "MIN_VALUE", 5e-324, | 147 "MIN_VALUE", 5e-324, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 to.GetIterator = GetIterator; | 191 to.GetIterator = GetIterator; |
| 210 to.GetMethod = GetMethod; | 192 to.GetMethod = GetMethod; |
| 211 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; | 193 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; |
| 212 }); | 194 }); |
| 213 | 195 |
| 214 %InstallToContext([ | 196 %InstallToContext([ |
| 215 "object_value_of", ObjectValueOf, | 197 "object_value_of", ObjectValueOf, |
| 216 ]); | 198 ]); |
| 217 | 199 |
| 218 }) | 200 }) |
| OLD | NEW |