зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1287161 - Move TraceLogger VM events into generateVMWrapper. r=hv1989
--HG-- extra : rebase_source : 9a417868453113bbc38fece397c3e53a0454a081
This commit is contained in:
Родитель
ac3438c9bb
Коммит
bebb5eeaca
|
@ -7595,6 +7595,46 @@ JitRuntime::generateLazyLinkStub(JSContext* cx)
|
|||
return code;
|
||||
}
|
||||
|
||||
bool
|
||||
JitRuntime::generateTLEventVM(JSContext* cx, MacroAssembler& masm, const VMFunction& f,
|
||||
bool enter)
|
||||
{
|
||||
#ifdef JS_TRACE_LOGGING
|
||||
TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
|
||||
|
||||
bool vmEventEnabled = TraceLogTextIdEnabled(TraceLogger_VM);
|
||||
bool vmSpecificEventEnabled = TraceLogTextIdEnabled(TraceLogger_VMSpecific);
|
||||
|
||||
if (vmEventEnabled || vmSpecificEventEnabled) {
|
||||
AllocatableRegisterSet regs(RegisterSet::Volatile());
|
||||
Register loggerReg = regs.takeAnyGeneral();
|
||||
masm.Push(loggerReg);
|
||||
masm.movePtr(ImmPtr(logger), loggerReg);
|
||||
|
||||
if (vmEventEnabled) {
|
||||
if (enter)
|
||||
masm.tracelogStartId(loggerReg, TraceLogger_VM, /* force = */ true);
|
||||
else
|
||||
masm.tracelogStopId(loggerReg, TraceLogger_VM, /* force = */ true);
|
||||
}
|
||||
if (vmSpecificEventEnabled) {
|
||||
TraceLoggerEvent event(logger, f.name());
|
||||
if (!event.hasPayload())
|
||||
return false;
|
||||
|
||||
if (enter)
|
||||
masm.tracelogStartId(loggerReg, event.payload()->textId(), /* force = */ true);
|
||||
else
|
||||
masm.tracelogStopId(loggerReg, event.payload()->textId(), /* force = */ true);
|
||||
}
|
||||
|
||||
masm.Pop(loggerReg);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef bool (*CharCodeAtFn)(JSContext*, HandleString, int32_t, uint32_t*);
|
||||
static const VMFunction CharCodeAtInfo =
|
||||
FunctionInfo<CharCodeAtFn>(jit::CharCodeAt, "CharCodeAt");
|
||||
|
|
|
@ -204,6 +204,15 @@ class JitRuntime
|
|||
JitCode* generateBaselineDebugModeOSRHandler(JSContext* cx, uint32_t* noFrameRegPopOffsetOut);
|
||||
JitCode* generateVMWrapper(JSContext* cx, const VMFunction& f);
|
||||
|
||||
bool generateTLEventVM(JSContext* cx, MacroAssembler& masm, const VMFunction& f, bool enter);
|
||||
|
||||
inline bool generateTLEnterVM(JSContext* cx, MacroAssembler& masm, const VMFunction& f) {
|
||||
return generateTLEventVM(cx, masm, f, /* enter = */ true);
|
||||
}
|
||||
inline bool generateTLExitVM(JSContext* cx, MacroAssembler& masm, const VMFunction& f) {
|
||||
return generateTLEventVM(cx, masm, f, /* enter = */ false);
|
||||
}
|
||||
|
||||
public:
|
||||
explicit JitRuntime(JSRuntime* rt);
|
||||
~JitRuntime();
|
||||
|
|
|
@ -818,6 +818,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!generateTLEnterVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
masm.setupUnalignedABICall(regs.getAny());
|
||||
masm.passABIArg(cxreg);
|
||||
|
||||
|
@ -855,6 +858,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
|
||||
masm.callWithABI(f.wrapped);
|
||||
|
||||
if (!generateTLExitVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
// Test for failure.
|
||||
switch (f.failType()) {
|
||||
case Type_Object:
|
||||
|
|
|
@ -637,6 +637,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!generateTLEnterVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
masm.setupUnalignedABICall(regs.getAny());
|
||||
masm.passABIArg(reg_cx);
|
||||
|
||||
|
@ -673,6 +676,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
|
||||
masm.callWithABI(f.wrapped);
|
||||
|
||||
if (!generateTLExitVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
// SP is used to transfer stack across call boundaries.
|
||||
if (!masm.GetStackPointer64().Is(vixl::sp))
|
||||
masm.Mov(masm.GetStackPointer64(), vixl::sp);
|
||||
|
|
|
@ -796,6 +796,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
masm.reserveStack(outParamOffset);
|
||||
masm.movePtr(StackPointer, doubleArgs);
|
||||
|
||||
if (!generateTLEnterVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
masm.setupAlignedABICall();
|
||||
masm.passABIArg(cxreg);
|
||||
|
||||
|
@ -845,6 +848,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
|
||||
masm.callWithABI(f.wrapped);
|
||||
|
||||
if (!generateTLExitVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
// Test for failure.
|
||||
switch (f.failType()) {
|
||||
case Type_Object:
|
||||
|
|
|
@ -757,6 +757,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!generateTLEnterVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
masm.setupUnalignedABICall(regs.getAny());
|
||||
masm.passABIArg(cxreg);
|
||||
|
||||
|
@ -791,6 +794,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
|
||||
masm.callWithABI(f.wrapped);
|
||||
|
||||
if (!generateTLExitVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
// Test for failure.
|
||||
switch (f.failType()) {
|
||||
case Type_Object:
|
||||
|
|
|
@ -1353,11 +1353,6 @@ CodeGeneratorShared::callVM(const VMFunction& fun, LInstruction* ins, const Regi
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef JS_TRACE_LOGGING
|
||||
emitTracelogStartEvent(TraceLogger_VM);
|
||||
emitTracelogStartEvent(fun.name(), TraceLogger_VMSpecific);
|
||||
#endif
|
||||
|
||||
// Stack is:
|
||||
// ... frame ...
|
||||
// [args]
|
||||
|
@ -1404,11 +1399,6 @@ CodeGeneratorShared::callVM(const VMFunction& fun, LInstruction* ins, const Regi
|
|||
masm.implicitPop(fun.explicitStackSlots() * sizeof(void*) + framePop);
|
||||
// Stack is:
|
||||
// ... frame ...
|
||||
|
||||
#ifdef JS_TRACE_LOGGING
|
||||
emitTracelogStopEvent(TraceLogger_VM);
|
||||
emitTracelogStopEvent(fun.name(), TraceLogger_VMSpecific);
|
||||
#endif
|
||||
}
|
||||
|
||||
class OutOfLineTruncateSlow : public OutOfLineCodeBase<CodeGeneratorShared>
|
||||
|
|
|
@ -714,6 +714,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!generateTLEnterVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
masm.setupUnalignedABICall(regs.getAny());
|
||||
masm.passABIArg(cxreg);
|
||||
|
||||
|
@ -747,6 +750,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
|
||||
masm.callWithABI(f.wrapped);
|
||||
|
||||
if (!generateTLExitVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
// Test for failure.
|
||||
switch (f.failType()) {
|
||||
case Type_Object:
|
||||
|
|
|
@ -735,6 +735,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!generateTLEnterVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
masm.setupUnalignedABICall(regs.getAny());
|
||||
masm.passABIArg(cxreg);
|
||||
|
||||
|
@ -775,6 +778,9 @@ JitRuntime::generateVMWrapper(JSContext* cx, const VMFunction& f)
|
|||
|
||||
masm.callWithABI(f.wrapped);
|
||||
|
||||
if (!generateTLExitVM(cx, masm, f))
|
||||
return nullptr;
|
||||
|
||||
// Test for failure.
|
||||
switch (f.failType()) {
|
||||
case Type_Object:
|
||||
|
|
Загрузка…
Ссылка в новой задаче