зеркало из https://github.com/mozilla/pjs.git
bug 444979 - fixing JSOP_TABLESWITCH to treat -0 as 0
This commit is contained in:
Родитель
2f117159d7
Коммит
9ea73e3823
|
@ -5336,9 +5336,14 @@ js_Interpret(JSContext *cx)
|
||||||
* (This opcode is emitted only for dense jsint-domain switches.)
|
* (This opcode is emitted only for dense jsint-domain switches.)
|
||||||
*/
|
*/
|
||||||
rval = POP_OPND();
|
rval = POP_OPND();
|
||||||
if (!JSVAL_IS_INT(rval))
|
if (JSVAL_IS_INT(rval)) {
|
||||||
|
i = JSVAL_TO_INT(rval);
|
||||||
|
} else if (JSVAL_IS_DOUBLE(rval) && *JSVAL_TO_DOUBLE(rval) == 0) {
|
||||||
|
/* Treat -0 (double) as 0. */
|
||||||
|
i = 0;
|
||||||
|
} else {
|
||||||
DO_NEXT_OP(len);
|
DO_NEXT_OP(len);
|
||||||
i = JSVAL_TO_INT(rval);
|
}
|
||||||
|
|
||||||
pc2 += JUMP_OFFSET_LEN;
|
pc2 += JUMP_OFFSET_LEN;
|
||||||
low = GET_JUMP_OFFSET(pc2);
|
low = GET_JUMP_OFFSET(pc2);
|
||||||
|
@ -5364,9 +5369,14 @@ js_Interpret(JSContext *cx)
|
||||||
* (This opcode is emitted only for dense jsint-domain switches.)
|
* (This opcode is emitted only for dense jsint-domain switches.)
|
||||||
*/
|
*/
|
||||||
rval = POP_OPND();
|
rval = POP_OPND();
|
||||||
if (!JSVAL_IS_INT(rval))
|
if (JSVAL_IS_INT(rval)) {
|
||||||
|
i = JSVAL_TO_INT(rval);
|
||||||
|
} else if (JSVAL_IS_DOUBLE(rval) && *JSVAL_TO_DOUBLE(rval) == 0) {
|
||||||
|
/* Treat -0 (double) as 0. */
|
||||||
|
i = 0;
|
||||||
|
} else {
|
||||||
DO_NEXT_OP(len);
|
DO_NEXT_OP(len);
|
||||||
i = JSVAL_TO_INT(rval);
|
}
|
||||||
|
|
||||||
pc2 += JUMPX_OFFSET_LEN;
|
pc2 += JUMPX_OFFSET_LEN;
|
||||||
low = GET_JUMP_OFFSET(pc2);
|
low = GET_JUMP_OFFSET(pc2);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче