| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 } | 833 } |
| 834 | 834 |
| 835 %DefineDataPropertyUnchecked(obj, p, value, flag); | 835 %DefineDataPropertyUnchecked(obj, p, value, flag); |
| 836 } else { | 836 } else { |
| 837 // There are 3 cases that lead here: | 837 // There are 3 cases that lead here: |
| 838 // Step 4b - defining a new accessor property. | 838 // Step 4b - defining a new accessor property. |
| 839 // Steps 9c & 12 - replacing an existing data property with an accessor | 839 // Steps 9c & 12 - replacing an existing data property with an accessor |
| 840 // property. | 840 // property. |
| 841 // Step 12 - updating an existing accessor property with an accessor | 841 // Step 12 - updating an existing accessor property with an accessor |
| 842 // descriptor. | 842 // descriptor. |
| 843 var getter = desc.hasGetter() ? desc.getGet() : null; | 843 var getter = null; |
| 844 var setter = desc.hasSetter() ? desc.getSet() : null; | 844 if (desc.hasGetter()) { |
| 845 getter = desc.getGet(); |
| 846 } else if (IsAccessorDescriptor(current) && current.hasGetter()) { |
| 847 getter = current.getGet(); |
| 848 } |
| 849 var setter = null; |
| 850 if (desc.hasSetter()) { |
| 851 setter = desc.getSet(); |
| 852 } else if (IsAccessorDescriptor(current) && current.hasSetter()) { |
| 853 setter = current.getSet(); |
| 854 } |
| 845 %DefineAccessorPropertyUnchecked(obj, p, getter, setter, flag); | 855 %DefineAccessorPropertyUnchecked(obj, p, getter, setter, flag); |
| 846 } | 856 } |
| 847 return true; | 857 return true; |
| 848 } | 858 } |
| 849 | 859 |
| 850 | 860 |
| 851 // ES5 section 15.4.5.1. | 861 // ES5 section 15.4.5.1. |
| 852 function DefineArrayProperty(obj, p, desc, should_throw) { | 862 function DefineArrayProperty(obj, p, desc, should_throw) { |
| 853 // Note that the length of an array is not actually stored as part of the | 863 // Note that the length of an array is not actually stored as part of the |
| 854 // property, hence we use generated code throughout this function instead of | 864 // property, hence we use generated code throughout this function instead of |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 } | 1911 } |
| 1902 if (!IS_SPEC_FUNCTION(method)) { | 1912 if (!IS_SPEC_FUNCTION(method)) { |
| 1903 throw MakeTypeError('not_iterable', [obj]); | 1913 throw MakeTypeError('not_iterable', [obj]); |
| 1904 } | 1914 } |
| 1905 var iterator = %_CallFunction(obj, method); | 1915 var iterator = %_CallFunction(obj, method); |
| 1906 if (!IS_SPEC_OBJECT(iterator)) { | 1916 if (!IS_SPEC_OBJECT(iterator)) { |
| 1907 throw MakeTypeError('not_an_iterator', [iterator]); | 1917 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1908 } | 1918 } |
| 1909 return iterator; | 1919 return iterator; |
| 1910 } | 1920 } |
| OLD | NEW |