Really fix 215878, with great help from darin.
git-svn-id: svn://10.0.0.236/trunk@145948 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -4162,8 +4162,8 @@ js_AddToSrcNoteDelta(JSContext *cx, JSCodeGenerator *cg, jssrcnote *sn,
|
||||
intN index;
|
||||
|
||||
/*
|
||||
* Called only from OptimizeSpanDeps to add to main script note deltas,
|
||||
* and only by a small positive amount.
|
||||
* Called only from OptimizeSpanDeps and js_FinishTakingSrcNotes to add to
|
||||
* main script note deltas, and only by a small positive amount.
|
||||
*/
|
||||
JS_ASSERT(cg->current == &cg->main);
|
||||
JS_ASSERT((unsigned) delta < (unsigned) SN_XDELTA_LIMIT);
|
||||
@@ -4304,6 +4304,7 @@ JSBool
|
||||
js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg, jssrcnote *notes)
|
||||
{
|
||||
uintN prologCount, mainCount, totalCount;
|
||||
ptrdiff_t offset, delta;
|
||||
|
||||
JS_ASSERT(cg->current == &cg->main);
|
||||
|
||||
@@ -4314,6 +4315,21 @@ js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg, jssrcnote *notes)
|
||||
return JS_FALSE;
|
||||
prologCount = cg->prolog.noteCount;
|
||||
CG_SWITCH_TO_MAIN(cg);
|
||||
} else {
|
||||
/*
|
||||
* Either no prolog srcnotes, or no line number change over prolog.
|
||||
* We don't need a SRC_SETLINE, but we may need to adjust the offset
|
||||
* of the first main note, by adding to its delta and possibly even
|
||||
* prepending SRC_XDELTA notes to it to account for prolog bytes.
|
||||
*/
|
||||
offset = CG_PROLOG_OFFSET(cg) - cg->prolog.lastNoteOffset;
|
||||
JS_ASSERT(offset >= 0);
|
||||
while (offset > 0) {
|
||||
delta = JS_MIN(offset, SN_XDELTA_MASK);
|
||||
if (!js_AddToSrcNoteDelta(cx, cg, cg->main.notes, delta))
|
||||
return JS_FALSE;
|
||||
offset -= delta;
|
||||
}
|
||||
}
|
||||
|
||||
mainCount = cg->main.noteCount;
|
||||
|
||||
@@ -480,16 +480,23 @@ js_SetSrcNoteOffset(JSContext *cx, JSCodeGenerator *cg, uintN index,
|
||||
*/
|
||||
#define CG_COUNT_FINAL_SRCNOTES(cg, cnt) \
|
||||
JS_BEGIN_MACRO \
|
||||
cnt = (cg)->main.noteCount + 1; \
|
||||
if ((cg)->prolog.noteCount) { \
|
||||
cnt += (cg)->prolog.noteCount; \
|
||||
if ((cg)->prolog.currentLine != (cg)->firstLine) { \
|
||||
ptrdiff_t diff_ = CG_PROLOG_OFFSET(cg) - \
|
||||
(cg)->prolog.lastNoteOffset; \
|
||||
if (diff_ > SN_DELTA_MASK) \
|
||||
cnt += JS_HOWMANY(diff_ - SN_DELTA_MASK, SN_XDELTA_MASK); \
|
||||
cnt += 2 + (((cg)->firstLine > SN_3BYTE_OFFSET_MASK) << 1); \
|
||||
ptrdiff_t diff_ = CG_PROLOG_OFFSET(cg) - (cg)->prolog.lastNoteOffset; \
|
||||
cnt = (cg)->prolog.noteCount + (cg)->main.noteCount + 1; \
|
||||
if ((cg)->prolog.noteCount && \
|
||||
(cg)->prolog.currentLine != (cg)->firstLine) { \
|
||||
if (diff_ > SN_DELTA_MASK) \
|
||||
cnt += JS_HOWMANY(diff_ - SN_DELTA_MASK, SN_XDELTA_MASK); \
|
||||
cnt += 2 + (((cg)->firstLine > SN_3BYTE_OFFSET_MASK) << 1); \
|
||||
} else { \
|
||||
if (cg->main.noteCount) { \
|
||||
jssrcnote *sn_ = (cg)->main.notes; \
|
||||
ptrdiff_t delta_ = SN_IS_XDELTA(sn_) \
|
||||
? SN_XDELTA_MASK - (*sn_ & SN_XDELTA_MASK) \
|
||||
: SN_DELTA_MASK - (*sn_ & SN_DELTA_MASK); \
|
||||
diff_ -= JS_MIN(delta_, diff_); \
|
||||
} \
|
||||
if (diff_) \
|
||||
cnt += JS_HOWMANY(diff_, SN_XDELTA_MASK); \
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user