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

Unified Diff: src/mark-compact.cc

Issue 15562008: Recording array buffer views. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/mark-compact.h ('k') | src/objects.h » ('j') | src/objects-visiting-inl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 29d86161819a5ec8aad048c52ebcd7fc3a5fcf4a..27a867b5716682814c1ebe0f3b21f76a7456f953 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -72,7 +72,8 @@ MarkCompactCollector::MarkCompactCollector() : // NOLINT
migration_slots_buffer_(NULL),
heap_(NULL),
code_flusher_(NULL),
- encountered_weak_maps_(NULL) { }
+ encountered_weak_maps_(Smi::FromInt(0)),
+ encountered_array_buffers_(Smi::FromInt(0)) { }
#ifdef VERIFY_HEAP
@@ -393,6 +394,7 @@ void MarkCompactCollector::CollectGarbage() {
// update the state as they proceed.
ASSERT(state_ == PREPARE_GC);
ASSERT(encountered_weak_maps_ == Smi::FromInt(0));
+ ASSERT(encountered_array_buffers_ == Smi::FromInt(0));
MarkLiveObjects();
ASSERT(heap_->incremental_marking()->IsStopped());
@@ -2285,6 +2287,9 @@ void MarkCompactCollector::AfterMarking() {
MarkCompactWeakObjectRetainer mark_compact_object_retainer;
heap()->ProcessWeakReferences(&mark_compact_object_retainer);
+ // Update references from array buffers to typed arrays.
+ ProcessArrayBuffers();
+
// Remove object groups after marking phase.
heap()->isolate()->global_handles()->RemoveObjectGroups();
heap()->isolate()->global_handles()->RemoveImplicitRefGroups();
@@ -2571,6 +2576,44 @@ void MarkCompactCollector::ClearWeakMaps() {
}
+void MarkCompactCollector::ProcessArrayBuffers() {
+ Object* array_buffer_obj = encountered_array_buffers();
+ set_encountered_array_buffers(Smi::FromInt(0));
+ while (array_buffer_obj != Smi::FromInt(0)) {
+ ASSERT(IsMarked(HeapObject::cast(array_buffer_obj)));
+ JSArrayBuffer* array_buffer =
+ reinterpret_cast<JSArrayBuffer*>(array_buffer_obj);
+ Object** slot = HeapObject::RawField(array_buffer, JSArrayBuffer::kFirstArrayOffset);
+ while (*slot != Smi::FromInt(0)) {
+ Object* next_obj = *slot;
+ while (next_obj != Smi::FromInt(0) && !IsMarked(next_obj)) {
+ next_obj = JSTypedArray::cast(next_obj)->next();
+ }
+ if (next_obj == Smi::FromInt(0)) {
+ *slot = Smi::FromInt(0);
+ break;
+ }
+ JSTypedArray* next_typed_array = JSTypedArray::cast(next_obj);
+ *slot = next_obj;
+ RecordSlot(slot, slot, next_typed_array);
+ slot = HeapObject::RawField(next_typed_array, JSTypedArray::kNextOffset);
+ }
+
+ array_buffer_obj = array_buffer->next();
+ array_buffer->set_next(Smi::FromInt(0));
+ }
+}
+
+
+void MarkCompactCollector::ClearArrayBuffersOnAbort() {
+ Object* array_buffer_obj = encountered_array_buffers();
+ set_encountered_array_buffers(Smi::FromInt(0));
+ while (array_buffer_obj != Smi::FromInt(0)) {
+ JSArrayBuffer* array_buffer = JSArrayBuffer::cast(array_buffer_obj);
+ array_buffer_obj = array_buffer->next();
+ array_buffer->set_next(Smi::FromInt(0));
+ }
+}
// We scavange new space simultaneously with sweeping. This is done in two
// passes.
//
« no previous file with comments | « src/mark-compact.h ('k') | src/objects.h » ('j') | src/objects-visiting-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698