Bug 1470795 Part 4 - Move progress tracking logic to JSScript, r=jandem.

--HG--
extra : rebase_source : 971df1eff735485420b7157d2adfb58196332ca5
This commit is contained in:
Brian Hackett 2018-07-23 21:44:55 +00:00
Родитель 965d96a199
Коммит 55d5de3688
10 изменённых файлов: 45 добавлений и 25 удалений

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

@ -995,8 +995,8 @@ InitFromBailout(JSContext* cx, size_t frameNo,
break;
}
op = JSOp(*pc);
if (skippedLoopEntry && ReplayDebugger::trackProgress(script))
ReplayDebugger::gProgressCounter++;
if (skippedLoopEntry && script->trackRecordReplayProgress())
mozilla::recordreplay::AdvanceExecutionProgressCounter();
}
const uint32_t pcOff = script->pcToOffset(pc);
@ -1197,8 +1197,8 @@ InitFromBailout(JSContext* cx, size_t frameNo,
// Undo the progress for any loop entry we thought we were skipping
// over earlier.
if (skippedLoopEntry && ReplayDebugger::trackProgress(script))
ReplayDebugger::gProgressCounter--;
if (skippedLoopEntry && script->trackRecordReplayProgress())
--*mozilla::recordreplay::ExecutionProgressCounter();
} else {
opReturnAddr = nativeCodeForPC;
}

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

@ -26,7 +26,6 @@
#include "vm/EnvironmentObject.h"
#include "vm/Interpreter.h"
#include "vm/JSFunction.h"
#include "vm/ReplayDebugger.h"
#include "vm/TraceLogging.h"
#include "vtune/VTuneWrapper.h"
@ -362,8 +361,8 @@ BaselineCompiler::emitPrologue()
#endif
emitProfilerEnterFrame();
if (ReplayDebugger::trackProgress(script))
masm.inc64(AbsoluteAddress(&ReplayDebugger::gProgressCounter));
if (script->trackRecordReplayProgress())
masm.inc64(AbsoluteAddress(mozilla::recordreplay::ExecutionProgressCounter()));
masm.push(BaselineFrameReg);
masm.moveStackPtrTo(BaselineFrameReg);
@ -1362,8 +1361,8 @@ BaselineCompiler::emit_JSOP_LOOPENTRY()
frame.syncStack(0);
if (!emitWarmUpCounterIncrement(LoopEntryCanIonOsr(pc)))
return false;
if (ReplayDebugger::trackProgress(script))
masm.inc64(AbsoluteAddress(&ReplayDebugger::gProgressCounter));
if (script->trackRecordReplayProgress())
masm.inc64(AbsoluteAddress(mozilla::recordreplay::ExecutionProgressCounter()));
return true;
}

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

@ -50,7 +50,6 @@
#include "vm/MatchPairs.h"
#include "vm/RegExpObject.h"
#include "vm/RegExpStatics.h"
#include "vm/ReplayDebugger.h"
#include "vm/StringType.h"
#include "vm/TraceLogging.h"
#include "vm/TypedArrayObject.h"
@ -62,6 +61,7 @@
#include "jit/shared/Lowering-shared-inl.h"
#include "jit/TemplateObject-inl.h"
#include "vm/Interpreter-inl.h"
#include "vm/JSScript-inl.h"
using namespace js;
using namespace js::jit;
@ -13009,7 +13009,7 @@ CodeGenerator::visitInterruptCheck(LInterruptCheck* lir)
OutOfLineCode* ool = oolCallVM(InterruptCheckInfo, lir, ArgList(), StoreNothing());
if (lir->mir()->trackRecordReplayProgress())
masm.inc64(AbsoluteAddress(&ReplayDebugger::gProgressCounter));
masm.inc64(AbsoluteAddress(mozilla::recordreplay::ExecutionProgressCounter()));
const void* interruptAddr = gen->runtime->addressOfInterruptBits();
masm.branch32(Assembler::NotEqual, AbsoluteAddress(interruptAddr), Imm32(0), ool->entry());

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

