зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1615145
- Combine JSScript and LazyScript GC arena. r=jonco
Combine AllocKind::SCRIPT and AllocKind::LAZY_SCRIPT arenas. This impacts code that scans the arenas directly but required checks were added in a previous patch. This removes background finalization of those LazyScript types. Depends on D62687 Differential Revision: https://phabricator.services.mozilla.com/D62688 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f062c87ca1
Коммит
9211d26984
|
@ -159,7 +159,7 @@ void DebugScript::destroyBreakpointSite(JSFreeOp* fop, JSScript* script,
|
|||
/* static */
|
||||
void DebugScript::clearBreakpointsIn(JSFreeOp* fop, Realm* realm, Debugger* dbg,
|
||||
JSObject* handler) {
|
||||
for (auto base = realm->zone()->cellIter<JSScript>(); !base.done();
|
||||
for (auto base = realm->zone()->cellIter<BaseScript>(); !base.done();
|
||||
base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
|
|
|
@ -3152,7 +3152,8 @@ static bool UpdateExecutionObservabilityOfScriptsInZone(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (auto base = zone->cellIter<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = zone->cellIter<BaseScript>(); !base.done();
|
||||
base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ namespace gc {
|
|||
|
||||
#define FOR_EACH_NONOBJECT_NONNURSERY_ALLOCKIND(D) \
|
||||
/* AllocKind TraceKind TypeName SizedType BGFinal Nursery Compact */ \
|
||||
D(SCRIPT, Script, JSScript, JSScript, false, false, true) \
|
||||
D(LAZY_SCRIPT, Script, js::LazyScript, js::LazyScript, true, false, true) \
|
||||
D(SCRIPT, Script, js::BaseScript, js::BaseScript, false, false, true) \
|
||||
D(SHAPE, Shape, js::Shape, js::Shape, true, false, true) \
|
||||
D(ACCESSOR_SHAPE, Shape, js::AccessorShape, js::AccessorShape, true, false, true) \
|
||||
D(BASE_SHAPE, BaseShape, js::BaseShape, js::BaseShape, true, false, true) \
|
||||
|
|
|
@ -367,7 +367,6 @@ static constexpr FinalizePhase ForegroundNonObjectFinalizePhase = {
|
|||
* Finalization order for GC things swept on the background thread.
|
||||
*/
|
||||
static constexpr FinalizePhase BackgroundFinalizePhases[] = {
|
||||
{gcstats::PhaseKind::SWEEP_SCRIPT, {AllocKind::LAZY_SCRIPT}},
|
||||
{gcstats::PhaseKind::SWEEP_OBJECT,
|
||||
{AllocKind::FUNCTION, AllocKind::FUNCTION_EXTENDED,
|
||||
AllocKind::OBJECT0_BACKGROUND, AllocKind::OBJECT2_BACKGROUND,
|
||||
|
@ -2107,7 +2106,7 @@ void GCRuntime::sweepTypesAfterCompacting(Zone* zone) {
|
|||
|
||||
AutoClearTypeInferenceStateOnOOM oom(zone);
|
||||
|
||||
for (auto base = zone->cellIterUnsafe<JSScript>(); !base.done();
|
||||
for (auto base = zone->cellIterUnsafe<BaseScript>(); !base.done();
|
||||
base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
|
@ -2437,8 +2436,7 @@ static constexpr AllocKinds UpdatePhaseOne{
|
|||
|
||||
// UpdatePhaseTwo is typed object descriptor objects.
|
||||
|
||||
static constexpr AllocKinds UpdatePhaseThree{AllocKind::LAZY_SCRIPT,
|
||||
AllocKind::SCOPE,
|
||||
static constexpr AllocKinds UpdatePhaseThree{AllocKind::SCOPE,
|
||||
AllocKind::FUNCTION,
|
||||
AllocKind::FUNCTION_EXTENDED,
|
||||
AllocKind::OBJECT0,
|
||||
|
@ -4919,7 +4917,7 @@ static void SweepCompressionTasks(GCParallelTask* task) {
|
|||
void js::gc::SweepLazyScripts(GCParallelTask* task) {
|
||||
for (SweepGroupZonesIter zone(task->gc); !zone.done(); zone.next()) {
|
||||
AutoSetThreadIsSweeping threadIsSweeping(zone);
|
||||
for (auto iter = zone->cellIter<LazyScript>(); !iter.done(); iter.next()) {
|
||||
for (auto iter = zone->cellIter<BaseScript>(); !iter.done(); iter.next()) {
|
||||
BaseScript* base = iter.unbarrieredGet();
|
||||
if (!base->isLazyScript()) {
|
||||
continue;
|
||||
|
@ -5455,7 +5453,7 @@ static void SweepThing(JSFreeOp* fop, Shape* shape) {
|
|||
}
|
||||
}
|
||||
|
||||
static void SweepThing(JSFreeOp* fop, JSScript* script) {
|
||||
static void SweepThing(JSFreeOp* fop, BaseScript* script) {
|
||||
AutoSweepJitScript sweep(script);
|
||||
}
|
||||
|
||||
|
@ -5499,8 +5497,8 @@ IncrementalProgress GCRuntime::sweepTypeInformation(JSFreeOp* fop,
|
|||
|
||||
AutoClearTypeInferenceStateOnOOM oom(sweepZone);
|
||||
|
||||
if (!SweepArenaList<JSScript>(fop, &al.gcScriptArenasToUpdate.ref(),
|
||||
budget)) {
|
||||
if (!SweepArenaList<BaseScript>(fop, &al.gcScriptArenasToUpdate.ref(),
|
||||
budget)) {
|
||||
return NotFinished;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ class JSTracer;
|
|||
|
||||
namespace js {
|
||||
|
||||
class LazyScript;
|
||||
class AccessorShape;
|
||||
class FatInlineAtom;
|
||||
class NormalAtom;
|
||||
|
|
|
@ -743,7 +743,7 @@ struct ImplicitEdgeHolderType {
|
|||
typedef HasNoImplicitEdgesType Type;
|
||||
};
|
||||
|
||||
// For now, we only handle JSObject* and JSScript* keys, but the linear time
|
||||
// For now, we only handle JSObject* and BaseScript* keys, but the linear time
|
||||
// algorithm can be easily extended by adding in more types here, then making
|
||||
// GCMarker::traverse<T> call markImplicitEdges.
|
||||
template <>
|
||||
|
|
|
@ -149,7 +149,8 @@ static void IterateScriptsImpl(JSContext* cx, Realm* realm, void* data,
|
|||
|
||||
if (realm) {
|
||||
Zone* zone = realm->zone();
|
||||
for (auto iter = zone->cellIter<T>(prep); !iter.done(); iter.next()) {
|
||||
for (auto iter = zone->cellIter<BaseScript>(prep); !iter.done();
|
||||
iter.next()) {
|
||||
if (mozilla::IsSame<T, LazyScript>::value != iter->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -161,7 +162,8 @@ static void IterateScriptsImpl(JSContext* cx, Realm* realm, void* data,
|
|||
}
|
||||
} else {
|
||||
for (ZonesIter zone(cx->runtime(), SkipAtoms); !zone.done(); zone.next()) {
|
||||
for (auto iter = zone->cellIter<T>(prep); !iter.done(); iter.next()) {
|
||||
for (auto iter = zone->cellIter<BaseScript>(prep); !iter.done();
|
||||
iter.next()) {
|
||||
if (mozilla::IsSame<T, LazyScript>::value != iter->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ JS_PUBLIC_API void JS_GetTraceThingInfo(char* buf, size_t bufsize,
|
|||
}
|
||||
|
||||
case JS::TraceKind::Script: {
|
||||
JSScript* script = static_cast<JSScript*>(thing);
|
||||
js::BaseScript* script = static_cast<js::BaseScript*>(thing);
|
||||
snprintf(buf, bufsize, " %s:%u", script->filename(), script->lineno());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ void Zone::discardJitCode(JSFreeOp* fop,
|
|||
if (discardBaselineCode || discardJitScripts) {
|
||||
#ifdef DEBUG
|
||||
// Assert no JitScripts are marked as active.
|
||||
for (auto iter = cellIter<JSScript>(); !iter.done(); iter.next()) {
|
||||
for (auto iter = cellIter<BaseScript>(); !iter.done(); iter.next()) {
|
||||
BaseScript* base = iter.unbarrieredGet();
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
|
@ -412,7 +412,7 @@ void Zone::discardJitCode(JSFreeOp* fop,
|
|||
// Invalidate all Ion code in this zone.
|
||||
jit::InvalidateAll(fop, this);
|
||||
|
||||
for (auto base = cellIterUnsafe<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = cellIterUnsafe<BaseScript>(); !base.done(); base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -975,7 +975,7 @@ void jit::ToggleBaselineProfiling(JSContext* cx, bool enable) {
|
|||
jrt->baselineInterpreter().toggleProfilerInstrumentation(enable);
|
||||
|
||||
for (ZonesIter zone(cx->runtime(), SkipAtoms); !zone.done(); zone.next()) {
|
||||
for (auto base = zone->cellIter<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = zone->cellIter<BaseScript>(); !base.done(); base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -997,7 +997,7 @@ void jit::ToggleBaselineProfiling(JSContext* cx, bool enable) {
|
|||
#ifdef JS_TRACE_LOGGING
|
||||
void jit::ToggleBaselineTraceLoggerScripts(JSRuntime* runtime, bool enable) {
|
||||
for (ZonesIter zone(runtime, SkipAtoms); !zone.done(); zone.next()) {
|
||||
for (auto base = zone->cellIter<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = zone->cellIter<BaseScript>(); !base.done(); base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1012,7 +1012,7 @@ void jit::ToggleBaselineTraceLoggerScripts(JSRuntime* runtime, bool enable) {
|
|||
|
||||
void jit::ToggleBaselineTraceLoggerEngine(JSRuntime* runtime, bool enable) {
|
||||
for (ZonesIter zone(runtime, SkipAtoms); !zone.done(); zone.next()) {
|
||||
for (auto base = zone->cellIter<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = zone->cellIter<BaseScript>(); !base.done(); base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ static MOZ_MUST_USE bool DumpPCCounts(JSContext* cx, HandleScript script,
|
|||
|
||||
bool js::DumpRealmPCCounts(JSContext* cx) {
|
||||
Rooted<GCVector<JSScript*>> scripts(cx, GCVector<JSScript*>(cx));
|
||||
for (auto base = cx->zone()->cellIter<JSScript>(); !base.done();
|
||||
for (auto base = cx->zone()->cellIter<BaseScript>(); !base.done();
|
||||
base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
|
@ -2590,7 +2590,7 @@ JS_FRIEND_API void js::StopPCCountProfiling(JSContext* cx) {
|
|||
}
|
||||
|
||||
for (ZonesIter zone(rt, SkipAtoms); !zone.done(); zone.next()) {
|
||||
for (auto base = zone->cellIter<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = zone->cellIter<BaseScript>(); !base.done(); base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4306,7 +4306,7 @@ JSScript* JSScript::New(JSContext* cx, HandleObject functionOrGlobal,
|
|||
uint32_t sourceStart, uint32_t sourceEnd,
|
||||
uint32_t toStringStart, uint32_t toStringEnd,
|
||||
uint32_t lineno, uint32_t column) {
|
||||
void* script = Allocate<JSScript>(cx);
|
||||
void* script = Allocate<BaseScript>(cx);
|
||||
if (!script) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -5506,7 +5506,7 @@ LazyScript* LazyScript::CreateRaw(JSContext* cx, uint32_t ngcthings,
|
|||
uint32_t lineno, uint32_t column) {
|
||||
cx->check(fun);
|
||||
|
||||
void* res = Allocate<LazyScript>(cx);
|
||||
void* res = Allocate<BaseScript>(cx);
|
||||
if (!res) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -2682,7 +2682,7 @@ static bool VerifyGlobalNames(JSContext* cx, Handle<GlobalObject*> shg) {
|
|||
RootedId id(cx);
|
||||
bool nameMissing = false;
|
||||
|
||||
for (auto base = cx->zone()->cellIter<JSScript>();
|
||||
for (auto base = cx->zone()->cellIter<BaseScript>();
|
||||
!base.done() && !nameMissing; base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
|
|
|
@ -1437,7 +1437,7 @@ inline AutoSweepObjectGroup::~AutoSweepObjectGroup() {
|
|||
}
|
||||
#endif
|
||||
|
||||
inline AutoSweepJitScript::AutoSweepJitScript(JSScript* script)
|
||||
inline AutoSweepJitScript::AutoSweepJitScript(BaseScript* script)
|
||||
#ifdef DEBUG
|
||||
: zone_(script->zone()),
|
||||
jitScript_(script->maybeJitScript())
|
||||
|
|
|
@ -2689,7 +2689,7 @@ void js::PrintTypes(JSContext* cx, Compartment* comp, bool force) {
|
|||
}
|
||||
|
||||
RootedScript script(cx);
|
||||
for (auto base = zone->cellIter<JSScript>(); !base.done(); base.next()) {
|
||||
for (auto base = zone->cellIter<BaseScript>(); !base.done(); base.next()) {
|
||||
if (base->isLazyScript()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class MOZ_RAII AutoSweepJitScript : public AutoSweepBase {
|
|||
#endif
|
||||
|
||||
public:
|
||||
inline explicit AutoSweepJitScript(JSScript* script);
|
||||
inline explicit AutoSweepJitScript(BaseScript* script);
|
||||
#ifdef DEBUG
|
||||
inline ~AutoSweepJitScript();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче