author | Terrence Cole <terrence@mozilla.com> |
Thu, 30 Apr 2015 11:29:21 -0700 | |
changeset 241891 | 67cb17031e9f79452f37a4161cd8ee5f5d39b0bc |
parent 241890 | 0d5bddff56b41a9ca7be583101a1b5ea8ca149fb |
child 241892 | 0cca6dda74672cc6203a2b6844ebbc1de34de060 |
push id | 28672 |
push user | ryanvm@gmail.com |
push date | Fri, 01 May 2015 16:57:20 +0000 |
treeherder | mozilla-central@e70555ac58d8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sfink |
bugs | 1159402 |
milestone | 40.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/gc/Barrier.cpp +++ b/js/src/gc/Barrier.cpp @@ -31,25 +31,16 @@ bool HeapSlot::preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot) { return kind == Slot ? &owner->getSlotRef(slot) == this : &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 { return kind == Slot ? obj->getSlotAddressUnchecked(slot)->get() == target : static_cast<HeapSlot*>(obj->getDenseElements() + slot)->get() == target; } bool
--- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -329,23 +329,16 @@ struct InternalGCMethods<Value> static void preBarrier(Value v) { MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (v.isString() && StringIsPermanentAtom(v.toString())) return; if (v.isMarkable() && shadowRuntimeFromAnyThread(v)->needsIncrementalBarrier()) 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); if (shadowZone->needsIncrementalBarrier()) { MOZ_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsIncrementalBarrier()); Value tmp(v); js::gc::MarkValueForBarrier(shadowZone->barrierTracer(), &tmp, "write barrier"); MOZ_ASSERT(tmp == v); @@ -454,17 +447,16 @@ class BarrieredBase : public BarrieredBa void unsafeSet(T v) { value = v; } /* For users who need to manually barrier the raw types. */ static void writeBarrierPre(const T& v) { InternalGCMethods<T>::preBarrier(v); } static void writeBarrierPost(const T& v, T* vp) { InternalGCMethods<T>::postBarrier(vp); } protected: void pre() { InternalGCMethods<T>::preBarrier(value); } - void pre(Zone* zone) { InternalGCMethods<T>::preBarrier(zone, value); } }; template <> class BarrieredBaseMixins<JS::Value> : public ValueOperations<BarrieredBase<JS::Value> > { friend class ValueOperations<BarrieredBase<JS::Value> >; const JS::Value * extract() const { return static_cast<const BarrieredBase<JS::Value>*>(this)->unsafeGet(); @@ -878,34 +870,26 @@ class HeapSlot : public BarrieredBase<Va void init(NativeObject* owner, Kind kind, uint32_t slot, const Value& v) { value = v; post(owner, kind, slot, v); } #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 void set(NativeObject* owner, Kind kind, uint32_t slot, const Value& v) { MOZ_ASSERT(preconditionForSet(owner, kind, slot)); pre(); value = v; 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); } private: void post(NativeObject* owner, Kind kind, uint32_t slot, const Value& target) { MOZ_ASSERT(preconditionForWriteBarrierPost(owner, kind, slot, target));
--- a/js/src/vm/NativeObject.cpp +++ b/js/src/vm/NativeObject.cpp @@ -188,26 +188,25 @@ js::NativeObject::initSlotRange(uint32_t sp->init(this, HeapSlot::Slot, start++, *vector++); for (HeapSlot* sp = slotsStart; sp < slotsEnd; sp++) sp->init(this, HeapSlot::Slot, start++, *vector++); } 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 bool js::NativeObject::slotInRange(uint32_t slot, SentinelAllowed sentinel) const { uint32_t capacity = numFixedSlots() + numDynamicSlots(); if (sentinel == SENTINEL_ALLOWED)
--- a/js/src/vm/NativeObject.h +++ b/js/src/vm/NativeObject.h @@ -963,24 +963,22 @@ class NativeObject : public JSObject static inline void removeDenseElementForSparseIndex(ExclusiveContext* cx, HandleNativeObject obj, uint32_t index); inline Value getDenseOrTypedArrayElement(uint32_t idx); 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); } } void initDenseElements(uint32_t dstStart, const Value* src, uint32_t count) { MOZ_ASSERT(dstStart + count <= getDenseCapacity()); MOZ_ASSERT(!denseElementsAreCopyOnWrite()); memcpy(&elements_[dstStart], src, count * sizeof(HeapSlot)); DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count); @@ -1000,29 +998,27 @@ class NativeObject : public JSObject * 1. Incremental GC marks slot 0 of array (i.e., A), then returns to JS code. * 2. JS code moves slots 1..2 into slots 0..1, so it contains [B, C, C]. * 3. Incremental GC finishes by marking slots 1 and 2 (i.e., C). * * Since normal marking never happens on B, it is very important that the * 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)); DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count); } } void moveDenseElementsNoPreBarrier(uint32_t dstStart, uint32_t srcStart, uint32_t count) {