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

Unified Diff: src/heap/heap-inl.h

Issue 1834373003: [heap] Add optimized RecordWrites (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding helper macro Created 4 years, 9 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
Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index 7b2f5ead9b9a3ff53617f12212ebdfe253f99eac..87c0814faaaf7b82b2a9ef7f9e40141f9d0ac2dd 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -399,9 +399,20 @@ void Heap::RecordWrite(Object* object, int offset, Object* o) {
if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) {
return;
}
- Page* page = Page::FromAddress(reinterpret_cast<Address>(object));
- Address slot = HeapObject::cast(object)->address() + offset;
- RememberedSet<OLD_TO_NEW>::Insert(page, slot);
+ RememberedSet<OLD_TO_NEW>::Insert(
+ Page::FromAddress(reinterpret_cast<Address>(object)),
+ HeapObject::cast(object)->address() + offset);
+}
+
+void Heap::RecordWrites(FixedArray* array, int offset, int length) {
+ if (InNewSpace(array)) return;
+ for (int i = 0; i < length; i++) {
+ if (!InNewSpace((array->data_start() + offset)[i])) continue;
ulan 2016/04/01 11:28:32 why not simply array->get(offset + i)?
Camillo Bruni 2016/04/01 13:45:01 indeed...
+ RememberedSet<OLD_TO_NEW>::Insert(
+ Page::FromAddress(reinterpret_cast<Address>(array)),
ulan 2016/04/01 11:28:32 Let's save the page in local variable before the l
Camillo Bruni 2016/04/01 13:45:01 right... I remember that I measure some 10% differ
+ HeapObject::cast(array)->address() +
ulan 2016/04/01 11:28:32 Let's use array->RawFieldOfElementAt(i)
Camillo Bruni 2016/04/01 13:45:01 done
+ array->OffsetOfElementAt(offset + i));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698