Bug 1467191 - Unified IonCacheIRCompiler::calledPrepareVMCall_ and BaselineCacheIRCompiler::inStubFrame_ into CacheIRCompiler::preparedForVMCall_. r=mgaudet

Member variables `calledPrepareVMCall_` and `inStubFrame_` served the same purpose for their classes.
Unified them in CacheIRCompiler.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Adam Holm 2019-06-13 02:25:36 +00:00
parent 6e4e4786b3
commit f8f9b8becc
6 changed files with 17 additions and 33 deletions

View File

@ -49,7 +49,6 @@ BaselineCacheIRCompiler::BaselineCacheIRCompiler(
BaselineCacheIRStubKind stubKind)
: CacheIRCompiler(cx, writer, stubDataOffset, Mode::Baseline,
StubFieldPolicy::Address),
inStubFrame_(false),
makesGCCalls_(false),
kind_(stubKind) {}
@ -93,15 +92,15 @@ class MOZ_RAII AutoStubFrame {
framePushedAtEnterStubFrame_ = masm.framePushed();
#endif
MOZ_ASSERT(!compiler.inStubFrame_);
compiler.inStubFrame_ = true;
MOZ_ASSERT(!compiler.preparedForVMCall_);
compiler.preparedForVMCall_ = true;
if (canGC == CallCanGC::CanGC) {
compiler.makesGCCalls_ = true;
}
}
void leave(MacroAssembler& masm, bool calledIntoIon = false) {
MOZ_ASSERT(compiler.inStubFrame_);
compiler.inStubFrame_ = false;
MOZ_ASSERT(compiler.preparedForVMCall_);
compiler.preparedForVMCall_ = false;
#ifdef DEBUG
masm.setFramePushed(framePushedAtEnterStubFrame_);
@ -114,7 +113,7 @@ class MOZ_RAII AutoStubFrame {
}
#ifdef DEBUG
~AutoStubFrame() { MOZ_ASSERT(!compiler.inStubFrame_); }
~AutoStubFrame() { MOZ_ASSERT(!compiler.preparedForVMCall_); }
#endif
};
@ -141,7 +140,7 @@ void BaselineCacheIRCompiler::tailCallVM(MacroAssembler& masm) {
void BaselineCacheIRCompiler::tailCallVMInternal(MacroAssembler& masm,
TailCallVMFunctionId id) {
MOZ_ASSERT(!inStubFrame_);
MOZ_ASSERT(!preparedForVMCall_);
TrampolinePtr code = cx_->runtime()->jitRuntime()->getVMWrapper(id);
const VMFunctionData& fun = GetVMFunction(id);
@ -195,7 +194,7 @@ JitCode* BaselineCacheIRCompiler::compile() {
allocator.nextOp();
} while (reader.more());
MOZ_ASSERT(!inStubFrame_);
MOZ_ASSERT(!preparedForVMCall_);
masm.assumeUnreachable("Should have returned from IC");
// Done emitting the main IC code. Now emit the failure paths.

View File

@ -27,10 +27,6 @@ ICStub* AttachBaselineCacheIRStub(JSContext* cx, const CacheIRWriter& writer,
// BaselineCacheIRCompiler compiles CacheIR to BaselineIC native code.
class MOZ_RAII BaselineCacheIRCompiler : public CacheIRCompiler {
public:
bool inStubFrame_;
private:
bool makesGCCalls_;
BaselineCacheIRStubKind kind_;

View File

@ -4398,11 +4398,7 @@ void CacheIRCompiler::callVM(MacroAssembler& masm) {
void CacheIRCompiler::callVMInternal(MacroAssembler& masm, VMFunctionId id) {
if (mode_ == Mode::Ion) {
#ifdef DEBUG
IonCacheIRCompiler* ionCompiler = &this->asIon();
MOZ_ASSERT(ionCompiler);
MOZ_ASSERT(ionCompiler->calledPrepareVMCall_);
#endif
MOZ_ASSERT(preparedForVMCall_);
TrampolinePtr code = cx_->runtime()->jitRuntime()->getVMWrapper(id);
const VMFunctionData& fun = GetVMFunction(id);
uint32_t frameSize = fun.explicitStackSlots() * sizeof(void*);
@ -4420,12 +4416,11 @@ void CacheIRCompiler::callVMInternal(MacroAssembler& masm, VMFunctionId id) {
masm.freeStack(IonICCallFrameLayout::Size());
return;
}
#ifdef DEBUG
MOZ_ASSERT(mode_ == Mode::Baseline);
BaselineCacheIRCompiler* baselineCompiler = &this->asBaseline();
MOZ_ASSERT(baselineCompiler);
MOZ_ASSERT(baselineCompiler->inStubFrame_);
#endif
MOZ_ASSERT(preparedForVMCall_);
TrampolinePtr code = cx_->runtime()->jitRuntime()->getVMWrapper(id);
MOZ_ASSERT(GetVMFunction(id).expectTailCall == NonTailCall);

View File

@ -711,6 +711,8 @@ class MOZ_RAII CacheIRCompiler {
enum class Mode { Baseline, Ion };
bool preparedForVMCall_;
bool isBaseline();
bool isIon();
BaselineCacheIRCompiler& asBaseline();
@ -763,7 +765,8 @@ class MOZ_RAII CacheIRCompiler {
CacheIRCompiler(JSContext* cx, const CacheIRWriter& writer,
uint32_t stubDataOffset, Mode mode, StubFieldPolicy policy)
: cx_(cx),
: preparedForVMCall_(false),
cx_(cx),
reader(writer),
writer_(writer),
allocator(writer_),

View File

@ -47,9 +47,6 @@ IonCacheIRCompiler::IonCacheIRCompiler(
ionScript_(ionScript),
stub_(stub),
typeCheckInfo_(typeCheckInfo),
#ifdef DEBUG
calledPrepareVMCall_(false),
#endif
savedLiveRegs_(false) {
MOZ_ASSERT(ic_);
MOZ_ASSERT(ionScript_);
@ -287,9 +284,7 @@ void IonCacheIRCompiler::prepareVMCall(MacroAssembler& masm,
masm.Push(Imm32(descriptor));
masm.Push(ImmPtr(GetReturnAddressToIonCode(cx_)));
#ifdef DEBUG
calledPrepareVMCall_ = true;
#endif
preparedForVMCall_ = true;
}
bool IonCacheIRCompiler::init() {

View File

@ -44,10 +44,6 @@ class MOZ_RAII IonCacheIRCompiler : public CacheIRCompiler {
Maybe<LiveRegisterSet> liveRegs_;
Maybe<CodeOffset> stubJitCodeOffset_;
public:
#ifdef DEBUG
bool calledPrepareVMCall_;
#endif
private:
bool savedLiveRegs_;