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

Unified Diff: src/objects.cc

Issue 980523004: Retain maps embedded in optimized code for several garbage collections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Check constructor. Created 5 years, 9 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/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index ebe4a2414b3b8ac721e6ee7f76efa126743eca02..ad401300401132a03a7bfb69f4fa331fe34f4fd1 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8312,6 +8312,37 @@ Handle<WeakFixedArray> WeakFixedArray::Allocate(
}
+Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj) {
+ int length = array->Length();
+ array = EnsureSpace(array, length + 1);
+ array->Set(length, *obj);
+ array->SetLength(length + 1);
+ return array;
+}
+
+
+Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1,
+ Handle<Object> obj2) {
+ int length = array->Length();
+ array = EnsureSpace(array, length + 2);
+ array->Set(length, *obj1);
+ array->Set(length + 1, *obj2);
+ array->SetLength(length + 2);
+ return array;
+}
+
+
+Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) {
+ int capacity = array->length();
+ if (capacity < kFirstIndex + length) {
+ capacity = kFirstIndex + length;
+ capacity = capacity + Max(capacity / 2, 2);
+ array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity));
+ }
+ return array;
+}
+
+
Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate,
int number_of_descriptors,
int slack) {
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698