Chromium Code Reviews| 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 var deletedDesc = GetOwnPropertyJS(obj, index); | 880 var deletedDesc = GetOwnPropertyJS(obj, index); |
| 881 if (deletedDesc && deletedDesc.hasValue()) | 881 if (deletedDesc && deletedDesc.hasValue()) |
| 882 removed[length - new_length] = deletedDesc.getValue(); | 882 removed[length - new_length] = deletedDesc.getValue(); |
| 883 } | 883 } |
| 884 if (!Delete(obj, index, false)) { | 884 if (!Delete(obj, index, false)) { |
| 885 new_length = length + 1; | 885 new_length = length + 1; |
| 886 threw = true; | 886 threw = true; |
| 887 break; | 887 break; |
| 888 } | 888 } |
| 889 } | 889 } |
| 890 // Make sure the below call to DefineObjectProperty() doesn't overwrite | |
| 891 // any magic "length" property by removing the value. | |
| 892 // TODO(mstarzinger): This hack should be removed once we have addressed the | |
| 893 // respective TODO in Runtime_DefineDataPropertyUnchecked. | |
|
adamk
2014/12/11 20:26:07
This TODO was taken care of by r21558, so at least
| |
| 894 // For the time being, we need a hack to prevent Object.observe from | |
| 895 // generating two change records. | |
| 896 obj.length = new_length; | |
| 897 desc.value_ = UNDEFINED; | |
| 898 desc.hasValue_ = false; | |
| 899 threw = !DefineObjectProperty(obj, "length", desc, should_throw) || threw; | 890 threw = !DefineObjectProperty(obj, "length", desc, should_throw) || threw; |
| 900 if (emit_splice) { | 891 if (emit_splice) { |
| 901 EndPerformSplice(obj); | 892 EndPerformSplice(obj); |
| 902 EnqueueSpliceRecord(obj, | 893 EnqueueSpliceRecord(obj, |
| 903 new_length < old_length ? new_length : old_length, | 894 new_length < old_length ? new_length : old_length, |
| 904 removed, | 895 removed, |
| 905 new_length > old_length ? new_length - old_length : 0); | 896 new_length > old_length ? new_length - old_length : 0); |
| 906 } | 897 } |
| 907 if (threw) { | 898 if (threw) { |
| 908 if (should_throw) { | 899 if (should_throw) { |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1897 } | 1888 } |
| 1898 if (!IS_SPEC_FUNCTION(method)) { | 1889 if (!IS_SPEC_FUNCTION(method)) { |
| 1899 throw MakeTypeError('not_iterable', [obj]); | 1890 throw MakeTypeError('not_iterable', [obj]); |
| 1900 } | 1891 } |
| 1901 var iterator = %_CallFunction(obj, method); | 1892 var iterator = %_CallFunction(obj, method); |
| 1902 if (!IS_SPEC_OBJECT(iterator)) { | 1893 if (!IS_SPEC_OBJECT(iterator)) { |
| 1903 throw MakeTypeError('not_an_iterator', [iterator]); | 1894 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1904 } | 1895 } |
| 1905 return iterator; | 1896 return iterator; |
| 1906 } | 1897 } |
| OLD | NEW |