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 1002 matching lines...) Loading... | |
1013 } | 1013 } |
1014 return obj; | 1014 return obj; |
1015 } | 1015 } |
1016 | 1016 |
1017 | 1017 |
1018 // ES5 section 15.2.3.7. | 1018 // ES5 section 15.2.3.7. |
1019 function ObjectDefineProperties(obj, properties) { | 1019 function ObjectDefineProperties(obj, properties) { |
1020 if (!IS_SPEC_OBJECT(obj)) | 1020 if (!IS_SPEC_OBJECT(obj)) |
1021 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); | 1021 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); |
1022 var props = ToObject(properties); | 1022 var props = ToObject(properties); |
1023 var key_values = []; | 1023 var key_values = new InternalArray(); |
1024 for (var key in props) { | 1024 for (var key in props) { |
Lasse Reichstein
2011/08/18 06:56:41
How about making a way to find all own properties
| |
1025 if (%HasLocalProperty(props, key)) { | 1025 if (%HasLocalProperty(props, key)) { |
1026 key_values.push(key); | 1026 key_values.push(key); |
1027 var value = props[key]; | 1027 var value = props[key]; |
1028 var desc = ToPropertyDescriptor(value); | 1028 var desc = ToPropertyDescriptor(value); |
1029 key_values.push(desc); | 1029 key_values.push(desc); |
1030 } | 1030 } |
1031 } | 1031 } |
1032 for (var i = 0; i < key_values.length; i += 2) { | 1032 for (var i = 0; i < key_values.length; i += 2) { |
1033 var key = key_values[i]; | 1033 var key = key_values[i]; |
1034 var desc = key_values[i + 1]; | 1034 var desc = key_values[i + 1]; |
(...skipping 499 matching lines...) Loading... | |
1534 // ---------------------------------------------------------------------------- | 1534 // ---------------------------------------------------------------------------- |
1535 | 1535 |
1536 function SetupFunction() { | 1536 function SetupFunction() { |
1537 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1537 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1538 "bind", FunctionBind, | 1538 "bind", FunctionBind, |
1539 "toString", FunctionToString | 1539 "toString", FunctionToString |
1540 )); | 1540 )); |
1541 } | 1541 } |
1542 | 1542 |
1543 SetupFunction(); | 1543 SetupFunction(); |
OLD | NEW |