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 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1164 desc = descObj; | 1164 desc = descObj; |
1165 */ | 1165 */ |
1166 } else { | 1166 } else { |
1167 var desc = ToPropertyDescriptor(attributes); | 1167 var desc = ToPropertyDescriptor(attributes); |
1168 DefineOwnProperty(obj, name, desc, true); | 1168 DefineOwnProperty(obj, name, desc, true); |
1169 } | 1169 } |
1170 return obj; | 1170 return obj; |
1171 } | 1171 } |
1172 | 1172 |
1173 | 1173 |
1174 function GetOwnEnumerablePropertyNames(properties) { | 1174 function GetOwnEnumerablePropertyNames(object) { |
1175 var names = new InternalArray(); | 1175 var names = new InternalArray(); |
1176 for (var key in properties) { | 1176 for (var key in object) { |
1177 if (%HasOwnProperty(properties, key)) { | 1177 if (%HasOwnProperty(object, key)) { |
1178 names.push(key); | 1178 names.push(key); |
1179 } | 1179 } |
1180 } | 1180 } |
1181 // FLAG_harmony_symbols may be on, but symbols aren't included by for-in. | |
1182 var symbols = ObjectGetOwnPropertyKeys(object, true); | |
1183 for (var i in symbols) { | |
1184 var symbol = symbols[i]; | |
1185 %DebugPrint(symbol); | |
Michael Starzinger
2014/07/14 10:56:01
nit: This looks like a leftover.
| |
1186 if (ObjectGetOwnPropertyDescriptor(object, symbol).enumerable) { | |
1187 %DebugPrint('yes'); | |
Michael Starzinger
2014/07/14 10:56:01
nit: This looks like a leftover.
| |
1188 names.push(symbol); | |
1189 } | |
1190 else %DebugPrint('no'); | |
Michael Starzinger
2014/07/14 10:56:01
nit: This looks like a leftover.
| |
1191 } | |
1181 return names; | 1192 return names; |
1182 } | 1193 } |
1183 | 1194 |
1184 | 1195 |
1185 // ES5 section 15.2.3.7. | 1196 // ES5 section 15.2.3.7. |
1186 function ObjectDefineProperties(obj, properties) { | 1197 function ObjectDefineProperties(obj, properties) { |
1187 if (!IS_SPEC_OBJECT(obj)) { | 1198 if (!IS_SPEC_OBJECT(obj)) { |
1188 throw MakeTypeError("called_on_non_object", ["Object.defineProperties"]); | 1199 throw MakeTypeError("called_on_non_object", ["Object.defineProperties"]); |
1189 } | 1200 } |
1190 var props = ToObject(properties); | 1201 var props = ToObject(properties); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 %SetCode($Function, FunctionConstructor); | 1861 %SetCode($Function, FunctionConstructor); |
1851 %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM); | 1862 %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM); |
1852 | 1863 |
1853 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1864 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1854 "bind", FunctionBind, | 1865 "bind", FunctionBind, |
1855 "toString", FunctionToString | 1866 "toString", FunctionToString |
1856 )); | 1867 )); |
1857 } | 1868 } |
1858 | 1869 |
1859 SetUpFunction(); | 1870 SetUpFunction(); |
OLD | NEW |