Bug 1427729: Have EnsureBareExitFrame and JSJitFrameIter take only JitActivation parameters; r=jandem

MozReview-Commit-ID: CZKK1D8bThW

--HG--
extra : rebase_source : 1b609a2e33583ca0722d4aef9220ab85acfc58c8
This commit is contained in:
Benjamin Bouvier 2018-01-05 16:09:57 +01:00
Родитель f0969b8242
Коммит c21325b457
11 изменённых файлов: 18 добавлений и 24 удалений

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

@ -2527,7 +2527,7 @@ testingFunc_inIon(JSContext* cx, unsigned argc, Value* vp)
ScriptFrameIter iter(cx); ScriptFrameIter iter(cx);
if (!iter.done() && iter.isIon()) { if (!iter.done() && iter.isIon()) {
// Reset the counter of the IonScript's script. // Reset the counter of the IonScript's script.
jit::JSJitFrameIter jitIter(cx); jit::JSJitFrameIter jitIter(cx->activation()->asJit());
++jitIter; ++jitIter;
jitIter.script()->resetWarmUpResetCounter(); jitIter.script()->resetWarmUpResetCounter();
} else { } else {

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

@ -1900,7 +1900,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo)
RootedScript outerScript(cx, nullptr); RootedScript outerScript(cx, nullptr);
MOZ_ASSERT(cx->currentlyRunningInJit()); MOZ_ASSERT(cx->currentlyRunningInJit());
JSJitFrameIter iter(cx); JSJitFrameIter iter(cx->activation()->asJit());
uint8_t* outerFp = nullptr; uint8_t* outerFp = nullptr;
// Iter currently points at the exit frame. Get the previous frame // Iter currently points at the exit frame. Get the previous frame
@ -1962,7 +1962,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo)
// on. // on.
JitActivation* act = cx->activation()->asJit(); JitActivation* act = cx->activation()->asJit();
if (act->hasRematerializedFrame(outerFp)) { if (act->hasRematerializedFrame(outerFp)) {
JSJitFrameIter iter(cx); JSJitFrameIter iter(cx->activation()->asJit());
size_t inlineDepth = numFrames; size_t inlineDepth = numFrames;
bool ok = true; bool ok = true;
while (inlineDepth > 0) { while (inlineDepth > 0) {

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

@ -1186,7 +1186,7 @@ JitRuntime::generateBaselineDebugModeOSRHandler(JSContext* cx, uint32_t* noFrame
/* static */ void /* static */ void
DebugModeOSRVolatileJitFrameIter::forwardLiveIterators(const CooperatingContext& cx, DebugModeOSRVolatileJitFrameIter::forwardLiveIterators(const CooperatingContext& cx,
uint8_t* oldAddr, uint8_t* newAddr) uint8_t* oldAddr, uint8_t* newAddr)
{ {
DebugModeOSRVolatileJitFrameIter* iter; DebugModeOSRVolatileJitFrameIter* iter;
for (iter = cx.context()->liveVolatileJitFrameIter_; iter; iter = iter->prev) for (iter = cx.context()->liveVolatileJitFrameIter_; iter; iter = iter->prev)

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

@ -142,7 +142,7 @@ BaselineFrame::initForOsr(InterpreterFrame* fp, uint32_t numStackValues)
// debugger, wants a valid return address, but it's okay to just pick one. // debugger, wants a valid return address, but it's okay to just pick one.
// In debug mode there's always at least 1 ICEntry (since there are always // In debug mode there's always at least 1 ICEntry (since there are always
// debug prologue/epilogue calls). // debug prologue/epilogue calls).
JSJitFrameIter frame(cx); JSJitFrameIter frame(cx->activation()->asJit());
MOZ_ASSERT(frame.returnAddress() == nullptr); MOZ_ASSERT(frame.returnAddress() == nullptr);
BaselineScript* baseline = fp->script()->baselineScript(); BaselineScript* baseline = fp->script()->baselineScript();
frame.current()->setReturnAddress(baseline->returnAddressForIC(baseline->icEntry(0))); frame.current()->setReturnAddress(baseline->returnAddressForIC(baseline->icEntry(0)));

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

@ -327,7 +327,7 @@ CacheRegisterAllocator::restoreIonLiveRegisters(MacroAssembler& masm, LiveRegist
static void* static void*
GetReturnAddressToIonCode(JSContext* cx) GetReturnAddressToIonCode(JSContext* cx)
{ {
JSJitFrameIter frame(cx); JSJitFrameIter frame(cx->activation()->asJit());
MOZ_ASSERT(frame.type() == JitFrame_Exit, MOZ_ASSERT(frame.type() == JitFrame_Exit,
"An exit frame is expected as update functions are called with a VMFunction."); "An exit frame is expected as update functions are called with a VMFunction.");

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

@ -31,11 +31,6 @@ JSJitFrameIter::JSJitFrameIter(const JitActivation* activation)
} }
} }
JSJitFrameIter::JSJitFrameIter(JSContext* cx)
: JSJitFrameIter(cx->activation()->asJit())
{
}
bool bool
JSJitFrameIter::checkInvalidation() const JSJitFrameIter::checkInvalidation() const
{ {

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

@ -112,7 +112,6 @@ class JSJitFrameIter
public: public:
// See comment above the class. // See comment above the class.
explicit JSJitFrameIter(const JitActivation* activation); explicit JSJitFrameIter(const JitActivation* activation);
explicit JSJitFrameIter(JSContext* cx);
// Used only by DebugModeOSRVolatileJitFrameIter. // Used only by DebugModeOSRVolatileJitFrameIter.
void exchangeReturnAddressIfMatch(uint8_t* oldAddr, uint8_t* newAddr) { void exchangeReturnAddressIfMatch(uint8_t* oldAddr, uint8_t* newAddr) {

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

@ -29,7 +29,7 @@ SafepointIndex::resolve()
inline BaselineFrame* inline BaselineFrame*
GetTopBaselineFrame(JSContext* cx) GetTopBaselineFrame(JSContext* cx)
{ {
JSJitFrameIter frame(cx); JSJitFrameIter frame(cx->activation()->asJit());
MOZ_ASSERT(frame.type() == JitFrame_Exit); MOZ_ASSERT(frame.type() == JitFrame_Exit);
++frame; ++frame;
if (frame.isBaselineStub()) if (frame.isBaselineStub())

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

@ -746,7 +746,7 @@ HandleException(ResumeFromException* rfe)
// see this frame when they use ScriptFrameIter, and (2) // see this frame when they use ScriptFrameIter, and (2)
// ScriptFrameIter does not crash when accessing an IonScript // ScriptFrameIter does not crash when accessing an IonScript
// that's destroyed by the ionScript->decref call. // that's destroyed by the ionScript->decref call.
EnsureBareExitFrame(cx, current); EnsureBareExitFrame(cx->activation()->asJit(), current);
} }
if (overrecursed) { if (overrecursed) {
@ -763,11 +763,11 @@ HandleException(ResumeFromException* rfe)
// Turns a JitFrameLayout into an ExitFrameLayout. Note that it has to be a // Turns a JitFrameLayout into an ExitFrameLayout. Note that it has to be a
// bare exit frame so it's ignored by TraceJitExitFrame. // bare exit frame so it's ignored by TraceJitExitFrame.
void void
EnsureBareExitFrame(JSContext* cx, JitFrameLayout* frame) EnsureBareExitFrame(JitActivation* act, JitFrameLayout* frame)
{ {
ExitFrameLayout* exitFrame = reinterpret_cast<ExitFrameLayout*>(frame); ExitFrameLayout* exitFrame = reinterpret_cast<ExitFrameLayout*>(frame);
if (cx->activation()->asJit()->jsExitFP() == (uint8_t*)frame) { if (act->jsExitFP() == (uint8_t*)frame) {
// If we already called this function for the current frame, do // If we already called this function for the current frame, do
// nothing. // nothing.
MOZ_ASSERT(exitFrame->isBareExit()); MOZ_ASSERT(exitFrame->isBareExit());
@ -775,17 +775,17 @@ EnsureBareExitFrame(JSContext* cx, JitFrameLayout* frame)
} }
#ifdef DEBUG #ifdef DEBUG
JSJitFrameIter iter(cx); JSJitFrameIter iter(act);
while (!iter.isScripted()) while (!iter.isScripted())
++iter; ++iter;
MOZ_ASSERT(iter.current() == frame, "|frame| must be the top JS frame"); MOZ_ASSERT(iter.current() == frame, "|frame| must be the top JS frame");
MOZ_ASSERT(!!cx->activation()->asJit()->jsExitFP()); MOZ_ASSERT(!!act->jsExitFP());
MOZ_ASSERT((uint8_t*)exitFrame->footer() >= cx->activation()->asJit()->jsExitFP(), MOZ_ASSERT((uint8_t*)exitFrame->footer() >= act->jsExitFP(),
"Must have space for ExitFooterFrame before jsExitFP"); "Must have space for ExitFooterFrame before jsExitFP");
#endif #endif
cx->activation()->asJit()->setJSExitFP((uint8_t*)frame); act->setJSExitFP((uint8_t*)frame);
exitFrame->footer()->setBareExitFrame(); exitFrame->footer()->setBareExitFrame();
MOZ_ASSERT(exitFrame->isBareExit()); MOZ_ASSERT(exitFrame->isBareExit());
} }

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

@ -284,7 +284,7 @@ struct ResumeFromException
void HandleException(ResumeFromException* rfe); void HandleException(ResumeFromException* rfe);
void EnsureBareExitFrame(JSContext* cx, JitFrameLayout* frame); void EnsureBareExitFrame(JitActivation* act, JitFrameLayout* frame);
void TraceJitActivations(JSContext* cx, const CooperatingContext& target, JSTracer* trc); void TraceJitActivations(JSContext* cx, const CooperatingContext& target, JSTracer* trc);
@ -312,7 +312,7 @@ MakeFrameDescriptor(uint32_t frameSize, FrameType type, uint32_t headerSize)
inline JSScript* inline JSScript*
GetTopJitJSScript(JSContext* cx) GetTopJitJSScript(JSContext* cx)
{ {
JSJitFrameIter frame(cx); JSJitFrameIter frame(cx->activation()->asJit());
MOZ_ASSERT(frame.type() == JitFrame_Exit); MOZ_ASSERT(frame.type() == JitFrame_Exit);
++frame; ++frame;

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

@ -391,7 +391,7 @@ ArrayPushDense(JSContext* cx, HandleArrayObject arr, HandleValue v, uint32_t* le
// possible the setOrExtendDenseElements call already invalidated the // possible the setOrExtendDenseElements call already invalidated the
// IonScript. JSJitFrameIter::ionScript works when the script is invalidated // IonScript. JSJitFrameIter::ionScript works when the script is invalidated
// so we use that instead. // so we use that instead.
JSJitFrameIter frame(cx); JSJitFrameIter frame(cx->activation()->asJit());
MOZ_ASSERT(frame.type() == JitFrame_Exit); MOZ_ASSERT(frame.type() == JitFrame_Exit);
++frame; ++frame;
IonScript* ionScript = frame.ionScript(); IonScript* ionScript = frame.ionScript();
@ -872,7 +872,7 @@ DebugEpilogue(JSContext* cx, BaselineFrame* frame, jsbytecode* pc, bool ok)
// Pop this frame by updating packedExitFP, so that the exception // Pop this frame by updating packedExitFP, so that the exception
// handling code will start at the previous frame. // handling code will start at the previous frame.
JitFrameLayout* prefix = frame->framePrefix(); JitFrameLayout* prefix = frame->framePrefix();
EnsureBareExitFrame(cx, prefix); EnsureBareExitFrame(cx->activation()->asJit(), prefix);
return false; return false;
} }