Remove JSOP_NOTRACE, rename JSOP_TRACE -> JSOP_LOOPHEAD, bug 706611. r=dvander

This commit is contained in:
Brian Hackett 2011-12-01 15:13:51 -08:00
Родитель 56ac104d63
Коммит b700b5438f
13 изменённых файлов: 84 добавлений и 106 удалений

Просмотреть файл

@ -126,7 +126,6 @@ BytecodeEmitter::BytecodeEmitter(Parser *parser, uintN lineno)
globalMap(parser->context),
closedArgs(parser->context),
closedVars(parser->context),
traceIndex(0),
typesetCount(0)
{
flags = TCF_COMPILING;
@ -1450,7 +1449,7 @@ EmitTraceOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *nextpn)
{
if (nextpn) {
/*
* Try to give the JSOP_TRACE the same line number as the next
* Try to give the JSOP_LOOPHEAD the same line number as the next
* instruction. nextpn is often a block, in which case the next
* instruction typically comes from the first statement inside.
*/
@ -1461,10 +1460,7 @@ EmitTraceOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *nextpn)
return -1;
}
uint32 index = bce->traceIndex;
if (index < UINT16_MAX)
bce->traceIndex++;
return Emit3(cx, bce, JSOP_TRACE, UINT16_HI(index), UINT16_LO(index));
return Emit1(cx, bce, JSOP_LOOPHEAD);
}
/*
@ -5510,7 +5506,7 @@ EmitForIn(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
if (jmp < 0)
return false;
intN noteIndex2 = NewSrcNote(cx, bce, SRC_TRACE);
intN noteIndex2 = NewSrcNote(cx, bce, SRC_LOOPHEAD);
if (noteIndex2 < 0)
return false;
@ -5651,7 +5647,7 @@ EmitNormalFor(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
top = bce->offset();
SET_STATEMENT_TOP(&stmtInfo, top);
intN noteIndex2 = NewSrcNote(cx, bce, SRC_TRACE);
intN noteIndex2 = NewSrcNote(cx, bce, SRC_LOOPHEAD);
if (noteIndex2 < 0)
return false;
@ -5975,7 +5971,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
jmp = EmitJump(cx, bce, JSOP_GOTO, 0);
if (jmp < 0)
return JS_FALSE;
noteIndex2 = NewSrcNote(cx, bce, SRC_TRACE);
noteIndex2 = NewSrcNote(cx, bce, SRC_LOOPHEAD);
if (noteIndex2 < 0)
return JS_FALSE;
top = EmitTraceOp(cx, bce, pn->pn_right);
@ -6006,7 +6002,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (noteIndex < 0 || Emit1(cx, bce, JSOP_NOP) < 0)
return JS_FALSE;
noteIndex2 = NewSrcNote(cx, bce, SRC_TRACE);
noteIndex2 = NewSrcNote(cx, bce, SRC_LOOPHEAD);
if (noteIndex2 < 0)
return JS_FALSE;

Просмотреть файл

@ -674,7 +674,6 @@ struct BytecodeEmitter : public TreeContext
SlotVector closedArgs;
SlotVector closedVars;
uint16 traceIndex; /* index for the next JSOP_TRACE instruction */
uint16 typesetCount; /* Number of JOF_TYPESET opcodes generated */
BytecodeEmitter(Parser *parser, uintN lineno);
@ -957,7 +956,7 @@ enum SrcNoteType {
SRC_WHILE = 4, /* JSOP_GOTO to for or while loop condition
from before loop, else JSOP_NOP at top of
do-while loop */
SRC_TRACE = 4, /* For JSOP_TRACE; includes distance to loop end */
SRC_LOOPHEAD = 4, /* For JSOP_LOOPHEAD; includes distance to loop end */
SRC_CONTINUE = 5, /* JSOP_GOTO is a continue, not a break;
also used on JSOP_ENDINIT if extra comma
at end of array literal: [1,2,,];

Просмотреть файл

@ -20,14 +20,14 @@ f3()
// bug 657984 #2
function f4(){ for(y in x); }
trap(f4, 10, '')
trap(f4, 8, '')
f4()
// bug 658464
function f5() {
for ([, x] in 0) {}
}
trap(f5, 9, '')
trap(f5, 7, '')
f5()
// bug 658465
@ -60,7 +60,7 @@ f9 = (function() {
for each(let w in []) {}
}
})
trap(f9, 27, undefined);
trap(f9, 22, undefined);
for (b in f9())
(function() {})()
@ -75,5 +75,5 @@ try { f10() } catch (e) {}
// bug 659337
f11 = Function("for (x = 0; x < 6; x++) { gc() }");
trap(f11, 25, '');
trap(f11, 23, '');
f11()

Просмотреть файл

@ -11,5 +11,5 @@ f = (function() {
} catch (e) {}
}
})
trap(f, 54, undefined);
trap(f, 52, undefined);
f()

Просмотреть файл

@ -93,9 +93,6 @@ ScriptAnalysis::addJump(JSContext *cx, unsigned offset,
jsbytecode *pc = script->code + offset;
UntrapOpcode untrap(cx, script, pc);
if (JSOp(*pc) == JSOP_TRACE || JSOp(*pc) == JSOP_NOTRACE)
code->loopHead = true;
/* Scripts containing loops are never inlined. */
isInlineable = false;
@ -669,7 +666,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
JSOp op = (JSOp) *pc;
if ((op == JSOP_TRACE || op == JSOP_NOTRACE) && code->loop) {
if (op == JSOP_LOOPHEAD && code->loop) {
/*
* This is the head of a loop, we need to go and make sure that any
* variables live at the head are live at the backedge and points prior.
@ -816,7 +813,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
#ifdef DEBUG
JSOp nop = JSOp(script->code[targetOffset]);
JS_ASSERT(nop == JSOP_TRACE || nop == JSOP_NOTRACE || nop == JSOP_TRAP);
JS_ASSERT(nop == JSOP_LOOPHEAD || nop == JSOP_TRAP);
#endif
/*
@ -1173,7 +1170,7 @@ ScriptAnalysis::analyzeSSA(JSContext *cx)
PodZero(stack + stackDepth, code->stackDepth - stackDepth);
stackDepth = code->stackDepth;
if ((op == JSOP_TRACE || op == JSOP_NOTRACE) && code->loop) {
if (op == JSOP_LOOPHEAD && code->loop) {
/*
* Make sure there is a pending value array for phi nodes at the
* loop head. We won't be able to clear these until we reach the

Просмотреть файл

@ -98,9 +98,6 @@ class Bytecode
/* Whether there are any incoming jumps to this instruction. */
bool jumpTarget : 1;
/* There is a backwards jump to this instruction. */
bool loopHead : 1;
/* Whether there is fallthrough to this instruction from a non-branching instruction. */
bool fallthrough : 1;

Просмотреть файл

@ -3386,8 +3386,7 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
/* Nop bytecodes. */
case JSOP_POP:
case JSOP_NOP:
case JSOP_TRACE:
case JSOP_NOTRACE:
case JSOP_LOOPHEAD:
case JSOP_GOTO:
case JSOP_GOTOX:
case JSOP_IFEQ:

Просмотреть файл

@ -1930,13 +1930,9 @@ ADD_EMPTY_CASE(JSOP_STARTXML)
ADD_EMPTY_CASE(JSOP_STARTXMLEXPR)
#endif
ADD_EMPTY_CASE(JSOP_NULLBLOCKCHAIN)
ADD_EMPTY_CASE(JSOP_LOOPHEAD)
END_EMPTY_CASES
BEGIN_CASE(JSOP_TRACE)
BEGIN_CASE(JSOP_NOTRACE)
/* No-op */
END_CASE(JSOP_TRACE)
BEGIN_CASE(JSOP_LABEL)
END_CASE(JSOP_LABEL)
@ -1946,7 +1942,7 @@ END_CASE(JSOP_LABELX)
check_backedge:
{
CHECK_BRANCH();
if (op != JSOP_NOTRACE && op != JSOP_TRACE)
if (op != JSOP_LOOPHEAD)
DO_OP();
#ifdef JS_METHODJIT

Просмотреть файл

@ -4237,7 +4237,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
*/
pc2 = pc + len;
op = JSOp(*pc2);
if (op == JSOP_TRACE || op == JSOP_NOP)
if (op == JSOP_LOOPHEAD || op == JSOP_NOP)
pc2 += JSOP_NOP_LENGTH;
LOCAL_ASSERT(pc2 < endpc ||
endpc < outer->code + outer->length);
@ -5482,13 +5482,10 @@ CallResultEscapes(jsbytecode *pc)
/*
* If we see any of these sequences, the result is unused:
* - call / pop
* - call / trace / pop
*
* If we see any of these sequences, the result is only tested for nullness:
* - call / ifeq
* - call / trace / ifeq
* - call / not / ifeq
* - call / trace / not / ifeq
*/
if (*pc != JSOP_CALL)
@ -5496,9 +5493,6 @@ CallResultEscapes(jsbytecode *pc)
pc += JSOP_CALL_LENGTH;
if (*pc == JSOP_TRACE)
pc += JSOP_TRACE_LENGTH;
if (*pc == JSOP_POP)
return false;

Просмотреть файл

@ -281,8 +281,8 @@ OPDEF(JSOP_LABELX, 107,"labelx", NULL, 5, 0, 0, 0, JOF_JUMPX)
/* Like JSOP_FUNAPPLY but for f.call instead of f.apply. */
OPDEF(JSOP_FUNCALL, 108,"funcall", NULL, 3, -1, 1, 18, JOF_UINT16|JOF_INVOKE|JOF_TYPESET)
/* This opcode stores an index that is unique to the given loop. */
OPDEF(JSOP_TRACE, 109,"trace", NULL, 3, 0, 0, 0, JOF_UINT16)
/* This opcode is the target of the backwards jump for some loop. */
OPDEF(JSOP_LOOPHEAD, 109,"loophead", NULL, 1, 0, 0, 0, JOF_BYTE)
/* ECMA-compliant assignment ops. */
OPDEF(JSOP_BINDNAME, 110,"bindname", NULL, 3, 0, 1, 0, JOF_ATOM|JOF_NAME|JOF_SET)
@ -434,13 +434,12 @@ OPDEF(JSOP_TOXML, 176,"toxml", NULL, 1, 1, 1, 19, JOF_BYTE)
OPDEF(JSOP_TOXMLLIST, 177,"toxmllist", NULL, 1, 1, 1, 19, JOF_BYTE)
OPDEF(JSOP_XMLTAGEXPR, 178,"xmltagexpr", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_XMLELTEXPR, 179,"xmleltexpr", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_NOTRACE, 180,"notrace", NULL, 3, 0, 0, 0, JOF_UINT16)
OPDEF(JSOP_XMLCDATA, 181,"xmlcdata", NULL, 3, 0, 1, 19, JOF_ATOM)
OPDEF(JSOP_XMLCOMMENT, 182,"xmlcomment", NULL, 3, 0, 1, 19, JOF_ATOM)
OPDEF(JSOP_XMLPI, 183,"xmlpi", NULL, 3, 1, 1, 19, JOF_ATOM)
OPDEF(JSOP_DELDESC, 184,"deldesc", NULL, 1, 2, 1, 15, JOF_BYTE|JOF_ELEM|JOF_DEL)
OPDEF(JSOP_XMLCDATA, 180,"xmlcdata", NULL, 3, 0, 1, 19, JOF_ATOM)
OPDEF(JSOP_XMLCOMMENT, 181,"xmlcomment", NULL, 3, 0, 1, 19, JOF_ATOM)
OPDEF(JSOP_XMLPI, 182,"xmlpi", NULL, 3, 1, 1, 19, JOF_ATOM)
OPDEF(JSOP_DELDESC, 183,"deldesc", NULL, 1, 2, 1, 15, JOF_BYTE|JOF_ELEM|JOF_DEL)
OPDEF(JSOP_CALLPROP, 185,"callprop", NULL, 3, 1, 2, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_CALLOP|JOF_TMPSLOT3)
OPDEF(JSOP_CALLPROP, 184,"callprop", NULL, 3, 1, 2, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_CALLOP|JOF_TMPSLOT3)
/*
* These opcodes contain a reference to the current blockChain object.
@ -449,13 +448,13 @@ OPDEF(JSOP_CALLPROP, 185,"callprop", NULL, 3, 1, 2, 18, JOF_ATOM|J
* does not permit NULL object references, since it stores an index into a table of
* objects.
*/
OPDEF(JSOP_BLOCKCHAIN, 186,"blockchain", NULL, 3, 0, 0, 0, JOF_OBJECT)
OPDEF(JSOP_NULLBLOCKCHAIN,187,"nullblockchain",NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_BLOCKCHAIN, 185,"blockchain", NULL, 3, 0, 0, 0, JOF_OBJECT)
OPDEF(JSOP_NULLBLOCKCHAIN,186,"nullblockchain",NULL, 1, 0, 0, 0, JOF_BYTE)
/*
* Opcode to hold 24-bit immediate integer operands.
*/
OPDEF(JSOP_UINT24, 188,"uint24", NULL, 4, 0, 1, 16, JOF_UINT24)
OPDEF(JSOP_UINT24, 187,"uint24", NULL, 4, 0, 1, 16, JOF_UINT24)
/*
* Opcodes to allow 24-bit atom or object indexes. Whenever an index exceeds
@ -463,126 +462,126 @@ OPDEF(JSOP_UINT24, 188,"uint24", NULL, 4, 0, 1, 16, JOF_UINT24
* JSOP_INDEXBASE and JSOP_RESETBASE to provide the upper bits of the index.
* See jsemit.c, EmitIndexOp.
*/
OPDEF(JSOP_INDEXBASE, 189,"indexbase", NULL, 2, 0, 0, 0, JOF_UINT8|JOF_INDEXBASE)
OPDEF(JSOP_RESETBASE, 190,"resetbase", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_RESETBASE0, 191,"resetbase0", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_INDEXBASE, 188,"indexbase", NULL, 2, 0, 0, 0, JOF_UINT8|JOF_INDEXBASE)
OPDEF(JSOP_RESETBASE, 189,"resetbase", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_RESETBASE0, 190,"resetbase0", NULL, 1, 0, 0, 0, JOF_BYTE)
/*
* Opcodes to help the decompiler deal with XML.
*/
OPDEF(JSOP_STARTXML, 192,"startxml", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_STARTXMLEXPR, 193,"startxmlexpr",NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_STARTXML, 191,"startxml", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_STARTXMLEXPR, 192,"startxmlexpr",NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_CALLELEM, 194, "callelem", NULL, 1, 2, 2, 18, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC|JOF_CALLOP)
OPDEF(JSOP_CALLELEM, 193, "callelem", NULL, 1, 2, 2, 18, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC|JOF_CALLOP)
/*
* Stop interpretation, emitted at end of script to save the threaded bytecode
* interpreter an extra branch test on every DO_NEXT_OP (see jsinterp.c).
*/
OPDEF(JSOP_STOP, 195,"stop", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_STOP, 194,"stop", NULL, 1, 0, 0, 0, JOF_BYTE)
/*
* Get an extant property value, throwing ReferenceError if the identified
* property does not exist.
*/
OPDEF(JSOP_GETXPROP, 196,"getxprop", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET)
OPDEF(JSOP_GETXPROP, 195,"getxprop", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET)
OPDEF(JSOP_CALLXMLNAME, 197, "callxmlname", NULL, 1, 1, 2, 19, JOF_BYTE|JOF_CALLOP)
OPDEF(JSOP_CALLXMLNAME, 196, "callxmlname", NULL, 1, 1, 2, 19, JOF_BYTE|JOF_CALLOP)
/*
* Specialized JSOP_TYPEOF to avoid reporting undefined for typeof(0, undef).
*/
OPDEF(JSOP_TYPEOFEXPR, 198,"typeofexpr", NULL, 1, 1, 1, 15, JOF_BYTE|JOF_DETECTING)
OPDEF(JSOP_TYPEOFEXPR, 197,"typeofexpr", NULL, 1, 1, 1, 15, JOF_BYTE|JOF_DETECTING)
/*
* Block-local scope support.
*/
OPDEF(JSOP_ENTERBLOCK, 199,"enterblock", NULL, 3, 0, -1, 0, JOF_OBJECT)
OPDEF(JSOP_LEAVEBLOCK, 200,"leaveblock", NULL, 5, -1, 0, 0, JOF_UINT16)
OPDEF(JSOP_ENTERBLOCK, 198,"enterblock", NULL, 3, 0, -1, 0, JOF_OBJECT)
OPDEF(JSOP_LEAVEBLOCK, 199,"leaveblock", NULL, 5, -1, 0, 0, JOF_UINT16)
/* Jump to target if top of stack value isn't callable. */
OPDEF(JSOP_IFCANTCALLTOP, 201,"ifcantcalltop",NULL, 3, 1, 1, 0, JOF_JUMP|JOF_DETECTING)
OPDEF(JSOP_IFCANTCALLTOP, 200,"ifcantcalltop",NULL, 3, 1, 1, 0, JOF_JUMP|JOF_DETECTING)
/* Throws a TypeError if the value at the top of the stack is not primitive. */
OPDEF(JSOP_PRIMTOP, 202,"primtop", NULL, 2, 1, 1, 0, JOF_INT8)
OPDEF(JSOP_PRIMTOP, 201,"primtop", NULL, 2, 1, 1, 0, JOF_INT8)
/*
* Generator and array comprehension support.
*/
OPDEF(JSOP_GENERATOR, 203,"generator", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_YIELD, 204,"yield", NULL, 1, 1, 1, 1, JOF_BYTE)
OPDEF(JSOP_ARRAYPUSH, 205,"arraypush", NULL, 3, 1, 0, 3, JOF_LOCAL)
OPDEF(JSOP_GENERATOR, 202,"generator", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_YIELD, 203,"yield", NULL, 1, 1, 1, 1, JOF_BYTE)
OPDEF(JSOP_ARRAYPUSH, 204,"arraypush", NULL, 3, 1, 0, 3, JOF_LOCAL)
/*
* Get the built-in function::foo namespace and push it.
*/
OPDEF(JSOP_GETFUNNS, 206,"getfunns", NULL, 1, 0, 1, 19, JOF_BYTE)
OPDEF(JSOP_GETFUNNS, 205,"getfunns", NULL, 1, 0, 1, 19, JOF_BYTE)
/*
* Variant of JSOP_ENUMELEM for destructuring const (const [a, b] = ...).
*/
OPDEF(JSOP_ENUMCONSTELEM, 207,"enumconstelem",NULL, 1, 3, 0, 3, JOF_BYTE|JOF_SET)
OPDEF(JSOP_ENUMCONSTELEM, 206,"enumconstelem",NULL, 1, 3, 0, 3, JOF_BYTE|JOF_SET)
/*
* Variant of JSOP_LEAVEBLOCK has a result on the stack above the locals,
* which must be moved down when the block pops.
*/
OPDEF(JSOP_LEAVEBLOCKEXPR,208,"leaveblockexpr",NULL, 5, -1, 1, 3, JOF_UINT16)
OPDEF(JSOP_LEAVEBLOCKEXPR,207,"leaveblockexpr",NULL, 5, -1, 1, 3, JOF_UINT16)
\
/*
* Optimize atom segments 1-3. These must be followed by JSOP_RESETBASE0 after
* the opcode that they prefix.
*/
OPDEF(JSOP_INDEXBASE1, 209,"indexbase1", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
OPDEF(JSOP_INDEXBASE2, 210,"indexbase2", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
OPDEF(JSOP_INDEXBASE3, 211,"indexbase3", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
OPDEF(JSOP_INDEXBASE1, 208,"indexbase1", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
OPDEF(JSOP_INDEXBASE2, 209,"indexbase2", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
OPDEF(JSOP_INDEXBASE3, 210,"indexbase3", NULL, 1, 0, 0, 0, JOF_BYTE |JOF_INDEXBASE)
OPDEF(JSOP_CALLGNAME, 212, "callgname", NULL, 3, 0, 2, 19, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_CALLOP|JOF_GNAME)
OPDEF(JSOP_CALLLOCAL, 213, "calllocal", NULL, 3, 0, 2, 19, JOF_LOCAL|JOF_NAME|JOF_CALLOP)
OPDEF(JSOP_CALLARG, 214, "callarg", NULL, 3, 0, 2, 19, JOF_QARG |JOF_NAME|JOF_CALLOP)
OPDEF(JSOP_BINDGNAME, 215, "bindgname", NULL, 3, 0, 1, 0, JOF_ATOM|JOF_NAME|JOF_SET|JOF_GNAME)
OPDEF(JSOP_CALLGNAME, 211, "callgname", NULL, 3, 0, 2, 19, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_CALLOP|JOF_GNAME)
OPDEF(JSOP_CALLLOCAL, 212, "calllocal", NULL, 3, 0, 2, 19, JOF_LOCAL|JOF_NAME|JOF_CALLOP)
OPDEF(JSOP_CALLARG, 213, "callarg", NULL, 3, 0, 2, 19, JOF_QARG |JOF_NAME|JOF_CALLOP)
OPDEF(JSOP_BINDGNAME, 214, "bindgname", NULL, 3, 0, 1, 0, JOF_ATOM|JOF_NAME|JOF_SET|JOF_GNAME)
/*
* Opcodes to hold 8-bit and 32-bit immediate integer operands.
*/
OPDEF(JSOP_INT8, 216, "int8", NULL, 2, 0, 1, 16, JOF_INT8)
OPDEF(JSOP_INT32, 217, "int32", NULL, 5, 0, 1, 16, JOF_INT32)
OPDEF(JSOP_INT8, 215, "int8", NULL, 2, 0, 1, 16, JOF_INT8)
OPDEF(JSOP_INT32, 216, "int32", NULL, 5, 0, 1, 16, JOF_INT32)
/*
* Get the value of the 'length' property from a stacked object.
*/
OPDEF(JSOP_LENGTH, 218, "length", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET)
OPDEF(JSOP_LENGTH, 217, "length", NULL, 3, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET)
/*
* Push a JSVAL_HOLE value onto the stack, representing an omitted property in
* an array literal (e.g. property 0 in the array [, 1]). This opcode is used
* with the JSOP_NEWARRAY opcode.
*/
OPDEF(JSOP_HOLE, 219, "hole", NULL, 1, 0, 1, 0, JOF_BYTE)
OPDEF(JSOP_HOLE, 218, "hole", NULL, 1, 0, 1, 0, JOF_BYTE)
/*
* Variants of JSOP_{DEF{,LOCAL}FUN,LAMBDA} optimized for the flat closure case.
*/
OPDEF(JSOP_DEFFUN_FC, 220,"deffun_fc", NULL, 3, 0, 0, 0, JOF_OBJECT|JOF_DECLARING)
OPDEF(JSOP_DEFLOCALFUN_FC,221,"deflocalfun_fc",NULL, 5, 0, 0, 0, JOF_SLOTOBJECT|JOF_DECLARING|JOF_TMPSLOT)
OPDEF(JSOP_LAMBDA_FC, 222,"lambda_fc", NULL, 3, 0, 1, 19, JOF_OBJECT)
OPDEF(JSOP_DEFFUN_FC, 219,"deffun_fc", NULL, 3, 0, 0, 0, JOF_OBJECT|JOF_DECLARING)
OPDEF(JSOP_DEFLOCALFUN_FC,220,"deflocalfun_fc",NULL, 5, 0, 0, 0, JOF_SLOTOBJECT|JOF_DECLARING|JOF_TMPSLOT)
OPDEF(JSOP_LAMBDA_FC, 221,"lambda_fc", NULL, 3, 0, 1, 19, JOF_OBJECT)
/*
* Ensure that the value on the top of the stack is an object. The one
* argument is an error message, defined in js.msg, that takes one parameter
* (the decompilation of the primitive value).
*/
OPDEF(JSOP_OBJTOP, 223,"objtop", NULL, 3, 0, 0, 0, JOF_UINT16)
OPDEF(JSOP_OBJTOP, 222,"objtop", NULL, 3, 0, 0, 0, JOF_UINT16)
/*
* Joined function object as method optimization support.
*/
OPDEF(JSOP_SETMETHOD, 224,"setmethod", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
OPDEF(JSOP_INITMETHOD, 225,"initmethod", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
OPDEF(JSOP_UNBRAND, 226,"unbrand", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_UNBRANDTHIS, 227,"unbrandthis", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_SETMETHOD, 223,"setmethod", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
OPDEF(JSOP_INITMETHOD, 224,"initmethod", NULL, 3, 2, 1, 3, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING)
OPDEF(JSOP_UNBRAND, 225,"unbrand", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_UNBRANDTHIS, 226,"unbrandthis", NULL, 1, 0, 0, 0, JOF_BYTE)
OPDEF(JSOP_SHARPINIT, 228,"sharpinit", NULL, 3, 0, 0, 0, JOF_UINT16|JOF_SHARPSLOT)
OPDEF(JSOP_SHARPINIT, 227,"sharpinit", NULL, 3, 0, 0, 0, JOF_UINT16|JOF_SHARPSLOT)
/* Pop the stack, convert to a jsid (int or string), and push back. */
OPDEF(JSOP_TOID, 229, "toid", NULL, 1, 1, 1, 0, JOF_BYTE)
OPDEF(JSOP_TOID, 228, "toid", NULL, 1, 1, 1, 0, JOF_BYTE)

Просмотреть файл

@ -226,7 +226,7 @@ JS_XDRFindClassById(JSXDRState *xdr, uint32 id);
* and saved versions. If deserialization fails, the data should be
* invalidated if possible.
*/
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 98)
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 99)
/*
* Library-private functions.

Просмотреть файл

@ -958,7 +958,8 @@ mjit::Compiler::finishThisUp(JITScript **jitp)
Bytecode *opinfo = analysis->maybeCode(i);
if (opinfo && opinfo->safePoint) {
/* loopEntries cover any safe points which are at loop heads. */
if (!cx->typeInferenceEnabled() || !opinfo->loopHead)
JSOp op = js_GetOpcode(cx, script, script->code + i);
if (!cx->typeInferenceEnabled() || op != JSOP_LOOPHEAD)
nNmapLive++;
}
}
@ -1021,7 +1022,8 @@ mjit::Compiler::finishThisUp(JITScript **jitp)
for (size_t i = 0; i < script->length; i++) {
Bytecode *opinfo = analysis->maybeCode(i);
if (opinfo && opinfo->safePoint) {
if (cx->typeInferenceEnabled() && opinfo->loopHead)
JSOp op = js_GetOpcode(cx, script, script->code + i);
if (cx->typeInferenceEnabled() && op == JSOP_LOOPHEAD)
continue;
Label L = jumpMap[i];
JS_ASSERT(L.isSet());
@ -1581,7 +1583,7 @@ mjit::Compiler::generateMethod()
* of the loop so sync, branch, and fix it up after the loop
* has been processed.
*/
if (cx->typeInferenceEnabled() && analysis->getCode(PC).loopHead) {
if (cx->typeInferenceEnabled() && op == JSOP_LOOPHEAD) {
frame.syncAndForgetEverything();
Jump j = masm.jump();
if (!startLoop(PC, j, PC))
@ -1734,7 +1736,7 @@ mjit::Compiler::generateMethod()
*/
jsbytecode *next = PC + js_CodeSpec[op].length;
if (cx->typeInferenceEnabled() && analysis->maybeCode(next) &&
analysis->getCode(next).loopHead) {
js_GetOpcode(cx, script, next) == JSOP_LOOPHEAD) {
frame.syncAndForgetEverything();
Jump j = masm.jump();
if (!startLoop(next, j, target))
@ -2811,15 +2813,14 @@ mjit::Compiler::generateMethod()
}
END_CASE(JSOP_LAMBDA_FC)
BEGIN_CASE(JSOP_TRACE)
BEGIN_CASE(JSOP_NOTRACE)
BEGIN_CASE(JSOP_LOOPHEAD)
{
if (analysis->jumpTarget(PC)) {
interruptCheckHelper();
recompileCheckHelper();
}
}
END_CASE(JSOP_TRACE)
END_CASE(JSOP_LOOPHEAD)
BEGIN_CASE(JSOP_DEBUGGER)
{

Просмотреть файл

@ -1782,7 +1782,7 @@ LoopState::analyzeLoopBody(unsigned frame)
skipAnalysis = true;
/* Analyze the entire script for frames inlined in the loop body. */
unsigned start = (frame == CrossScriptSSA::OUTER_FRAME) ? lifetime->head + JSOP_TRACE_LENGTH : 0;
unsigned start = (frame == CrossScriptSSA::OUTER_FRAME) ? lifetime->head + JSOP_LOOPHEAD_LENGTH : 0;
unsigned end = (frame == CrossScriptSSA::OUTER_FRAME) ? lifetime->backedge : script->length;
unsigned offset = start;
@ -1796,11 +1796,12 @@ LoopState::analyzeLoopBody(unsigned frame)
continue;
}
JSOp op = JSOp(*pc);
/* Don't do any hoisting for outer loops in case of nesting. */
if (opinfo->loopHead)
if (op == JSOP_LOOPHEAD)
skipAnalysis = true;
JSOp op = JSOp(*pc);
switch (op) {
case JSOP_CALL: {
@ -1895,8 +1896,7 @@ LoopState::analyzeLoopBody(unsigned frame)
unknownModset = true;
break;
case JSOP_TRACE:
case JSOP_NOTRACE:
case JSOP_LOOPHEAD:
case JSOP_POP:
case JSOP_ZERO:
case JSOP_ONE: