Revision: 18243
Author: [email protected]
Date: Wed Dec 4 06:06:57 2013 UTC
Log: Skip write barrier if value and object originate from the same
allocation.
[email protected]
Review URL: https://codereview.chromium.org/101993002
http://code.google.com/p/v8/source/detail?r=18243
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.h
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Mon Dec 2 11:24:31
2013 UTC
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Dec 4 06:06:57
2013 UTC
@@ -5652,11 +5652,10 @@
inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
+ HValue* value,
HValue* new_space_dominator) {
- if (object->IsInnerAllocatedObject()) {
- return ReceiverObjectNeedsWriteBarrier(
- HInnerAllocatedObject::cast(object)->base_object(),
- new_space_dominator);
+ while (object->IsInnerAllocatedObject()) {
+ object = HInnerAllocatedObject::cast(object)->base_object();
}
if (object->IsConstant() && HConstant::cast(object)->IsCell()) {
return false;
@@ -5668,7 +5667,17 @@
}
if (object != new_space_dominator) return true;
if (object->IsAllocate()) {
- return !HAllocate::cast(object)->IsNewSpaceAllocation();
+ // Stores to new space allocations require no write barriers if the
object
+ // is the new space dominator.
+ if (HAllocate::cast(object)->IsNewSpaceAllocation()) {
+ 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()) {
+ value = HInnerAllocatedObject::cast(value)->base_object();
+ }
+ return object != value;
}
return true;
}
@@ -6589,12 +6598,14 @@
if (field_representation().IsInteger32()) return false;
if (field_representation().IsExternal()) return false;
return StoringValueNeedsWriteBarrier(value()) &&
- ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
+ ReceiverObjectNeedsWriteBarrier(object(), value(),
+ new_space_dominator());
}
bool NeedsWriteBarrierForMap() {
if (IsSkipWriteBarrier()) return false;
- return ReceiverObjectNeedsWriteBarrier(object(),
new_space_dominator());
+ return ReceiverObjectNeedsWriteBarrier(object(), transition(),
+ new_space_dominator());
}
Representation field_representation() const {
@@ -6756,7 +6767,8 @@
return false;
} else {
return StoringValueNeedsWriteBarrier(value()) &&
- ReceiverObjectNeedsWriteBarrier(elements(),
new_space_dominator());
+ ReceiverObjectNeedsWriteBarrier(elements(), value(),
+ new_space_dominator());
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.