Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: src/elements.cc

Issue 1211833002: Back off normalizing on set length in sync with adding a property (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698