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()); |