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

Unified Diff: src/heap/heap.cc

Issue 1176263004: Introduce a base pointer field in FixedTypedArrayBase and teach GC about it (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/elements-kind.cc ('k') | src/heap/mark-compact.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 361b4d91d7ffbdbf128fb05f6dde00e27f84e0a7..ea6c06d68c64193b38b19bd4e46550a3b62915a2 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2421,6 +2421,12 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject* object) {
int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size();
EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size);
+
+ MapWord map_word = object->map_word();
+ DCHECK(map_word.IsForwardingAddress());
+ FixedTypedArrayBase* target =
+ reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
+ target->set_base_pointer(target, SKIP_WRITE_BARRIER);
}
@@ -2428,6 +2434,12 @@ class ScavengingVisitor : public StaticVisitorBase {
HeapObject* object) {
int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size();
EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size);
+
+ MapWord map_word = object->map_word();
+ DCHECK(map_word.IsForwardingAddress());
+ FixedTypedArrayBase* target =
+ reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
+ target->set_base_pointer(target, SKIP_WRITE_BARRIER);
}
@@ -3908,6 +3920,7 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
object->set_map(MapForFixedTypedArray(array_type));
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
+ elements->set_base_pointer(elements, SKIP_WRITE_BARRIER);
elements->set_length(length);
if (initialize) memset(elements->DataPtr(), 0, elements->DataSize());
return elements;
« no previous file with comments | « src/elements-kind.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698