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

Unified Diff: src/heap/heap.cc

Issue 1053203007: Revert of Reland "Remove the weak list of views from array buffers" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 985d1f678862d87aa0c283aade75e79b3c8b0936..63cdae87b751aa5bcc9d551406c34277fa04bdc2 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);
}
@@ -1678,6 +1687,7 @@
void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) {
ProcessArrayBuffers(retainer, false);
+ ProcessNewArrayBufferViews(retainer);
ProcessNativeContexts(retainer);
ProcessAllocationSites(retainer);
}
@@ -1685,6 +1695,7 @@
void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) {
ProcessArrayBuffers(retainer, true);
+ ProcessNewArrayBufferViews(retainer);
ProcessNativeContexts(retainer);
}
@@ -1711,6 +1722,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);
@@ -1718,6 +1730,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);
}
@@ -2152,6 +2178,7 @@
if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) {
return;
}
+ heap->set_migration_failure(true);
}
if (PromoteObject<object_contents, alignment>(map, slot, object,
@@ -5376,6 +5403,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;
}
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698