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

Unified Diff: src/objects.cc

Issue 1026113004: Reload length of retained_maps array after GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove debug output 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
« src/objects.h ('K') | « src/objects.h ('k') | test/cctest/test-heap.cc » ('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 f7d0fd5b65fc5fa923c7dfbccf9cda42128a6795..12184a81df6599c3452eb3101e35179054c27a67 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8277,9 +8277,13 @@ Handle<WeakFixedArray> WeakFixedArray::Allocate(
}
-Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj) {
+Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj,
+ AddMode mode) {
int length = array->Length();
array = EnsureSpace(array, length + 1);
+ if (mode == kReloadLengthAfterAllocation) {
+ length = array->Length();
Jarin 2015/03/24 13:50:04 Would it make sense to here (and in the other Add
ulan 2015/03/24 14:01:36 Done.
+ }
array->Set(length, *obj);
array->SetLength(length + 1);
return array;
@@ -8287,9 +8291,12 @@ Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj) {
Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1,
- Handle<Object> obj2) {
+ Handle<Object> obj2, AddMode mode) {
int length = array->Length();
array = EnsureSpace(array, length + 2);
+ if (mode == kReloadLengthAfterAllocation) {
+ length = array->Length();
+ }
array->Set(length, *obj1);
array->Set(length + 1, *obj2);
array->SetLength(length + 2);
@@ -8299,10 +8306,12 @@ Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1,
Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) {
int capacity = array->length();
+ bool empty = (capacity == 0);
if (capacity < kFirstIndex + length) {
capacity = kFirstIndex + length;
capacity = capacity + Max(capacity / 2, 2);
array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity));
+ if (empty) array->SetLength(0);
}
return array;
}
« src/objects.h ('K') | « src/objects.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698