Bug 1159402 - Remove the zone-specialized Value barriers; r=sfink

--HG--
extra : rebase_source : f9d2f2f797f8826ef946409e788b166bb8969a8e
This commit is contained in:
Terrence Cole 2015-04-30 11:29:21 -07:00
parent 17cb2cc298
commit 38655a0b62
4 changed files with 8 additions and 38 deletions

View File

@ -35,15 +35,6 @@ HeapSlot::preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot)
: &owner->getDenseElement(slot) == (const Value*)this;
}
bool
HeapSlot::preconditionForSet(Zone* zone, NativeObject* owner, Kind kind, uint32_t slot)
{
bool ok = kind == Slot
? &owner->getSlotRef(slot) == this
: &owner->getDenseElement(slot) == (const Value*)this;
return ok && owner->zone() == zone;
}
bool
HeapSlot::preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t slot, Value target) const
{

View File

@ -334,13 +334,6 @@ struct InternalGCMethods<Value>
preBarrierImpl(ZoneOfValueFromAnyThread(v), v);
}
static void preBarrier(Zone* zone, Value v) {
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
if (v.isString() && StringIsPermanentAtom(v.toString()))
return;
preBarrierImpl(zone, v);
}
private:
static void preBarrierImpl(Zone* zone, Value v) {
JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone);
@ -459,7 +452,6 @@ class BarrieredBase : public BarrieredBaseMixins<T>
protected:
void pre() { InternalGCMethods<T>::preBarrier(value); }
void pre(Zone* zone) { InternalGCMethods<T>::preBarrier(zone, value); }
};
template <>
@ -883,7 +875,6 @@ class HeapSlot : public BarrieredBase<Value>
#ifdef DEBUG
bool preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot);
bool preconditionForSet(Zone* zone, NativeObject* owner, Kind kind, uint32_t slot);
bool preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t slot, Value target) const;
#endif
@ -894,13 +885,6 @@ class HeapSlot : public BarrieredBase<Value>
post(owner, kind, slot, v);
}
void set(Zone* zone, NativeObject* owner, Kind kind, uint32_t slot, const Value& v) {
MOZ_ASSERT(preconditionForSet(zone, owner, kind, slot));
pre(zone);
value = v;
post(owner, kind, slot, v);
}
/* For users who need to manually barrier the raw types. */
static void writeBarrierPost(NativeObject* owner, Kind kind, uint32_t slot, const Value& target) {
reinterpret_cast<HeapSlot*>(const_cast<Value*>(&target))->post(owner, kind, slot, target);

View File

@ -193,16 +193,15 @@ js::NativeObject::initSlotRange(uint32_t start, const Value* vector, uint32_t le
void
js::NativeObject::copySlotRange(uint32_t start, const Value* vector, uint32_t length)
{
JS::Zone* zone = this->zone();
HeapSlot* fixedStart;
HeapSlot* fixedEnd;
HeapSlot* slotsStart;
HeapSlot* slotsEnd;
getSlotRange(start, length, &fixedStart, &fixedEnd, &slotsStart, &slotsEnd);
for (HeapSlot* sp = fixedStart; sp < fixedEnd; sp++)
sp->set(zone, this, HeapSlot::Slot, start++, *vector++);
sp->set(this, HeapSlot::Slot, start++, *vector++);
for (HeapSlot* sp = slotsStart; sp < slotsEnd; sp++)
sp->set(zone, this, HeapSlot::Slot, start++, *vector++);
sp->set(this, HeapSlot::Slot, start++, *vector++);
}
#ifdef DEBUG

View File

@ -968,14 +968,12 @@ class NativeObject : public JSObject
void copyDenseElements(uint32_t dstStart, const Value* src, uint32_t count) {
MOZ_ASSERT(dstStart + count <= getDenseCapacity());
MOZ_ASSERT(!denseElementsAreCopyOnWrite());
JSRuntime* rt = runtimeFromMainThread();
if (JS::IsIncrementalBarrierNeeded(rt)) {
Zone* zone = this->zone();
if (JS::shadow::Zone::asShadowZone(zone())->needsIncrementalBarrier()) {
for (uint32_t i = 0; i < count; ++i)
elements_[dstStart + i].set(zone, this, HeapSlot::Element, dstStart + i, src[i]);
elements_[dstStart + i].set(this, HeapSlot::Element, dstStart + i, src[i]);
} else {
memcpy(&elements_[dstStart], src, count * sizeof(HeapSlot));
DenseRangeWriteBarrierPost(rt, this, dstStart, count);
DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
}
}
@ -1005,19 +1003,17 @@ class NativeObject : public JSObject
* write barrier is invoked here on B, despite the fact that it exists in
* the array before and after the move.
*/
Zone* zone = this->zone();
JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone);
if (shadowZone->needsIncrementalBarrier()) {
if (JS::shadow::Zone::asShadowZone(zone())->needsIncrementalBarrier()) {
if (dstStart < srcStart) {
HeapSlot* dst = elements_ + dstStart;
HeapSlot* src = elements_ + srcStart;
for (uint32_t i = 0; i < count; i++, dst++, src++)
dst->set(zone, this, HeapSlot::Element, dst - elements_, *src);
dst->set(this, HeapSlot::Element, dst - elements_, *src);
} else {
HeapSlot* dst = elements_ + dstStart + count - 1;
HeapSlot* src = elements_ + srcStart + count - 1;
for (uint32_t i = 0; i < count; i++, dst--, src--)
dst->set(zone, this, HeapSlot::Element, dst - elements_, *src);
dst->set(this, HeapSlot::Element, dst - elements_, *src);
}
} else {
memmove(elements_ + dstStart, elements_ + srcStart, count * sizeof(HeapSlot));