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