| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 | 40 |
| 41 // ES6 7.3.9 | 41 // ES6 7.3.9 |
| 42 function GetMethod(obj, p) { | 42 function GetMethod(obj, p) { |
| 43 var func = obj[p]; | 43 var func = obj[p]; |
| 44 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; | 44 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; |
| 45 if (IS_CALLABLE(func)) return func; | 45 if (IS_CALLABLE(func)) return func; |
| 46 throw %make_type_error(kCalledNonCallable, typeof func); | 46 throw %make_type_error(kCalledNonCallable, typeof func); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // ES6 19.1.1.1 | |
| 50 function ObjectConstructor(x) { | |
| 51 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) { | |
| 52 return this; | |
| 53 } | |
| 54 if (IS_NULL(x) || IS_UNDEFINED(x)) return {}; | |
| 55 return TO_OBJECT(x); | |
| 56 } | |
| 57 | |
| 58 | 49 |
| 59 // ---------------------------------------------------------------------------- | 50 // ---------------------------------------------------------------------------- |
| 60 // Object | 51 // Object |
| 61 | 52 |
| 62 %SetNativeFlag(GlobalObject); | |
| 63 %SetCode(GlobalObject, ObjectConstructor); | |
| 64 | |
| 65 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, | |
| 66 DONT_ENUM); | |
| 67 | |
| 68 // Set up non-enumerable functions on the Object.prototype object. | 53 // Set up non-enumerable functions on the Object.prototype object. |
| 69 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ | 54 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ |
| 70 "toString", ObjectToString, | 55 "toString", ObjectToString, |
| 71 "toLocaleString", ObjectToLocaleString, | 56 "toLocaleString", ObjectToLocaleString, |
| 72 // valueOf is added in bootstrapper.cc. | 57 // valueOf is added in bootstrapper.cc. |
| 73 "isPrototypeOf", ObjectIsPrototypeOf, | 58 "isPrototypeOf", ObjectIsPrototypeOf, |
| 74 // propertyIsEnumerable is added in bootstrapper.cc. | 59 // propertyIsEnumerable is added in bootstrapper.cc. |
| 75 // __defineGetter__ is added in bootstrapper.cc. | 60 // __defineGetter__ is added in bootstrapper.cc. |
| 76 // __lookupGetter__ is added in bootstrapper.cc. | 61 // __lookupGetter__ is added in bootstrapper.cc. |
| 77 // __defineSetter__ is added in bootstrapper.cc. | 62 // __defineSetter__ is added in bootstrapper.cc. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 // ---------------------------------------------------------------------------- | 85 // ---------------------------------------------------------------------------- |
| 101 // Exports | 86 // Exports |
| 102 | 87 |
| 103 utils.Export(function(to) { | 88 utils.Export(function(to) { |
| 104 to.GetIterator = GetIterator; | 89 to.GetIterator = GetIterator; |
| 105 to.GetMethod = GetMethod; | 90 to.GetMethod = GetMethod; |
| 106 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; | 91 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; |
| 107 }); | 92 }); |
| 108 | 93 |
| 109 }) | 94 }) |
| OLD | NEW |