Chromium Code Reviews| 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1315 // ECMA-262, Edition 6, section B.2.2.1.2 | 1315 // ECMA-262, Edition 6, section B.2.2.1.2 |
| 1316 function ObjectSetProto(proto) { | 1316 function ObjectSetProto(proto) { |
| 1317 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__"); | 1317 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__"); |
| 1318 | 1318 |
| 1319 if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) { | 1319 if ((IS_SPEC_OBJECT(proto) || IS_NULL(proto)) && IS_SPEC_OBJECT(this)) { |
| 1320 %SetPrototype(this, proto); | 1320 %SetPrototype(this, proto); |
| 1321 } | 1321 } |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 | 1324 |
| 1325 // ECMA-262, Edition 6, section 19.1.1.1 | |
| 1325 function ObjectConstructor(x) { | 1326 function ObjectConstructor(x) { |
| 1326 if (%_IsConstructCall()) { | 1327 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) { |
|
Michael Starzinger
2015/10/30 11:52:26
Benedikt raised the question: Does this deal with
| |
| 1327 if (x == null) return this; | 1328 return this; |
| 1328 return TO_OBJECT(x); | |
| 1329 } else { | |
| 1330 if (x == null) return { }; | |
| 1331 return TO_OBJECT(x); | |
| 1332 } | 1329 } |
| 1330 if (IS_NULL(x) || IS_UNDEFINED(x)) return {}; | |
| 1331 return TO_OBJECT(x); | |
| 1333 } | 1332 } |
| 1334 | 1333 |
| 1335 | 1334 |
| 1336 // ---------------------------------------------------------------------------- | 1335 // ---------------------------------------------------------------------------- |
| 1337 // Object | 1336 // Object |
| 1338 | 1337 |
| 1339 %SetNativeFlag(GlobalObject); | 1338 %SetNativeFlag(GlobalObject); |
| 1340 %SetCode(GlobalObject, ObjectConstructor); | 1339 %SetCode(GlobalObject, ObjectConstructor); |
| 1341 | 1340 |
| 1342 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, | 1341 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1860 %InstallToContext([ | 1859 %InstallToContext([ |
| 1861 "global_eval_fun", GlobalEval, | 1860 "global_eval_fun", GlobalEval, |
| 1862 "object_value_of", ObjectValueOf, | 1861 "object_value_of", ObjectValueOf, |
| 1863 "object_to_string", ObjectToString, | 1862 "object_to_string", ObjectToString, |
| 1864 "object_define_own_property", DefineOwnPropertyFromAPI, | 1863 "object_define_own_property", DefineOwnPropertyFromAPI, |
| 1865 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1864 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
| 1866 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1865 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
| 1867 ]); | 1866 ]); |
| 1868 | 1867 |
| 1869 }) | 1868 }) |
| OLD | NEW |