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

Unified Diff: src/heap/mark-compact.cc

Issue 1327403002: [objects] do not visit ArrayBuffer's backing store (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: visit all fields in array buffer, reorder fields for simplicity Created 5 years, 3 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 | « no previous file | 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/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index ce8a13683e27b5b4599dffd167cd700f396ba57a..e4a5b46ee1f8e2d2d8de5d1ec543d0c4571ffee8 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2685,6 +2685,28 @@ void MarkCompactCollector::MigrateObjectMixed(HeapObject* dst, HeapObject* src,
dst->address() + BytecodeArray::kConstantPoolOffset;
RecordMigratedSlot(Memory::Object_at(constant_pool_slot),
constant_pool_slot);
+ } else if (src->IsJSArrayBuffer()) {
+ heap()->MoveBlock(dst->address(), src->address(), size);
+
+ // Visit inherited JSObject properties and byte length of ArrayBuffer
+ Address regular_slot =
+ dst->address() + JSArrayBuffer::BodyDescriptor::kStartOffset;
+ Address regular_slots_end =
+ dst->address() + JSArrayBuffer::kByteLengthOffset + kPointerSize;
+ while (regular_slot < regular_slots_end) {
+ RecordMigratedSlot(Memory::Object_at(regular_slot), regular_slot);
+ regular_slot += kPointerSize;
+ }
+
+ // Skip backing store and visit just internal fields
+ Address internal_field_slot = dst->address() + JSArrayBuffer::kSize;
+ Address internal_fields_end =
+ dst->address() + JSArrayBuffer::kSizeWithInternalFields;
+ while (internal_field_slot < internal_fields_end) {
+ RecordMigratedSlot(Memory::Object_at(internal_field_slot),
+ internal_field_slot);
+ internal_field_slot += kPointerSize;
+ }
} else if (FLAG_unbox_double_fields) {
Address dst_addr = dst->address();
Address src_addr = src->address();
@@ -3111,6 +3133,12 @@ bool MarkCompactCollector::IsSlotInLiveObject(Address slot) {
} else if (object->IsBytecodeArray()) {
return static_cast<int>(slot - object->address()) ==
BytecodeArray::kConstantPoolOffset;
+ } else if (object->IsJSArrayBuffer()) {
+ int off = static_cast<int>(slot - object->address());
+ return (off >= JSArrayBuffer::BodyDescriptor::kStartOffset &&
+ off <= JSArrayBuffer::kByteLengthOffset) ||
+ (off >= JSArrayBuffer::kSize &&
+ off < JSArrayBuffer::kSizeWithInternalFields);
} else if (FLAG_unbox_double_fields) {
// Filter out slots that happen to point to unboxed double fields.
LayoutDescriptorHelper helper(object->map());
« no previous file with comments | « no previous file | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698