mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 993075 - Change FinishTakingSrcNotes to return bool and take an outparam for the source note count. r=luke
--HG-- extra : rebase_source : 604fd7221d6fc3cd71e44cecb374640ed82c12f6
This commit is contained in:
parent
19ce8e9d08
commit
cf2dfac89d
@ -6767,10 +6767,10 @@ SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, uns
|
||||
|
||||
/*
|
||||
* Finish taking source notes in cx's notePool.
|
||||
* Returns the final source note count taken, or -1 to indicate an error.
|
||||
* If successful, the final source note count is stored in the out outparam.
|
||||
*/
|
||||
int32_t
|
||||
frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce)
|
||||
bool
|
||||
frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t *out)
|
||||
{
|
||||
JS_ASSERT(bce->current == &bce->main);
|
||||
|
||||
@ -6778,7 +6778,7 @@ frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce)
|
||||
if (prologCount && bce->prolog.currentLine != bce->firstLine) {
|
||||
bce->switchToProlog();
|
||||
if (NewSrcNote2(cx, bce, SRC_SETLINE, (ptrdiff_t)bce->firstLine) < 0)
|
||||
return -1;
|
||||
return false;
|
||||
bce->switchToMain();
|
||||
} else {
|
||||
/*
|
||||
@ -6800,7 +6800,7 @@ frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce)
|
||||
delta = offset;
|
||||
for (;;) {
|
||||
if (!AddToSrcNoteDelta(cx, bce, sn, delta))
|
||||
return -1;
|
||||
return false;
|
||||
offset -= delta;
|
||||
if (offset == 0)
|
||||
break;
|
||||
@ -6813,11 +6813,12 @@ frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce)
|
||||
// The prolog count might have changed, so we can't reuse prologCount.
|
||||
// The + 1 is to account for the final SN_MAKE_TERMINATOR that is appended
|
||||
// when the notes are copied to their final destination by CopySrcNotes.
|
||||
return bce->prolog.notes.length() + bce->main.notes.length() + 1;
|
||||
*out = bce->prolog.notes.length() + bce->main.notes.length() + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
frontend::CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, int32_t nsrcnotes)
|
||||
frontend::CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, uint32_t nsrcnotes)
|
||||
{
|
||||
unsigned prologCount = bce->prolog.notes.length();
|
||||
unsigned mainCount = bce->main.notes.length();
|
||||
|
@ -277,11 +277,11 @@ NewSrcNote3(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type, ptrdif
|
||||
bool
|
||||
AddToSrcNoteDelta(ExclusiveContext *cx, BytecodeEmitter *bce, jssrcnote *sn, ptrdiff_t delta);
|
||||
|
||||
int32_t
|
||||
FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce);
|
||||
bool
|
||||
FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t *out);
|
||||
|
||||
void
|
||||
CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, int32_t nsrcnotes);
|
||||
CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, uint32_t nsrcnotes);
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
@ -2425,8 +2425,8 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
|
||||
|
||||
uint32_t mainLength = bce->offset();
|
||||
uint32_t prologLength = bce->prologOffset();
|
||||
int32_t nsrcnotes = FinishTakingSrcNotes(cx, bce);
|
||||
if (nsrcnotes < 0)
|
||||
uint32_t nsrcnotes;
|
||||
if (!FinishTakingSrcNotes(cx, bce, &nsrcnotes))
|
||||
return false;
|
||||
uint32_t natoms = bce->atomIndices->count();
|
||||
if (!partiallyInit(cx, script,
|
||||
|
Loading…
Reference in New Issue
Block a user