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

Side by Side Diff: src/elements.cc

Issue 2252393002: [elements, turbofan] Implement simple GrowElements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Android build Created 4 years, 3 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 | « src/elements.h ('k') | 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/elements.h" 5 #include "src/elements.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/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 904
905 void TransitionElementsKind(Handle<JSObject> object, Handle<Map> map) final { 905 void TransitionElementsKind(Handle<JSObject> object, Handle<Map> map) final {
906 Subclass::TransitionElementsKindImpl(object, map); 906 Subclass::TransitionElementsKindImpl(object, map);
907 } 907 }
908 908
909 void GrowCapacityAndConvert(Handle<JSObject> object, 909 void GrowCapacityAndConvert(Handle<JSObject> object,
910 uint32_t capacity) final { 910 uint32_t capacity) final {
911 Subclass::GrowCapacityAndConvertImpl(object, capacity); 911 Subclass::GrowCapacityAndConvertImpl(object, capacity);
912 } 912 }
913 913
914 bool GrowCapacity(Handle<JSObject> object, uint32_t index) final {
915 // This function is intended to be called from optimized code. We don't
916 // want to trigger lazy deopts there, so refuse to handle cases that would.
917 if (object->map()->is_prototype_map() ||
918 object->WouldConvertToSlowElements(index)) {
919 return false;
920 }
921 Handle<FixedArrayBase> old_elements(object->elements());
922 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1);
923 DCHECK(static_cast<uint32_t>(old_elements->length()) < new_capacity);
924 Handle<FixedArrayBase> elements =
925 ConvertElementsWithCapacity(object, old_elements, kind(), new_capacity);
926
927 DCHECK_EQ(object->GetElementsKind(), kind());
928 // Transition through the allocation site as well if present.
929 if (JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kCheckOnly>(
930 object, kind())) {
931 return false;
932 }
933
934 object->set_elements(*elements);
935 return true;
936 }
937
914 void Delete(Handle<JSObject> obj, uint32_t entry) final { 938 void Delete(Handle<JSObject> obj, uint32_t entry) final {
915 Subclass::DeleteImpl(obj, entry); 939 Subclass::DeleteImpl(obj, entry);
916 } 940 }
917 941
918 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, 942 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
919 FixedArrayBase* to, ElementsKind from_kind, 943 FixedArrayBase* to, ElementsKind from_kind,
920 uint32_t to_start, int packed_size, 944 uint32_t to_start, int packed_size,
921 int copy_size) { 945 int copy_size) {
922 UNREACHABLE(); 946 UNREACHABLE();
923 } 947 }
(...skipping 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3711 insertion_index += len; 3735 insertion_index += len;
3712 } 3736 }
3713 3737
3714 DCHECK_EQ(insertion_index, result_len); 3738 DCHECK_EQ(insertion_index, result_len);
3715 return result_array; 3739 return result_array;
3716 } 3740 }
3717 3741
3718 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3742 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3719 } // namespace internal 3743 } // namespace internal
3720 } // namespace v8 3744 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698