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

Unified Diff: src/compiler/change-lowering.cc

Issue 1534443002: [turbofan] Always use the map write barrier when storing to the map field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/change-lowering.cc
diff --git a/src/compiler/change-lowering.cc b/src/compiler/change-lowering.cc
index a96d4d6f53ece1ee4daa43ba757042c6cc8aed12..f791db1fdc85c277b1bf93b64fa22a0024ce4a7d 100644
--- a/src/compiler/change-lowering.cc
+++ b/src/compiler/change-lowering.cc
@@ -465,6 +465,19 @@ WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
return kNoWriteBarrier;
}
+
+WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
+ MachineRepresentation representation,
+ int field_offset, Type* field_type,
+ Type* input_type) {
+ if (base_is_tagged == kTaggedBase && field_offset == HeapObject::kMapOffset) {
+ // Write barriers for storing maps are cheaper.
+ return kMapWriteBarrier;
+ }
+ return ComputeWriteBarrierKind(base_is_tagged, representation, field_type,
+ input_type);
+}
+
} // namespace
@@ -481,8 +494,8 @@ Reduction ChangeLowering::StoreField(Node* node) {
const FieldAccess& access = FieldAccessOf(node->op());
Type* type = NodeProperties::GetType(node->InputAt(1));
WriteBarrierKind kind = ComputeWriteBarrierKind(
- access.base_is_tagged, access.machine_type.representation(), access.type,
- type);
+ access.base_is_tagged, access.machine_type.representation(),
+ access.offset, access.type, type);
Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
node->InsertInput(graph()->zone(), 1, offset);
NodeProperties::ChangeOp(node,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698