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

Side by Side Diff: src/elements.cc

Issue 2244983004: [elements, turbofan] Implement simple GrowElements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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') | src/objects.cc » ('J')
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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 884
885 void TransitionElementsKind(Handle<JSObject> object, Handle<Map> map) final { 885 void TransitionElementsKind(Handle<JSObject> object, Handle<Map> map) final {
886 Subclass::TransitionElementsKindImpl(object, map); 886 Subclass::TransitionElementsKindImpl(object, map);
887 } 887 }
888 888
889 void GrowCapacityAndConvert(Handle<JSObject> object, 889 void GrowCapacityAndConvert(Handle<JSObject> object,
890 uint32_t capacity) final { 890 uint32_t capacity) final {
891 Subclass::GrowCapacityAndConvertImpl(object, capacity); 891 Subclass::GrowCapacityAndConvertImpl(object, capacity);
892 } 892 }
893 893
894 bool GrowCapacity(Handle<JSObject> object, uint32_t capacity) final {
895 if (object->map()->is_prototype_map() ||
Jakob Kummerow 2016/08/16 15:15:01 To explain why this code does what it's doing, ple
896 object->WouldConvertToSlowElements(capacity)) {
897 return false;
898 }
899 Handle<FixedArrayBase> old_elements(object->elements());
900 DCHECK(static_cast<uint32_t>(old_elements->length()) < capacity);
901 Handle<FixedArrayBase> elements =
902 ConvertElementsWithCapacity(object, old_elements, kind(), capacity);
903
904 DCHECK_EQ(object->GetElementsKind(), kind());
905 // Transition through the allocation site as well if present.
906 if (JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kCheckOnly>(
907 object, kind())) {
908 return false;
909 }
910
911 object->set_elements(*elements);
912 return true;
913 }
914
894 void Delete(Handle<JSObject> obj, uint32_t entry) final { 915 void Delete(Handle<JSObject> obj, uint32_t entry) final {
895 Subclass::DeleteImpl(obj, entry); 916 Subclass::DeleteImpl(obj, entry);
896 } 917 }
897 918
898 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, 919 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
899 FixedArrayBase* to, ElementsKind from_kind, 920 FixedArrayBase* to, ElementsKind from_kind,
900 uint32_t to_start, int packed_size, 921 uint32_t to_start, int packed_size,
901 int copy_size) { 922 int copy_size) {
902 UNREACHABLE(); 923 UNREACHABLE();
903 } 924 }
(...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3469 insertion_index += len; 3490 insertion_index += len;
3470 } 3491 }
3471 3492
3472 DCHECK_EQ(insertion_index, result_len); 3493 DCHECK_EQ(insertion_index, result_len);
3473 return result_array; 3494 return result_array;
3474 } 3495 }
3475 3496
3476 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 3497 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
3477 } // namespace internal 3498 } // namespace internal
3478 } // namespace v8 3499 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698