Bug 1571446 part 2 - Use accessors instead of accessing jitScript_ directly in various JSScript methods. r=tcampbell

This makes it easier to change the jitScript_ field in later patches.

Depends on D42288

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-08-16 12:41:34 +00:00
Родитель d42ec6a97b
Коммит dd846f7248
4 изменённых файлов: 32 добавлений и 31 удалений

Просмотреть файл

@ -66,7 +66,7 @@ JitScript::JitScript(JSScript* script, uint32_t typeSetOffset,
}
bool JSScript::createJitScript(JSContext* cx) {
MOZ_ASSERT(!jitScript_);
MOZ_ASSERT(!hasJitScript());
cx->check(this);
// Scripts with a JitScript can run in the Baseline Interpreter. Make sure
@ -83,7 +83,7 @@ bool JSScript::createJitScript(JSContext* cx) {
}
// If ensureHasAnalyzedArgsUsage allocated the JitScript we're done.
if (jitScript_) {
if (hasJitScript()) {
return true;
}
@ -140,7 +140,7 @@ bool JSScript::createJitScript(JSContext* cx) {
return false;
}
MOZ_ASSERT(!jitScript_);
MOZ_ASSERT(!hasJitScript());
prepareForDestruction.release();
jitScript_ = jitScript.release();
AddCellMemory(this, allocSize.value(), MemoryUse::JitScript);
@ -151,19 +151,19 @@ bool JSScript::createJitScript(JSContext* cx) {
#ifdef DEBUG
AutoSweepJitScript sweep(this);
StackTypeSet* typeArray = jitScript_->typeArrayDontCheckGeneration();
StackTypeSet* typeArray = this->jitScript()->typeArrayDontCheckGeneration();
for (unsigned i = 0; i < numBytecodeTypeSets(); i++) {
InferSpew(ISpewOps, "typeSet: %sT%p%s bytecode%u %p",
InferSpewColor(&typeArray[i]), &typeArray[i],
InferSpewColorReset(), i, this);
}
StackTypeSet* thisTypes = jitScript_->thisTypes(sweep, this);
StackTypeSet* thisTypes = this->jitScript()->thisTypes(sweep, this);
InferSpew(ISpewOps, "typeSet: %sT%p%s this %p", InferSpewColor(thisTypes),
thisTypes, InferSpewColorReset(), this);
unsigned nargs =
functionNonDelazifying() ? functionNonDelazifying()->nargs() : 0;
for (unsigned i = 0; i < nargs; i++) {
StackTypeSet* types = jitScript_->argTypes(sweep, this, i);
StackTypeSet* types = this->jitScript()->argTypes(sweep, this, i);
InferSpew(ISpewOps, "typeSet: %sT%p%s arg%u %p", InferSpewColor(types),
types, InferSpewColorReset(), i, this);
}
@ -175,8 +175,8 @@ bool JSScript::createJitScript(JSContext* cx) {
void JSScript::maybeReleaseJitScript(JSFreeOp* fop) {
MOZ_ASSERT(hasJitScript());
if (zone()->types.keepJitScripts || jitScript_->hasBaselineScript() ||
jitScript_->active()) {
if (zone()->types.keepJitScripts || jitScript()->hasBaselineScript() ||
jitScript()->active()) {
return;
}
@ -188,9 +188,9 @@ void JSScript::releaseJitScript(JSFreeOp* fop) {
MOZ_ASSERT(!hasBaselineScript());
MOZ_ASSERT(!hasIonScript());
fop->removeCellMemory(this, jitScript_->allocBytes(), MemoryUse::JitScript);
fop->removeCellMemory(this, jitScript()->allocBytes(), MemoryUse::JitScript);
JitScript::Destroy(zone(), jitScript_);
JitScript::Destroy(zone(), jitScript());
jitScript_ = nullptr;
updateJitCodeRaw(fop->runtime());
}

Просмотреть файл

@ -172,23 +172,23 @@ inline bool JSScript::isDebuggee() const {
}
inline bool JSScript::hasBaselineScript() const {
return jitScript_ && jitScript_->hasBaselineScript();
return hasJitScript() && jitScript()->hasBaselineScript();
}
inline bool JSScript::hasIonScript() const {
return jitScript_ && jitScript_->hasIonScript();
return hasJitScript() && jitScript()->hasIonScript();
}
inline bool JSScript::isIonCompilingOffThread() const {
return jitScript_ && jitScript_->isIonCompilingOffThread();
return hasJitScript() && jitScript()->isIonCompilingOffThread();
}
inline bool JSScript::canBaselineCompile() const {
bool disabled = hasFlag(MutableFlags::BaselineDisabled);
#ifdef DEBUG
if (jitScript_) {
if (hasJitScript()) {
bool jitScriptDisabled =
jitScript_->baselineScript_ == js::jit::BaselineDisabledScriptPtr;
jitScript()->baselineScript_ == js::jit::BaselineDisabledScriptPtr;
MOZ_ASSERT(disabled == jitScriptDisabled);
}
#endif
@ -198,9 +198,9 @@ inline bool JSScript::canBaselineCompile() const {
inline bool JSScript::canIonCompile() const {
bool disabled = hasFlag(MutableFlags::IonDisabled);
#ifdef DEBUG
if (jitScript_) {
if (hasJitScript()) {
bool jitScriptDisabled =
jitScript_->ionScript_ == js::jit::IonDisabledScriptPtr;
jitScript()->ionScript_ == js::jit::IonDisabledScriptPtr;
MOZ_ASSERT(disabled == jitScriptDisabled);
}
#endif
@ -210,24 +210,25 @@ inline bool JSScript::canIonCompile() const {
inline void JSScript::disableBaselineCompile() {
MOZ_ASSERT(!hasBaselineScript());
setFlag(MutableFlags::BaselineDisabled);
if (jitScript_) {
jitScript_->setBaselineScriptImpl(this, js::jit::BaselineDisabledScriptPtr);
if (hasJitScript()) {
jitScript()->setBaselineScriptImpl(this,
js::jit::BaselineDisabledScriptPtr);
}
}
inline void JSScript::disableIon() {
setFlag(MutableFlags::IonDisabled);
if (jitScript_) {
jitScript_->setIonScriptImpl(this, js::jit::IonDisabledScriptPtr);
if (hasJitScript()) {
jitScript()->setIonScriptImpl(this, js::jit::IonDisabledScriptPtr);
}
}
inline js::jit::BaselineScript* JSScript::baselineScript() const {
return jitScript_->baselineScript();
return jitScript()->baselineScript();
}
inline js::jit::IonScript* JSScript::ionScript() const {
return jitScript_->ionScript();
return jitScript()->ionScript();
}
#endif /* vm_JSScript_inl_h */

Просмотреть файл

@ -4120,12 +4120,12 @@ size_t JSScript::sizeOfData(mozilla::MallocSizeOf mallocSizeOf) const {
void JSScript::addSizeOfJitScript(mozilla::MallocSizeOf mallocSizeOf,
size_t* sizeOfJitScript,
size_t* sizeOfBaselineFallbackStubs) const {
if (!jitScript_) {
if (!hasJitScript()) {
return;
}
jitScript_->addSizeOfIncludingThis(mallocSizeOf, sizeOfJitScript,
sizeOfBaselineFallbackStubs);
jitScript()->addSizeOfIncludingThis(mallocSizeOf, sizeOfJitScript,
sizeOfBaselineFallbackStubs);
}
js::GlobalObject& JSScript::uninlinedGlobal() const { return global(); }
@ -5323,8 +5323,8 @@ void JSScript::updateJitCodeRaw(JSRuntime* rt) {
MOZ_ASSERT(jitCodeRaw_);
MOZ_ASSERT(jitCodeSkipArgCheck);
if (jitScript_) {
jitScript_->jitCodeSkipArgCheck_ = jitCodeSkipArgCheck;
if (hasJitScript()) {
jitScript()->jitCodeSkipArgCheck_ = jitCodeSkipArgCheck;
}
}

Просмотреть файл

@ -2603,7 +2603,7 @@ class JSScript : public js::BaseScript {
!doNotRelazify() && !hasCallSiteObj();
}
bool isRelazifiable() const {
return isRelazifiableIgnoringJitCode() && !jitScript_;
return isRelazifiableIgnoringJitCode() && !hasJitScript();
}
void setLazyScript(js::LazyScript* lazy) { lazyScript = lazy; }
js::LazyScript* maybeLazyScript() { return lazyScript; }
@ -2699,11 +2699,11 @@ class JSScript : public js::BaseScript {
bool hasJitScript() const { return jitScript_ != nullptr; }
js::jit::JitScript* jitScript() {
js::jit::JitScript* jitScript() const {
MOZ_ASSERT(hasJitScript());
return jitScript_;
}
js::jit::JitScript* maybeJitScript() {
js::jit::JitScript* maybeJitScript() const {
return hasJitScript() ? jitScript() : nullptr;
}