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 12 matching lines...) Expand all Loading... |
23 // ---------------------------------------------------------------------------- | 23 // ---------------------------------------------------------------------------- |
24 // Object | 24 // Object |
25 | 25 |
26 // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]]) | 26 // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]]) |
27 function ObjectToLocaleString() { | 27 function ObjectToLocaleString() { |
28 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString"); | 28 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString"); |
29 return this.toString(); | 29 return this.toString(); |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 // ES6 19.1.3.7 Object.prototype.valueOf() | |
34 function ObjectValueOf() { | |
35 return TO_OBJECT(this); | |
36 } | |
37 | |
38 | |
39 // ES6 19.1.3.3 Object.prototype.isPrototypeOf(V) | 33 // ES6 19.1.3.3 Object.prototype.isPrototypeOf(V) |
40 function ObjectIsPrototypeOf(V) { | 34 function ObjectIsPrototypeOf(V) { |
41 if (!IS_RECEIVER(V)) return false; | 35 if (!IS_RECEIVER(V)) return false; |
42 var O = TO_OBJECT(this); | 36 var O = TO_OBJECT(this); |
43 return %HasInPrototypeChain(V, O); | 37 return %HasInPrototypeChain(V, O); |
44 } | 38 } |
45 | 39 |
46 | 40 |
47 // ES6 7.3.9 | 41 // ES6 7.3.9 |
48 function GetMethod(obj, p) { | 42 function GetMethod(obj, p) { |
(...skipping 19 matching lines...) Expand all Loading... |
68 %SetNativeFlag(GlobalObject); | 62 %SetNativeFlag(GlobalObject); |
69 %SetCode(GlobalObject, ObjectConstructor); | 63 %SetCode(GlobalObject, ObjectConstructor); |
70 | 64 |
71 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, | 65 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, |
72 DONT_ENUM); | 66 DONT_ENUM); |
73 | 67 |
74 // Set up non-enumerable functions on the Object.prototype object. | 68 // Set up non-enumerable functions on the Object.prototype object. |
75 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ | 69 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ |
76 "toString", ObjectToString, | 70 "toString", ObjectToString, |
77 "toLocaleString", ObjectToLocaleString, | 71 "toLocaleString", ObjectToLocaleString, |
78 "valueOf", ObjectValueOf, | 72 // valueOf is added in bootstrapper.cc. |
79 "isPrototypeOf", ObjectIsPrototypeOf, | 73 "isPrototypeOf", ObjectIsPrototypeOf, |
80 // propertyIsEnumerable is added in bootstrapper.cc. | 74 // propertyIsEnumerable is added in bootstrapper.cc. |
81 // __defineGetter__ is added in bootstrapper.cc. | 75 // __defineGetter__ is added in bootstrapper.cc. |
82 // __lookupGetter__ is added in bootstrapper.cc. | 76 // __lookupGetter__ is added in bootstrapper.cc. |
83 // __defineSetter__ is added in bootstrapper.cc. | 77 // __defineSetter__ is added in bootstrapper.cc. |
84 // __lookupSetter__ is added in bootstrapper.cc. | 78 // __lookupSetter__ is added in bootstrapper.cc. |
85 ]); | 79 ]); |
86 | 80 |
87 | 81 |
88 // ---------------------------------------------------------------------------- | 82 // ---------------------------------------------------------------------------- |
(...skipping 16 matching lines...) Expand all Loading... |
105 | 99 |
106 // ---------------------------------------------------------------------------- | 100 // ---------------------------------------------------------------------------- |
107 // Exports | 101 // Exports |
108 | 102 |
109 utils.Export(function(to) { | 103 utils.Export(function(to) { |
110 to.GetIterator = GetIterator; | 104 to.GetIterator = GetIterator; |
111 to.GetMethod = GetMethod; | 105 to.GetMethod = GetMethod; |
112 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; | 106 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; |
113 }); | 107 }); |
114 | 108 |
115 %InstallToContext([ | |
116 "object_value_of", ObjectValueOf, | |
117 ]); | |
118 | |
119 }) | 109 }) |
OLD | NEW |