Eliminate further write barriers for old space allocations.
authorbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 9 May 2014 12:06:48 +0000 (12:06 +0000)
committerbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 9 May 2014 12:06:48 +0000 (12:06 +0000)
Storing a map or an immortal immovable object to old space
allocations requires no write barriers if the object is the
new space dominator.

R=hpayer@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/271103002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21216 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-instructions.h

index 85d1e75..b6620a0 100644 (file)
@@ -3545,6 +3545,10 @@ class HConstant V8_FINAL : public HTemplateInstruction<0> {
     return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE;
   }
 
+  bool IsMap() const {
+    return instance_type_ == MAP_TYPE;
+  }
+
   virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
     return Representation::None();
   }
@@ -5708,6 +5712,13 @@ inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
     if (HAllocate::cast(object)->IsNewSpaceAllocation()) {
       return false;
     }
+    // Storing a map or an immortal immovable object requires no write barriers
+    // if the object is the new space dominator.
+    if (value->IsConstant() &&
+        (HConstant::cast(value)->IsMap() ||
+         HConstant::cast(value)->ImmortalImmovable())) {
+      return false;
+    }
     // Likewise we don't need a write barrier if we store a value that
     // originates from the same allocation (via allocation folding).
     while (value->IsInnerAllocatedObject()) {