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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index 29fa4fb08c8bdaef6bda5d26794b4deab44a962c..c945f8e68545f3fe4b6e75adc173b7260f98e84c 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -891,6 +891,27 @@ class ElementsAccessorBase : public ElementsAccessor {
Subclass::GrowCapacityAndConvertImpl(object, capacity);
}
+ bool GrowCapacity(Handle<JSObject> object, uint32_t capacity) final {
+ 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
+ object->WouldConvertToSlowElements(capacity)) {
+ return false;
+ }
+ Handle<FixedArrayBase> old_elements(object->elements());
+ DCHECK(static_cast<uint32_t>(old_elements->length()) < capacity);
+ Handle<FixedArrayBase> elements =
+ ConvertElementsWithCapacity(object, old_elements, kind(), capacity);
+
+ DCHECK_EQ(object->GetElementsKind(), kind());
+ // Transition through the allocation site as well if present.
+ if (JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kCheckOnly>(
+ object, kind())) {
+ return false;
+ }
+
+ object->set_elements(*elements);
+ return true;
+ }
+
void Delete(Handle<JSObject> obj, uint32_t entry) final {
Subclass::DeleteImpl(obj, entry);
}
« 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