@ -1017,8 +1017,8 @@ IonBuilder::buildInline(IonBuilder* callerBuilder, MResumePoint* callerResumePoi
insertRecompileCheck();
// Insert an interrupt check when recording or replaying, which will bump
// the debugger's progress counter.
if (ReplayDebugger::trackProgress(script())) {
// the record/replay system's progress counter.
if (script()->trackRecordReplayProgress()) {
MInterruptCheck* check = MInterruptCheck::New(alloc());
check->setTrackRecordReplayProgress();
current->add(check);
@ -1761,7 +1761,7 @@ IonBuilder::jsop_loopentry()
current->add(check);
insertRecompileCheck();
if (ReplayDebugger::trackProgress(script())) {
if (script()->trackRecordReplayProgress()) {
check->setTrackRecordReplayProgress();
// When recording/replaying, MInterruptCheck is effectful and should
@ -5775,7 +5775,7 @@ IonBuilder::jsop_eval(uint32_t argc)
if (string->isConcat() &&
string->getOperand(1)->type() == MIRType::String &&
string->getOperand(1)->maybeConstantValue() &&
!ReplayDebugger::trackProgress(script()))
!script()->trackRecordReplayProgress())
{
JSAtom* atom = &string->getOperand(1)->maybeConstantValue()->toString()->asAtom();

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

@ -7,7 +7,8 @@
#include "jit/LoopUnroller.h"
#include "jit/MIRGraph.h"
#include "vm/ReplayDebugger.h"
#include "vm/JSScript-inl.h"
using namespace js;
using namespace js::jit;
@ -406,7 +407,7 @@ jit::UnrollLoops(MIRGraph& graph, const LoopIterationBoundVector& bounds)
// Loop unrolling interferes with the progress tracking performed when
// recording/replaying.
if (ReplayDebugger::trackProgress(graph.entryBlock()->info().script()))
if (graph.entryBlock()->info().script()->trackRecordReplayProgress())
return true;
for (size_t i = 0; i < bounds.length(); i++) {

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

@ -19,11 +19,11 @@
#include "jit/MIRGenerator.h"
#include "jit/OptimizationTracking.h"
#include "js/Conversions.h"
#include "vm/ReplayDebugger.h"
#include "vm/TraceLogging.h"
#include "jit/JitFrames-inl.h"
#include "jit/MacroAssembler-inl.h"
#include "vm/JSScript-inl.h"
using namespace js;
using namespace js::jit;
@ -129,8 +129,8 @@ CodeGeneratorShared::generatePrologue()
if (isProfilerInstrumentationEnabled())
masm.profilerEnterFrame(masm.getStackPointer(), CallTempReg0);
if (ReplayDebugger::trackProgress(gen->info().script()))
masm.inc64(AbsoluteAddress(&ReplayDebugger::gProgressCounter));
if (gen->info().script()->trackRecordReplayProgress())
masm.inc64(AbsoluteAddress(mozilla::recordreplay::ExecutionProgressCounter()));
// Ensure that the Ion frame is properly aligned.
masm.assertStackAlignment(JitStackAlignment, 0);

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

@ -2199,8 +2199,8 @@ CASE(JSOP_LOOPENTRY)
goto leave_on_safe_point;
}
}
if (ReplayDebugger::trackProgress(script))
ReplayDebugger::gProgressCounter++;
if (script->trackRecordReplayProgress())
mozilla::recordreplay::AdvanceExecutionProgressCounter();
END_CASE(JSOP_LOOPENTRY)
CASE(JSOP_LINENO)

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

@ -209,4 +209,19 @@ JSScript::isDebuggee() const
return realm_->debuggerObservesAllExecution() || bitFields_.hasDebugScript_;
}
inline bool
JSScript::trackRecordReplayProgress() const
{
// Progress is only tracked when recording or replaying, and only for
// scripts associated with the main thread's runtime. Whether self hosted
// scripts execute may depend on performed Ion optimizations (for example,
// self hosted TypedObject logic), so they are ignored. Some scripts are
// internal to record/replay and run non-deterministically, so are also
// ignored.
return MOZ_UNLIKELY(mozilla::recordreplay::IsRecordingOrReplaying())
&& !runtimeFromAnyThread()->parentRuntime
&& !selfHosted()
&& !mozilla::recordreplay::IsInternalScript(filename());
}
#endif /* vm_JSScript_inl_h */

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

@ -2132,6 +2132,10 @@ class JSScript : public js::gc::TenuredCell
void holdScript(JS::HandleFunction fun);
void dropScript();
};
// Return whether the record/replay execution progress counter
// (see RecordReplay.h) should be updated as this script runs.
inline bool trackRecordReplayProgress() const;
};
/* If this fails, add/remove padding within JSScript. */

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

@ -10,7 +10,8 @@
#include "vm/Probes.h"
#include "vm/JSContext.h"
#include "vm/ReplayDebugger.h"
#include "vm/JSScript-inl.h"
namespace js {
@ -48,8 +49,8 @@ probes::EnterScript(JSContext* cx, JSScript* script, JSFunction* maybeFun,
fp->setPushedGeckoProfilerFrame();
}
if (ReplayDebugger::trackProgress(script))
ReplayDebugger::gProgressCounter++;
if (script->trackRecordReplayProgress())
mozilla::recordreplay::AdvanceExecutionProgressCounter();
return true;
}