mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 838813 part 3 - Remove SRC_DECL. r=njn.
--HG-- extra : rebase_source : d2b807c7d8b981734db6ffc7735fb71777f307ad
This commit is contained in:
parent
fe5223ba44
commit
8674149cab
@ -3173,7 +3173,6 @@ EmitVariables(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption
|
||||
ptrdiff_t off = -1, noteIndex = -1;
|
||||
ParseNode *next;
|
||||
for (ParseNode *pn2 = pn->pn_head; ; pn2 = next) {
|
||||
bool first = pn2 == pn->pn_head;
|
||||
next = pn2->pn_next;
|
||||
|
||||
ParseNode *pn3;
|
||||
@ -3334,14 +3333,6 @@ EmitVariables(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption
|
||||
}
|
||||
|
||||
JS_ASSERT_IF(pn2->isDefn(), pn3 == pn2->pn_expr);
|
||||
if (first && NewSrcNote2(cx, bce, SRC_DECL,
|
||||
(pn->isOp(JSOP_DEFCONST))
|
||||
? SRC_DECL_CONST
|
||||
: (pn->isOp(JSOP_DEFVAR))
|
||||
? SRC_DECL_VAR
|
||||
: SRC_DECL_LET) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!pn2->pn_cookie.isFree()) {
|
||||
if (!EmitVarOp(cx, pn2, op, bce))
|
||||
return false;
|
||||
@ -4164,7 +4155,7 @@ EmitIf(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
* destructure z
|
||||
* pick 1
|
||||
* pop -1
|
||||
* enterlet0 SRC_DECL + offset to leaveblockexpr
|
||||
* enterlet0
|
||||
* evaluate e +1
|
||||
* leaveblockexpr -3 SRC_PCBASE + offset to evaluate a
|
||||
*
|
||||
@ -4177,8 +4168,6 @@ EmitIf(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
* object from which to find let var names. These forward offsets require
|
||||
* backpatching, which is handled by LetNotes.
|
||||
*
|
||||
* The SRC_DECL offset allows recursive decompilation of 'e'.
|
||||
*
|
||||
* The SRC_PCBASE allows js_DecompileValueGenerator to walk backwards from
|
||||
* JSOP_LEAVEBLOCKEXPR to the beginning of the let and is only needed for
|
||||
* let-expressions.
|
||||
@ -4221,10 +4210,6 @@ EmitLet(JSContext *cx, BytecodeEmitter *bce, ParseNode *pnLet)
|
||||
if (!letNotes.update(cx, bce, bce->offset()))
|
||||
return false;
|
||||
|
||||
ptrdiff_t declNote = NewSrcNote(cx, bce, SRC_DECL);
|
||||
if (declNote < 0)
|
||||
return false;
|
||||
|
||||
ptrdiff_t bodyBegin = bce->offset();
|
||||
if (!EmitEnterBlock(cx, bce, letBody, JSOP_ENTERLET0))
|
||||
return false;
|
||||
@ -4244,13 +4229,7 @@ EmitLet(JSContext *cx, BytecodeEmitter *bce, ParseNode *pnLet)
|
||||
ptrdiff_t bodyEnd = bce->offset();
|
||||
JS_ASSERT(bodyEnd > bodyBegin);
|
||||
|
||||
if (!PopStatementBCE(cx, bce))
|
||||
return false;
|
||||
|
||||
ptrdiff_t o = PackLetData((bodyEnd - bodyBegin) -
|
||||
(JSOP_ENTERLET0_LENGTH + JSOP_LEAVEBLOCK_LENGTH),
|
||||
letNotes.isGroupAssign());
|
||||
return SetSrcNoteOffset(cx, bce, declNote, 0, o);
|
||||
return PopStatementBCE(cx, bce);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4439,12 +4418,6 @@ EmitForIn(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
|
||||
return false;
|
||||
|
||||
ptrdiff_t tmp2 = bce->offset();
|
||||
if (forHead->pn_kid1 && NewSrcNote2(cx, bce, SRC_DECL,
|
||||
(forHead->pn_kid1->isOp(JSOP_DEFVAR))
|
||||
? SRC_DECL_VAR
|
||||
: SRC_DECL_LET) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (Emit1(cx, bce, JSOP_POP) < 0)
|
||||
return false;
|
||||
|
||||
@ -6674,7 +6647,7 @@ CGConstList::finish(ConstArray *array)
|
||||
|
||||
/*
|
||||
* We should try to get rid of offsetBias (always 0 or 1, where 1 is
|
||||
* JSOP_{NOP,POP}_LENGTH), which is used only by SRC_FOR and SRC_DECL.
|
||||
* JSOP_{NOP,POP}_LENGTH), which is used only by SRC_FOR.
|
||||
*/
|
||||
JS_FRIEND_DATA(JSSrcNoteSpec) js_SrcNoteSpec[] = {
|
||||
{"null", 0},
|
||||
|
@ -271,7 +271,6 @@ enum SrcNoteType {
|
||||
array literal: [1,2,,];
|
||||
JSOP_DUP continuing destructuring pattern;
|
||||
JSOP_POP at end of for-in */
|
||||
SRC_DECL = 6, /* type of a declaration (var, const, let*) */
|
||||
SRC_DESTRUCT = 6, /* JSOP_DUP starting a destructuring assignment
|
||||
operation, with SRC_DECL_* offset operand */
|
||||
SRC_PCDELTA = 7, /* distance forward from comma-operator to
|
||||
@ -305,7 +304,7 @@ enum SrcNoteType {
|
||||
};
|
||||
|
||||
/*
|
||||
* Constants for the SRC_DECL source note.
|
||||
* Constants for the SRC_DESTRUCTLET source note.
|
||||
*
|
||||
* NB: the var_prefix array in jsopcode.c depends on these dense indexes from
|
||||
* SRC_DECL_VAR through SRC_DECL_LET.
|
||||
@ -436,28 +435,6 @@ BytecodeEmitter::countFinalSourceNotes()
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/*
|
||||
* To avoid offending js_SrcNoteSpec[SRC_DECL].arity, pack the two data needed
|
||||
* to decompile let into one ptrdiff_t:
|
||||
* offset: offset to the LEAVEBLOCK(EXPR) op (not including ENTER/LEAVE)
|
||||
* groupAssign: whether this was an optimized group assign ([x,y] = [a,b])
|
||||
*/
|
||||
inline ptrdiff_t PackLetData(size_t offset, bool groupAssign)
|
||||
{
|
||||
JS_ASSERT(offset <= (size_t(-1) >> 1));
|
||||
return ptrdiff_t(offset << 1) | ptrdiff_t(groupAssign);
|
||||
}
|
||||
|
||||
inline size_t LetDataToOffset(ptrdiff_t w)
|
||||
{
|
||||
return size_t(w) >> 1;
|
||||
}
|
||||
|
||||
inline bool LetDataToGroupAssign(ptrdiff_t w)
|
||||
{
|
||||
return size_t(w) & 1;
|
||||
}
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
|
@ -56,8 +56,6 @@ using namespace js;
|
||||
using namespace js::gc;
|
||||
|
||||
using js::frontend::IsIdentifier;
|
||||
using js::frontend::LetDataToGroupAssign;
|
||||
using js::frontend::LetDataToOffset;
|
||||
using mozilla::ArrayLength;
|
||||
|
||||
/*
|
||||
|
@ -1753,7 +1753,6 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
|
||||
case SRC_WHILE:
|
||||
case SRC_PCBASE:
|
||||
case SRC_PCDELTA:
|
||||
case SRC_DECL:
|
||||
case SRC_BRACE:
|
||||
Sprint(sp, " offset %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user