Fix JOF_XMLNAME, etc., interrogation to mask the mode bits and compare (381504, r=mrbkap).

This commit is contained in:
brendan@mozilla.org 2007-05-22 23:04:18 -07:00
parent 02bf41c8a3
commit a6b6b99a67
3 changed files with 15 additions and 12 deletions

View File

@ -3263,7 +3263,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
(pc = cx->fp->pc)) {
cs = &js_CodeSpec[*pc];
format = cs->format;
if ((format & JOF_MODEMASK) != JOF_NAME)
if (JOF_MODE(format) != JOF_NAME)
flags |= JSRESOLVE_QUALIFIED;
if ((format & JOF_ASSIGNING) ||
(cx->fp->flags & JSFRAME_ASSIGNING)) {

View File

@ -1359,8 +1359,7 @@ DecompileDestructuringLHS(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc,
todo = SprintCString(&ss->sprinter, lval);
} else {
todo = Sprint(&ss->sprinter,
(js_CodeSpec[ss->opcodes[ss->top+1]].format
& JOF_XMLNAME)
(JOF_OPMODE(ss->opcodes[ss->top+1]) == JOF_XMLNAME)
? "%s.%s"
: "%s[%s]",
lval, xval);
@ -1771,7 +1770,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
(pc == startpc && cs->nuses != 0)) &&
format & (JOF_SET|JOF_DEL|JOF_INCDEC|JOF_IMPORT|JOF_FOR|
JOF_VARPROP)) {
mode = (format & JOF_MODEMASK);
mode = JOF_MODE(format);
if (mode == JOF_NAME) {
/*
* JOF_NAME does not imply JOF_CONST, so we must check for
@ -3072,7 +3071,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
} else if (xval) {
LOCAL_ASSERT(*xval != '\0');
ok = (Sprint(&ss->sprinter,
(js_CodeSpec[lastop].format & JOF_XMLNAME)
(JOF_OPMODE(lastop) == JOF_XMLNAME)
? ".%s"
: "[%s]",
xval)
@ -3384,7 +3383,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
if (*xval == '\0')
goto do_delete_lval;
todo = Sprint(&ss->sprinter,
(js_CodeSpec[lastop].format & JOF_XMLNAME)
(JOF_OPMODE(lastop) == JOF_XMLNAME)
? "%s %s.%s"
: "%s %s[%s]",
js_delete_str, lval, xval);
@ -3459,7 +3458,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
lval = POP_STR();
if (*xval != '\0') {
todo = Sprint(&ss->sprinter,
(js_CodeSpec[lastop].format & JOF_XMLNAME)
(JOF_OPMODE(lastop) == JOF_XMLNAME)
? predot_format
: preindex_format,
js_incop_strs[!(cs->format & JOF_INC)],
@ -3520,7 +3519,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
lval = POP_STR();
if (*xval != '\0') {
todo = Sprint(&ss->sprinter,
(js_CodeSpec[lastop].format & JOF_XMLNAME)
(JOF_OPMODE(lastop) == JOF_XMLNAME)
? postdot_format
: postindex_format,
lval, xval,
@ -3614,7 +3613,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
todo = Sprint(&ss->sprinter, "%s", lval);
} else {
todo = Sprint(&ss->sprinter,
(js_CodeSpec[lastop].format & JOF_XMLNAME)
(JOF_OPMODE(lastop) == JOF_XMLNAME)
? dot_format
: index_format,
lval, xval);
@ -3633,7 +3632,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
goto do_setlval;
sn = js_GetSrcNote(jp->script, pc - 1);
todo = Sprint(&ss->sprinter,
(cs->format & JOF_XMLNAME)
(JOF_MODE(cs->format) == JOF_XMLNAME)
? "%s.%s %s= %s"
: "%s[%s] %s= %s",
lval, xval,
@ -4100,7 +4099,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
case JSOP_IMPORTELEM:
xval = POP_STR();
op = JSOP_GETELEM;
if (js_CodeSpec[lastop].format & JOF_XMLNAME)
if (JOF_OPMODE(lastop) == JOF_XMLNAME)
goto do_importprop;
lval = POP_STR();
js_printf(jp, "\timport %s[%s];\n", lval, xval);
@ -4913,7 +4912,7 @@ js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v,
cs = &js_CodeSpec[op];
begin = pc;
end = pc + cs->length;
switch (cs->format & JOF_MODEMASK) {
switch (JOF_MODE(cs->format)) {
case JOF_PROP:
case JOF_ELEM:
case JOF_XMLNAME:

View File

@ -114,6 +114,10 @@ typedef enum JSOpLength {
parenthesized statement head */
#define JOF_INVOKE 0x200000 /* JSOP_CALL, JSOP_NEW, JSOP_EVAL */
/* Shorthands for mode from format and mode from opcode. */
#define JOF_MODE(fmt) ((fmt) & JOF_MODEMASK)
#define JOF_OPMODE(op) JOF_MODE(js_CodeSpec[op].format)
#define JOF_TYPE_IS_EXTENDED_JUMP(t) \
((unsigned)((t) - JOF_JUMPX) <= (unsigned)(JOF_LOOKUPSWITCHX - JOF_JUMPX))