Make sure that INITPROP emits a write barrier if needed (bug 773588, r=billm).

This commit is contained in:
David Anderson 2012-07-17 13:37:43 -07:00
parent a1826885c6
commit f010fea8f5
2 changed files with 21 additions and 6 deletions

View File

@ -3635,8 +3635,20 @@ IonBuilder::jsop_initprop(HandlePropertyName name)
JSRESOLVE_QUALIFIED, &holder, &shape);
JS_ASSERT(res && shape && holder == baseObj);
bool needsBarrier = true;
TypeOracle::BinaryTypes b = oracle->binaryTypes(script, pc);
if (b.lhsTypes &&
((jsid)id == types::MakeTypeId(cx, id)) &&
!b.lhsTypes->propertyNeedsBarrier(cx, id))
{
needsBarrier = false;
}
if (baseObj->isFixedSlot(shape->slot())) {
MStoreFixedSlot *store = MStoreFixedSlot::New(obj, shape->slot(), value);
if (needsBarrier)
store->setNeedsBarrier();
current->add(store);
return resumeAfter(store);
}
@ -3645,6 +3657,9 @@ IonBuilder::jsop_initprop(HandlePropertyName name)
current->add(slots);
MStoreSlot *store = MStoreSlot::New(slots, baseObj->dynamicSlotIndex(shape->slot()), value);
if (needsBarrier)
store->setNeedsBarrier();
current->add(store);
return resumeAfter(store);
}
@ -4247,7 +4262,7 @@ IonBuilder::jsop_setgname(HandlePropertyName name)
// Determine whether write barrier is required.
if (!propertyTypes || propertyTypes->needsBarrier(cx))
store->setNeedsBarrier(true);
store->setNeedsBarrier();
// Pop the global object pushed by bindgname.
DebugOnly<MDefinition *> pushedGlobal = current->pop();
@ -4650,7 +4665,7 @@ IonBuilder::jsop_setelem_dense()
// Determine whether a write barrier is required.
if (oracle->elementWriteNeedsBarrier(script, pc))
store->setNeedsBarrier(true);
store->setNeedsBarrier();
if (elementType != MIRType_None && packed)
store->setElementType(elementType);

View File

@ -3472,8 +3472,8 @@ class MStoreElementCommon
bool needsBarrier() const {
return needsBarrier_;
}
void setNeedsBarrier(bool needsBarrier) {
needsBarrier_ = needsBarrier;
void setNeedsBarrier() {
needsBarrier_ = true;
}
};
@ -4256,8 +4256,8 @@ class MStoreSlot
bool needsBarrier() const {
return needsBarrier_;
}
void setNeedsBarrier(bool needsBarrier) {
needsBarrier_ = needsBarrier;
void setNeedsBarrier() {
needsBarrier_ = true;
}
AliasSet getAliasSet() const {
return AliasSet::Store(AliasSet::Slot);