Bug 844779 - Part 1: Remove inline function tracking in ionmonkey, r=djvj

This commit is contained in:
Hannes Verschore 2014-06-02 23:28:44 +02:00
parent 8920364a5c
commit 1351054365
6 changed files with 33 additions and 93 deletions

View File

@ -8482,70 +8482,36 @@ bool
CodeGenerator::visitProfilerStackOp(LProfilerStackOp *lir)
{
Register temp = ToRegister(lir->temp()->output());
bool inlinedFunction = lir->inlineLevel() > 0;
switch (lir->type()) {
case MProfilerStackOp::InlineEnter:
// Multiple scripts can be inlined at one depth, but there is only
// one InlineExit node to signify this. To deal with this, if we
// reach the entry of another inline script on the same level, then
// just reset the sps metadata about the frame. We must balance
// calls to leave()/reenter(), so perform the balance without
// emitting any instrumentation. Technically the previous inline
// call at this same depth has reentered, but the instrumentation
// will be emitted at the common join point for all inlines at the
// same depth.
if (sps_.inliningDepth() == lir->inlineLevel()) {
sps_.leaveInlineFrame();
sps_.skipNextReenter();
sps_.reenter(masm, temp);
}
sps_.leave(masm, temp, /* inlinedFunction = */ true);
if (!sps_.enterInlineFrame())
return false;
// fallthrough
case MProfilerStackOp::Enter:
if (gen->options.spsSlowAssertionsEnabled()) {
if (!inlinedFunction) {
saveLive(lir);
pushArg(ImmGCPtr(lir->script()));
if (!callVM(SPSEnterInfo, lir))
return false;
restoreLive(lir);
}
sps_.pushManual(lir->script(), masm, temp, /* inlinedFunction = */ inlinedFunction);
saveLive(lir);
pushArg(ImmGCPtr(lir->script()));
if (!callVM(SPSEnterInfo, lir))
return false;
restoreLive(lir);
sps_.pushManual(lir->script(), masm, temp, /* inlinedFunction = */ false);
return true;
}
return sps_.push(lir->script(), masm, temp, /* inlinedFunction = */ inlinedFunction);
case MProfilerStackOp::InlineExit:
// all inline returns were covered with ::Exit, so we just need to
// maintain the state of inline frames currently active and then
// reenter the caller
sps_.leaveInlineFrame();
sps_.reenter(masm, temp, /* inlinedFunction = */ true);
return true;
return sps_.push(lir->script(), masm, temp, /* inlinedFunction = */ false);
case MProfilerStackOp::Exit:
if (gen->options.spsSlowAssertionsEnabled()) {
if (!inlinedFunction) {
saveLive(lir);
pushArg(ImmGCPtr(lir->script()));
// Once we've exited, then we shouldn't emit instrumentation for
// the corresponding reenter() because we no longer have a
// frame.
sps_.skipNextReenter();
if (!callVM(SPSExitInfo, lir))
return false;
restoreLive(lir);
}
saveLive(lir);
pushArg(ImmGCPtr(lir->script()));
// Once we've exited, then we shouldn't emit instrumentation for
// the corresponding reenter() because we no longer have a
// frame.
sps_.skipNextReenter();
if (!callVM(SPSExitInfo, lir))
return false;
restoreLive(lir);
return true;
}
sps_.pop(masm, temp, /* inlinedFunction = */ inlinedFunction);
sps_.pop(masm, temp, /* inlinedFunction = */ false);
return true;
default:

View File

@ -831,16 +831,6 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi
MBasicBlock *predecessor = callerBuilder->current;
JS_ASSERT(predecessor == callerResumePoint->block());
// All further instructions generated in from this scope should be
// considered as part of the function that we're inlining. We also need to
// keep track of the inlining depth because all scripts inlined on the same
// level contiguously have only one InlineExit node.
if (instrumentedProfiling()) {
predecessor->add(MProfilerStackOp::New(alloc(), script(),
MProfilerStackOp::InlineEnter,
inliningDepth_));
}
predecessor->end(MGoto::New(alloc(), current));
if (!current->addPredecessorWithoutPhis(predecessor))
return false;
@ -3701,9 +3691,8 @@ IonBuilder::processReturn(JSOp op)
MOZ_ASSUME_UNREACHABLE("unknown return op");
}
if (instrumentedProfiling()) {
current->add(MProfilerStackOp::New(alloc(), script(), MProfilerStackOp::Exit,
inliningDepth_));
if (instrumentedProfiling() && inliningDepth_ == 0) {
current->add(MProfilerStackOp::New(alloc(), script(), MProfilerStackOp::Exit));
}
MReturn *ret = MReturn::New(alloc(), def);
current->end(ret);
@ -4048,10 +4037,6 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
return false;
returnBlock->setCallerResumePoint(callerResumePoint_);
// When profiling add InlineExit instruction to indicate end of inlined function.
if (instrumentedProfiling())
returnBlock->add(MProfilerStackOp::New(alloc(), nullptr, MProfilerStackOp::InlineExit));
// Inherit the slots from current and pop |fun|.
returnBlock->inheritSlots(current);
returnBlock->pop();

View File

@ -5736,10 +5736,6 @@ class LProfilerStackOp : public LInstructionHelper<0, 0, 1>
MProfilerStackOp::Type type() {
return mir_->toProfilerStackOp()->type();
}
unsigned inlineLevel() {
return mir_->toProfilerStackOp()->inlineLevel();
}
};
class LIsCallable : public LInstructionHelper<1, 1, 0>

View File

@ -698,6 +698,7 @@ class LInstructionVisitor
protected:
jsbytecode *lastPC_;
jsbytecode *lastNotInlinedPC_;
LInstruction *instruction() {
return ins_;
@ -706,13 +707,17 @@ class LInstructionVisitor
public:
void setInstruction(LInstruction *ins) {
ins_ = ins;
if (ins->mirRaw())
if (ins->mirRaw()) {
lastPC_ = ins->mirRaw()->trackedPc();
if (ins->mirRaw()->trackedTree())
lastNotInlinedPC_ = ins->mirRaw()->profilerLeavePc();
}
}
LInstructionVisitor()
: ins_(nullptr),
lastPC_(nullptr)
lastPC_(nullptr),
lastNotInlinedPC_(nullptr)
{}
public:

View File

@ -9724,33 +9724,25 @@ class MProfilerStackOp : public MNullaryInstruction
public:
enum Type {
Enter, // a function has begun executing and it is not inline
Exit, // any function has exited (inlined or normal)
InlineEnter, // an inline function has begun executing
InlineExit // all instructions of an inline function are done, a
// return from the inline function could have occurred
// before this boundary
Exit // any function has exited and is not inline
};
private:
JSScript *script_;
Type type_;
unsigned inlineLevel_;
MProfilerStackOp(JSScript *script, Type type, unsigned inlineLevel)
: script_(script), type_(type), inlineLevel_(inlineLevel)
MProfilerStackOp(JSScript *script, Type type)
: script_(script), type_(type)
{
JS_ASSERT_IF(type != InlineExit, script != nullptr);
JS_ASSERT_IF(type == InlineEnter, inlineLevel != 0);
JS_ASSERT(script);
setGuard();
}
public:
INSTRUCTION_HEADER(ProfilerStackOp)
static MProfilerStackOp *New(TempAllocator &alloc, JSScript *script, Type type,
unsigned inlineLevel = 0) {
return new(alloc) MProfilerStackOp(script, type, inlineLevel);
static MProfilerStackOp *New(TempAllocator &alloc, JSScript *script, Type type) {
return new(alloc) MProfilerStackOp(script, type);
}
JSScript *script() {
@ -9761,10 +9753,6 @@ class MProfilerStackOp : public MNullaryInstruction
return type_;
}
unsigned inlineLevel() {
return inlineLevel_;
}
AliasSet getAliasSet() const {
return AliasSet::None();
}

View File

@ -49,7 +49,7 @@ CodeGeneratorShared::CodeGeneratorShared(MIRGenerator *gen, LIRGraph *graph, Mac
pushedArgs_(0),
#endif
lastOsiPointOffset_(0),
sps_(&GetIonContext()->runtime->spsProfiler(), &lastPC_),
sps_(&GetIonContext()->runtime->spsProfiler(), &lastNotInlinedPC_),
osrEntryOffset_(0),
skipArgCheckEntryOffset_(0),
frameDepth_(graph->paddedLocalSlotsSize() + graph->argumentsSize()),