Bug 383188: using code spec flag to declare extra slot used for post ++/--. r=brndan

This commit is contained in:
igor%mir2.org 2007-06-05 03:07:38 +00:00
Родитель 991845aae7
Коммит df24f64be9
2 изменённых файлов: 12 добавлений и 14 удалений

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

@ -5807,17 +5807,15 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
}
/*
* Allocate another stack slot for GC protection in case the initial
* value being post-incremented or -decremented is not a number, but
* converts to a jsdouble. In the TOK_NAME cases, op has 0 operand
* uses and 1 definition, so we don't need an extra stack slot -- we
* can use the one allocated for the def.
* Post-increments require an extra slot for GC protection in case
* the initial value being post-incremented or -decremented is not a
* number, but converts to a jsdouble. In the TOK_NAME cases, op has
* 0 operand uses and 1 definition, so we don't need an extra stack
* slot -- we can use the one allocated for the def.
*/
if (pn2->pn_type != TOK_NAME &&
(js_CodeSpec[op].format & JOF_POST) &&
(uintN)depth == cg->maxStackDepth) {
++cg->maxStackDepth;
}
JS_ASSERT(((js_CodeSpec[op].format >> JOF_TMPSLOT_SHIFT) & 1) ==
((js_CodeSpec[op].format & JOF_POST) &&
pn2->pn_type != TOK_NAME));
break;
}

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

@ -151,11 +151,11 @@ OPDEF(JSOP_DECNAME, 44, "decname", NULL, 3, 0, 1, 15, JOF_CONST|
OPDEF(JSOP_DECPROP, 45, "decprop", NULL, 3, 1, 1, 15, JOF_CONST|JOF_PROP|JOF_DEC)
OPDEF(JSOP_DECELEM, 46, "decelem", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_DEC)
OPDEF(JSOP_NAMEINC, 47, "nameinc", NULL, 3, 0, 1, 15, JOF_CONST|JOF_NAME|JOF_INC|JOF_POST)
OPDEF(JSOP_PROPINC, 48, "propinc", NULL, 3, 1, 1, 15, JOF_CONST|JOF_PROP|JOF_INC|JOF_POST)
OPDEF(JSOP_ELEMINC, 49, "eleminc", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_INC|JOF_POST)
OPDEF(JSOP_PROPINC, 48, "propinc", NULL, 3, 1, 1, 15, JOF_CONST|JOF_PROP|JOF_INC|JOF_POST|JOF_TMPSLOT)
OPDEF(JSOP_ELEMINC, 49, "eleminc", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_INC|JOF_POST|JOF_TMPSLOT)
OPDEF(JSOP_NAMEDEC, 50, "namedec", NULL, 3, 0, 1, 15, JOF_CONST|JOF_NAME|JOF_DEC|JOF_POST)
OPDEF(JSOP_PROPDEC, 51, "propdec", NULL, 3, 1, 1, 15, JOF_CONST|JOF_PROP|JOF_DEC|JOF_POST)
OPDEF(JSOP_ELEMDEC, 52, "elemdec", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_DEC|JOF_POST)
OPDEF(JSOP_PROPDEC, 51, "propdec", NULL, 3, 1, 1, 15, JOF_CONST|JOF_PROP|JOF_DEC|JOF_POST|JOF_TMPSLOT)
OPDEF(JSOP_ELEMDEC, 52, "elemdec", NULL, 1, 2, 1, 15, JOF_BYTE |JOF_ELEM|JOF_DEC|JOF_POST|JOF_TMPSLOT)
OPDEF(JSOP_GETPROP, 53, "getprop", NULL, 3, 1, 1, 18, JOF_CONST|JOF_PROP)
OPDEF(JSOP_SETPROP, 54, "setprop", NULL, 3, 2, 1, 3, JOF_CONST|JOF_PROP|JOF_SET|JOF_ASSIGNING|JOF_DETECTING)
OPDEF(JSOP_GETELEM, 55, "getelem", NULL, 1, 2, 1, 18, JOF_BYTE |JOF_ELEM|JOF_LEFTASSOC)