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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 ELEMENTS_LIST(ACCESSOR_DELETE) | 1835 ELEMENTS_LIST(ACCESSOR_DELETE) |
1836 #undef ACCESSOR_DELETE | 1836 #undef ACCESSOR_DELETE |
1837 elements_accessors_ = NULL; | 1837 elements_accessors_ = NULL; |
1838 } | 1838 } |
1839 | 1839 |
1840 | 1840 |
1841 template <typename ElementsAccessorSubclass, typename ElementsKindTraits> | 1841 template <typename ElementsAccessorSubclass, typename ElementsKindTraits> |
1842 void ElementsAccessorBase<ElementsAccessorSubclass, ElementsKindTraits>:: | 1842 void ElementsAccessorBase<ElementsAccessorSubclass, ElementsKindTraits>:: |
1843 SetLengthImpl(Handle<JSArray> array, uint32_t length, | 1843 SetLengthImpl(Handle<JSArray> array, uint32_t length, |
1844 Handle<FixedArrayBase> backing_store) { | 1844 Handle<FixedArrayBase> backing_store) { |
1845 DCHECK(!JSArray::SetLengthWouldNormalize(array->GetHeap(), length)); | 1845 DCHECK(!array->SetLengthWouldNormalize(length)); |
1846 DCHECK(IsFastElementsKind(array->GetElementsKind())); | 1846 DCHECK(IsFastElementsKind(array->GetElementsKind())); |
1847 uint32_t old_length = 0; | 1847 uint32_t old_length = 0; |
1848 CHECK(array->length()->ToArrayIndex(&old_length)); | 1848 CHECK(array->length()->ToArrayIndex(&old_length)); |
1849 | 1849 |
1850 if (old_length < length) { | 1850 if (old_length < length) { |
1851 ElementsKind kind = array->GetElementsKind(); | 1851 ElementsKind kind = array->GetElementsKind(); |
1852 if (!IsFastHoleyElementsKind(kind)) { | 1852 if (!IsFastHoleyElementsKind(kind)) { |
1853 kind = GetHoleyElementsKind(kind); | 1853 kind = GetHoleyElementsKind(kind); |
1854 JSObject::TransitionElementsKind(array, kind); | 1854 JSObject::TransitionElementsKind(array, kind); |
1855 } | 1855 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 break; | 1969 break; |
1970 } | 1970 } |
1971 | 1971 |
1972 array->set_elements(*elms); | 1972 array->set_elements(*elms); |
1973 array->set_length(Smi::FromInt(number_of_elements)); | 1973 array->set_length(Smi::FromInt(number_of_elements)); |
1974 return array; | 1974 return array; |
1975 } | 1975 } |
1976 | 1976 |
1977 } // namespace internal | 1977 } // namespace internal |
1978 } // namespace v8 | 1978 } // namespace v8 |
OLD | NEW |