Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 45c26dfaabb61f00fe5b0f34474ec18ae166940e..2f3a1a8c1c7d300e892223b0a9d40a3aad530e49 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -141,7 +141,9 @@ |
chunks_queued_for_free_(NULL), |
gc_callbacks_depth_(0), |
deserialization_complete_(false), |
- concurrent_sweeping_enabled_(false) { |
+ concurrent_sweeping_enabled_(false), |
+ migration_failure_(false), |
+ previous_migration_failure_(false) { |
// Allow build-time customization of the max semispace size. Building |
// V8 with snapshots and a non-default max semispace size is much |
// easier if you can define it as part of the build environment. |
@@ -703,6 +705,13 @@ |
// Remember the last top pointer so that we can later find out |
// whether we allocated in new space since the last GC. |
new_space_top_after_last_gc_ = new_space()->top(); |
+ |
+ if (migration_failure_) { |
+ set_previous_migration_failure(true); |
+ } else { |
+ set_previous_migration_failure(false); |
+ } |
+ set_migration_failure(false); |
} |
@@ -1677,6 +1686,7 @@ |
void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) { |
ProcessArrayBuffers(retainer, false); |
+ ProcessNewArrayBufferViews(retainer); |
ProcessNativeContexts(retainer); |
ProcessAllocationSites(retainer); |
} |
@@ -1684,6 +1694,7 @@ |
void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) { |
ProcessArrayBuffers(retainer, true); |
+ ProcessNewArrayBufferViews(retainer); |
ProcessNativeContexts(retainer); |
} |
@@ -1710,6 +1721,7 @@ |
Object* undefined = undefined_value(); |
Object* next = array_buffers_list(); |
bool old_objects_recorded = false; |
+ if (migration_failure()) return; |
while (next != undefined) { |
if (!old_objects_recorded) { |
old_objects_recorded = !InNewSpace(next); |
@@ -1717,6 +1729,20 @@ |
CHECK((InNewSpace(next) && !old_objects_recorded) || !InNewSpace(next)); |
next = JSArrayBuffer::cast(next)->weak_next(); |
} |
+} |
+ |
+ |
+void Heap::ProcessNewArrayBufferViews(WeakObjectRetainer* retainer) { |
+ // Retain the list of new space views. |
+ Object* typed_array_obj = VisitWeakList<JSArrayBufferView>( |
+ this, new_array_buffer_views_list_, retainer, false, NULL); |
+ set_new_array_buffer_views_list(typed_array_obj); |
+ |
+ // Some objects in the list may be in old space now. Find them |
+ // and move them to the corresponding array buffer. |
+ Object* view = VisitNewArrayBufferViewsWeakList( |
+ this, new_array_buffer_views_list_, retainer); |
+ set_new_array_buffer_views_list(view); |
} |
@@ -2151,6 +2177,7 @@ |
if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) { |
return; |
} |
+ heap->set_migration_failure(true); |
} |
if (PromoteObject<object_contents, alignment>(map, slot, object, |
@@ -5371,6 +5398,7 @@ |
set_native_contexts_list(undefined_value()); |
set_array_buffers_list(undefined_value()); |
set_last_array_buffer_in_list(undefined_value()); |
+ set_new_array_buffer_views_list(undefined_value()); |
set_allocation_sites_list(undefined_value()); |
return true; |
} |