Bug 1235636 - rewrite PCToLineNumber; r=fitzgen

This commit is contained in:
Tom Tromey 2015-12-29 13:31:43 -07:00
parent 6e577cf41f
commit e385bd20d9
4 changed files with 11 additions and 15 deletions

View File

@ -51,7 +51,7 @@ add_task(function* runTest() {
},
{
asyncCause: "promise callback",
columnNumber: 1,
columnNumber: 3,
filename: TEST_URI,
functionName: "time1",
language: 2,

View File

@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
/* Async parent frames from pushPrefEnv don't show up in e10s. */
var isE10S = !SpecialPowers.isMainProcess();
if (!isE10S && SpecialPowers.getBoolPref("javascript.options.asyncstack")) {
asyncFrame = `Async*@${file}:153:1
asyncFrame = `Async*@${file}:153:3
`;
} else {
asyncFrame = "";

View File

@ -41,7 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
var isE10S = !SpecialPowers.isMainProcess();
var asyncStack = SpecialPowers.getBoolPref("javascript.options.asyncstack");
var ourFile = location.href;
var parentFrame = (asyncStack && !isE10S) ? `Async*@${ourFile}:121:1
var parentFrame = (asyncStack && !isE10S) ? `Async*@${ourFile}:121:3
` : "";
Promise.all([

View File

@ -3243,21 +3243,17 @@ js::PCToLineNumber(unsigned startLine, jssrcnote* notes, jsbytecode* code, jsbyt
ptrdiff_t target = pc - code;
for (jssrcnote* sn = notes; !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
offset += SN_DELTA(sn);
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
if (type == SRC_SETLINE) {
if (offset <= target)
lineno = unsigned(GetSrcNoteOffset(sn, 0));
column = 0;
} else if (type == SRC_NEWLINE) {
if (offset <= target)
lineno++;
column = 0;
}
if (offset > target)
break;
if (type == SRC_COLSPAN) {
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
if (type == SRC_SETLINE) {
lineno = unsigned(GetSrcNoteOffset(sn, 0));
column = 0;
} else if (type == SRC_NEWLINE) {
lineno++;
column = 0;
} else if (type == SRC_COLSPAN) {
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
column += colspan;