Bug 1575251 - Remove some unnecessary uses of shadow::Zone r=allstarschh

Differential Revision: https://phabricator.services.mozilla.com/D42667

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jon Coppeard 2019-08-20 18:52:58 +00:00
parent c0c526a32c
commit 057ec26442
4 changed files with 12 additions and 13 deletions

View File

@ -183,7 +183,7 @@ struct Zone {
return gcState_ == Sweep || gcState_ == Compact;
}
static MOZ_ALWAYS_INLINE JS::shadow::Zone* asShadowZone(JS::Zone* zone) {
static MOZ_ALWAYS_INLINE JS::shadow::Zone* from(JS::Zone* zone) {
return reinterpret_cast<JS::shadow::Zone*>(zone);
}
};
@ -579,7 +579,7 @@ static MOZ_ALWAYS_INLINE bool IsIncrementalBarrierNeededOnTenuredGCThing(
MOZ_ASSERT(!JS::RuntimeHeapIsCollecting());
JS::Zone* zone = JS::GetTenuredGCThingZone(thing);
return JS::shadow::Zone::asShadowZone(zone)->needsIncrementalBarrier();
return JS::shadow::Zone::from(zone)->needsIncrementalBarrier();
}
static MOZ_ALWAYS_INLINE void ExposeGCThingToActiveJS(JS::GCCellPtr thing) {
@ -617,8 +617,7 @@ static MOZ_ALWAYS_INLINE bool EdgeNeedsSweepUnbarriered(JSObject** objp) {
return false;
}
auto zone =
JS::shadow::Zone::asShadowZone(detail::GetGCThingZone(uintptr_t(*objp)));
auto zone = JS::shadow::Zone::from(detail::GetGCThingZone(uintptr_t(*objp)));
if (!zone->isGCSweepingOrCompacting()) {
return false;
}

View File

@ -181,10 +181,10 @@ class TenuredCell : public Cell {
inline bool isInsideZone(JS::Zone* zone) const;
MOZ_ALWAYS_INLINE JS::shadow::Zone* shadowZone() const {
return JS::shadow::Zone::asShadowZone(zone());
return JS::shadow::Zone::from(zone());
}
MOZ_ALWAYS_INLINE JS::shadow::Zone* shadowZoneFromAnyThread() const {
return JS::shadow::Zone::asShadowZone(zoneFromAnyThread());
return JS::shadow::Zone::from(zoneFromAnyThread());
}
template <class T>
@ -292,7 +292,7 @@ inline JS::TraceKind Cell::getTraceKind() const {
}
/* static */ MOZ_ALWAYS_INLINE bool Cell::needWriteBarrierPre(JS::Zone* zone) {
return JS::shadow::Zone::asShadowZone(zone)->needsIncrementalBarrier();
return JS::shadow::Zone::from(zone)->needsIncrementalBarrier();
}
/* static */ MOZ_ALWAYS_INLINE TenuredCell* TenuredCell::fromPointer(

View File

@ -269,13 +269,13 @@ class JSObject : public js::gc::Cell {
MOZ_ALWAYS_INLINE JS::Zone* zone() const { return group_->zone(); }
MOZ_ALWAYS_INLINE JS::shadow::Zone* shadowZone() const {
return JS::shadow::Zone::asShadowZone(zone());
return JS::shadow::Zone::from(zone());
}
MOZ_ALWAYS_INLINE JS::Zone* zoneFromAnyThread() const {
return group_->zoneFromAnyThread();
}
MOZ_ALWAYS_INLINE JS::shadow::Zone* shadowZoneFromAnyThread() const {
return JS::shadow::Zone::asShadowZone(zoneFromAnyThread());
return JS::shadow::Zone::from(zoneFromAnyThread());
}
static MOZ_ALWAYS_INLINE void readBarrier(JSObject* obj);
static MOZ_ALWAYS_INLINE void writeBarrierPre(JSObject* obj);

View File

@ -140,7 +140,7 @@ inline void NativeObject::copyDenseElements(uint32_t dstStart, const Value* src,
if (count == 0) {
return;
}
if (JS::shadow::Zone::asShadowZone(zone())->needsIncrementalBarrier()) {
if (zone()->needsIncrementalBarrier()) {
uint32_t numShifted = getElementsHeader()->numShiftedElements();
for (uint32_t i = 0; i < count; ++i) {
elements_[dstStart + i].set(this, HeapSlot::Element,
@ -233,7 +233,7 @@ inline void NativeObject::moveDenseElements(uint32_t dstStart,
* write barrier is invoked here on B, despite the fact that it exists in
* the array before and after the move.
*/
if (JS::shadow::Zone::asShadowZone(zone())->needsIncrementalBarrier()) {
if (zone()->needsIncrementalBarrier()) {
uint32_t numShifted = getElementsHeader()->numShiftedElements();
if (dstStart < srcStart) {
HeapSlot* dst = elements_ + dstStart;
@ -258,7 +258,7 @@ inline void NativeObject::moveDenseElements(uint32_t dstStart,
inline void NativeObject::moveDenseElementsNoPreBarrier(uint32_t dstStart,
uint32_t srcStart,
uint32_t count) {
MOZ_ASSERT(!shadowZone()->needsIncrementalBarrier());
MOZ_ASSERT(!zone()->needsIncrementalBarrier());
MOZ_ASSERT(dstStart + count <= getDenseCapacity());
MOZ_ASSERT(srcStart + count <= getDenseCapacity());
@ -270,7 +270,7 @@ inline void NativeObject::moveDenseElementsNoPreBarrier(uint32_t dstStart,
}
inline void NativeObject::reverseDenseElementsNoPreBarrier(uint32_t length) {
MOZ_ASSERT(!shadowZone()->needsIncrementalBarrier());
MOZ_ASSERT(!zone()->needsIncrementalBarrier());
MOZ_ASSERT(!denseElementsAreCopyOnWrite());
MOZ_ASSERT(isExtensible());