OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 return names; | 1071 return names; |
1072 } | 1072 } |
1073 | 1073 |
1074 | 1074 |
1075 // ES5 section 15.2.3.7. | 1075 // ES5 section 15.2.3.7. |
1076 function ObjectDefineProperties(obj, properties) { | 1076 function ObjectDefineProperties(obj, properties) { |
1077 if (!IS_SPEC_OBJECT(obj)) | 1077 if (!IS_SPEC_OBJECT(obj)) |
1078 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); | 1078 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); |
1079 var props = ToObject(properties); | 1079 var props = ToObject(properties); |
1080 var names = GetOwnEnumerablePropertyNames(props); | 1080 var names = GetOwnEnumerablePropertyNames(props); |
| 1081 var descriptors = new InternalArray(); |
1081 for (var i = 0; i < names.length; i++) { | 1082 for (var i = 0; i < names.length; i++) { |
1082 var name = names[i]; | 1083 descriptors.push(ToPropertyDescriptor(props[names[i]])); |
1083 var desc = ToPropertyDescriptor(props[name]); | 1084 } |
1084 DefineOwnProperty(obj, name, desc, true); | 1085 for (var i = 0; i < names.length; i++) { |
| 1086 DefineOwnProperty(obj, names[i], descriptors[i], true); |
1085 } | 1087 } |
1086 return obj; | 1088 return obj; |
1087 } | 1089 } |
1088 | 1090 |
1089 | 1091 |
1090 // Harmony proxies. | 1092 // Harmony proxies. |
1091 function ProxyFix(obj) { | 1093 function ProxyFix(obj) { |
1092 var handler = %GetHandler(obj); | 1094 var handler = %GetHandler(obj); |
1093 var props = CallTrap0(handler, "fix", void 0); | 1095 var props = CallTrap0(handler, "fix", void 0); |
1094 if (IS_UNDEFINED(props)) { | 1096 if (IS_UNDEFINED(props)) { |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 | 1606 |
1605 function SetUpFunction() { | 1607 function SetUpFunction() { |
1606 %CheckIsBootstrapping(); | 1608 %CheckIsBootstrapping(); |
1607 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1609 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1608 "bind", FunctionBind, | 1610 "bind", FunctionBind, |
1609 "toString", FunctionToString | 1611 "toString", FunctionToString |
1610 )); | 1612 )); |
1611 } | 1613 } |
1612 | 1614 |
1613 SetUpFunction(); | 1615 SetUpFunction(); |
OLD | NEW |