OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 } | 827 } |
828 | 828 |
829 var value = void 0; // Default value is undefined. | 829 var value = void 0; // Default value is undefined. |
830 if (desc.hasValue()) { | 830 if (desc.hasValue()) { |
831 value = desc.getValue(); | 831 value = desc.getValue(); |
832 } else if (!IS_UNDEFINED(current) && IsDataDescriptor(current)) { | 832 } else if (!IS_UNDEFINED(current) && IsDataDescriptor(current)) { |
833 value = current.getValue(); | 833 value = current.getValue(); |
834 } | 834 } |
835 | 835 |
836 %DefineOrRedefineDataProperty(obj, p, value, flag); | 836 %DefineOrRedefineDataProperty(obj, p, value, flag); |
837 } else if (IsGenericDescriptor(desc)) { | |
838 // Step 12 - updating an existing accessor property with generic | |
839 // descriptor. Changing flags only. | |
840 %DefineOrRedefineAccessorProperty(obj, p, GETTER, current.getGet(), flag); | |
841 } else { | 837 } else { |
842 // There are 3 cases that lead here: | 838 // There are 3 cases that lead here: |
843 // Step 4b - defining a new accessor property. | 839 // Step 4b - defining a new accessor property. |
844 // Steps 9c & 12 - replacing an existing data property with an accessor | 840 // Steps 9c & 12 - replacing an existing data property with an accessor |
845 // property. | 841 // property. |
846 // Step 12 - updating an existing accessor property with an accessor | 842 // Step 12 - updating an existing accessor property with an accessor |
847 // descriptor. | 843 // descriptor. |
848 if (desc.hasGetter()) { | 844 var getter = desc.hasGetter() ? desc.getGet() : null; |
849 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); | 845 var setter = desc.hasSetter() ? desc.getSet() : null; |
850 } | 846 %DefineOrRedefineAccessorProperty(obj, p, getter, setter, flag); |
851 if (desc.hasSetter()) { | |
852 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); | |
853 } | |
854 } | 847 } |
855 return true; | 848 return true; |
856 } | 849 } |
857 | 850 |
858 | 851 |
859 // ES5 section 15.4.5.1. | 852 // ES5 section 15.4.5.1. |
860 function DefineArrayProperty(obj, p, desc, should_throw) { | 853 function DefineArrayProperty(obj, p, desc, should_throw) { |
861 // Note that the length of an array is not actually stored as part of the | 854 // Note that the length of an array is not actually stored as part of the |
862 // property, hence we use generated code throughout this function instead of | 855 // property, hence we use generated code throughout this function instead of |
863 // DefineObjectProperty() to modify its value. | 856 // DefineObjectProperty() to modify its value. |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 | 1638 |
1646 function SetUpFunction() { | 1639 function SetUpFunction() { |
1647 %CheckIsBootstrapping(); | 1640 %CheckIsBootstrapping(); |
1648 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1641 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1649 "bind", FunctionBind, | 1642 "bind", FunctionBind, |
1650 "toString", FunctionToString | 1643 "toString", FunctionToString |
1651 )); | 1644 )); |
1652 } | 1645 } |
1653 | 1646 |
1654 SetUpFunction(); | 1647 SetUpFunction(); |
OLD | NEW |