OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 */ | 1110 */ |
1111 } else { | 1111 } else { |
1112 var desc = ToPropertyDescriptor(attributes); | 1112 var desc = ToPropertyDescriptor(attributes); |
1113 DefineOwnProperty(obj, name, desc, true); | 1113 DefineOwnProperty(obj, name, desc, true); |
1114 } | 1114 } |
1115 return obj; | 1115 return obj; |
1116 } | 1116 } |
1117 | 1117 |
1118 | 1118 |
1119 function GetOwnEnumerablePropertyNames(properties) { | 1119 function GetOwnEnumerablePropertyNames(properties) { |
1120 var names = new InternalPackedArray(); | 1120 var names = new InternalArray(); |
1121 for (var key in properties) { | 1121 for (var key in properties) { |
1122 if (%HasLocalProperty(properties, key)) { | 1122 if (%HasLocalProperty(properties, key)) { |
1123 names.push(key); | 1123 names.push(key); |
1124 } | 1124 } |
1125 } | 1125 } |
1126 return names; | 1126 return names; |
1127 } | 1127 } |
1128 | 1128 |
1129 | 1129 |
1130 // ES5 section 15.2.3.7. | 1130 // ES5 section 15.2.3.7. |
1131 function ObjectDefineProperties(obj, properties) { | 1131 function ObjectDefineProperties(obj, properties) { |
1132 if (!IS_SPEC_OBJECT(obj)) { | 1132 if (!IS_SPEC_OBJECT(obj)) { |
1133 throw MakeTypeError("called_on_non_object", ["Object.defineProperties"]); | 1133 throw MakeTypeError("called_on_non_object", ["Object.defineProperties"]); |
1134 } | 1134 } |
1135 var props = ToObject(properties); | 1135 var props = ToObject(properties); |
1136 var names = GetOwnEnumerablePropertyNames(props); | 1136 var names = GetOwnEnumerablePropertyNames(props); |
1137 var descriptors = new InternalPackedArray(); | 1137 var descriptors = new InternalArray(); |
1138 for (var i = 0; i < names.length; i++) { | 1138 for (var i = 0; i < names.length; i++) { |
1139 descriptors.push(ToPropertyDescriptor(props[names[i]])); | 1139 descriptors.push(ToPropertyDescriptor(props[names[i]])); |
1140 } | 1140 } |
1141 for (var i = 0; i < names.length; i++) { | 1141 for (var i = 0; i < names.length; i++) { |
1142 DefineOwnProperty(obj, names[i], descriptors[i], true); | 1142 DefineOwnProperty(obj, names[i], descriptors[i], true); |
1143 } | 1143 } |
1144 return obj; | 1144 return obj; |
1145 } | 1145 } |
1146 | 1146 |
1147 | 1147 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 | 1718 |
1719 function SetUpFunction() { | 1719 function SetUpFunction() { |
1720 %CheckIsBootstrapping(); | 1720 %CheckIsBootstrapping(); |
1721 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1721 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1722 "bind", FunctionBind, | 1722 "bind", FunctionBind, |
1723 "toString", FunctionToString | 1723 "toString", FunctionToString |
1724 )); | 1724 )); |
1725 } | 1725 } |
1726 | 1726 |
1727 SetUpFunction(); | 1727 SetUpFunction(); |
OLD | NEW |