Bug 1140741 - Teach JitProfilingFrameIterator to read DebugModeOSRInfo. (r=djvj)

This commit is contained in:
Shu-yu Guo 2015-03-09 18:55:26 -07:00
parent 0e4845745d
commit 9e49472b03
3 changed files with 32 additions and 3 deletions

View File

@ -0,0 +1,11 @@
enableSPSProfiling();
try {
// Only the ARM simulator supports single step profiling.
enableSingleStepProfiling();
} catch (e) {
quit(0);
}
var g = newGlobal();
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame) {};
g.eval("var line = new Error().lineNumber; debugger;");

View File

@ -280,6 +280,7 @@ class JitProfilingFrameIterator
bool tryInitWithPC(void *pc);
bool tryInitWithTable(JitcodeGlobalTable *table, void *pc, JSRuntime *rt,
bool forLastCallSite);
void fixBaselineDebugModeOSRReturnAddress();
public:
JitProfilingFrameIterator(JSRuntime *rt,

View File

@ -2898,15 +2898,21 @@ JitProfilingFrameIterator::JitProfilingFrameIterator(void *exitFrame)
ExitFrameLayout *frame = (ExitFrameLayout *) exitFrame;
FrameType prevType = frame->prevType();
if (prevType == JitFrame_IonJS || prevType == JitFrame_BaselineJS ||
prevType == JitFrame_Unwound_IonJS)
{
if (prevType == JitFrame_IonJS || prevType == JitFrame_Unwound_IonJS) {
returnAddressToFp_ = frame->returnAddress();
fp_ = GetPreviousRawFrame<ExitFrameLayout, uint8_t *>(frame);
type_ = JitFrame_IonJS;
return;
}
if (prevType == JitFrame_BaselineJS) {
returnAddressToFp_ = frame->returnAddress();
fp_ = GetPreviousRawFrame<ExitFrameLayout, uint8_t *>(frame);
type_ = JitFrame_BaselineJS;
fixBaselineDebugModeOSRReturnAddress();
return;
}
if (prevType == JitFrame_BaselineStub || prevType == JitFrame_Unwound_BaselineStub) {
BaselineStubFrameLayout *stubFrame =
GetPreviousRawFrame<ExitFrameLayout, BaselineStubFrameLayout *>(frame);
@ -2997,6 +3003,16 @@ JitProfilingFrameIterator::tryInitWithTable(JitcodeGlobalTable *table, void *pc,
return false;
}
void
JitProfilingFrameIterator::fixBaselineDebugModeOSRReturnAddress()
{
MOZ_ASSERT(type_ == JitFrame_BaselineJS);
BaselineFrame *bl = (BaselineFrame *)(fp_ - BaselineFrame::FramePointerOffset -
BaselineFrame::Size());
if (BaselineDebugModeOSRInfo *info = bl->getDebugModeOSRInfo())
returnAddressToFp_ = info->resumeAddr;
}
void
JitProfilingFrameIterator::operator++()
{
@ -3043,6 +3059,7 @@ JitProfilingFrameIterator::operator++()
returnAddressToFp_ = frame->returnAddress();
fp_ = GetPreviousRawFrame<JitFrameLayout, uint8_t *>(frame);
type_ = JitFrame_BaselineJS;
fixBaselineDebugModeOSRReturnAddress();
return;
}