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

Unified Diff: src/heap/heap.cc

Issue 880043003: Avoid issuing write barriers for unboxed double fields in Heap::CopyJSObject(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 11 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 | test/cctest/test-unboxed-doubles.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 cec871403a718d8f2a88b8666af713e48ba56f54..855c71ac0d4bff13eec10aa3dd976ee3b80568dc 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -3893,9 +3893,33 @@ AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
}
Address clone_address = clone->address();
CopyBlock(clone_address, source->address(), object_size);
- // Update write barrier for all fields that lie beyond the header.
- RecordWrites(clone_address, JSObject::kHeaderSize,
- (object_size - JSObject::kHeaderSize) / kPointerSize);
+
+ // Update write barrier for all tagged fields that lie beyond the header.
+ const int start_offset = JSObject::kHeaderSize;
+ const int end_offset = object_size;
+
+#if V8_DOUBLE_FIELDS_UNBOXING
+ LayoutDescriptorHelper helper(map);
+ bool has_only_tagged_fields = helper.all_fields_tagged();
+
+ if (!has_only_tagged_fields) {
+ for (int offset = start_offset; offset < end_offset;) {
+ int end_of_region_offset;
+ if (helper.IsTagged(offset, end_offset, &end_of_region_offset)) {
+ RecordWrites(clone_address, offset,
+ (end_of_region_offset - offset) / kPointerSize);
+ }
+ offset = end_of_region_offset;
+ }
+ } else {
+#endif
+ // Object has only tagged fields.
+ RecordWrites(clone_address, start_offset,
+ (end_offset - start_offset) / kPointerSize);
+#if V8_DOUBLE_FIELDS_UNBOXING
+ }
+#endif
+
} else {
wb_mode = SKIP_WRITE_BARRIER;
« no previous file with comments | « no previous file | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698