Fix 312954 "monkey: on HPUX, special case failure when dividing by -0"

git-svn-id: svn://10.0.0.236/trunk@9751 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
norris%netscape.com
1998-09-10 20:27:16 +00:00
parent efc54c518a
commit 8105e6a166
3 changed files with 31 additions and 3 deletions

View File

@@ -1118,7 +1118,7 @@ js_Interpret(JSContext *cx, jsval *result)
#if JS_HAS_SWITCH_STATEMENT
case JSOP_DEFAULT:
POP();
(void) POP();
/* fall through */
#endif
case JSOP_GOTO:
@@ -1661,7 +1661,7 @@ js_Interpret(JSContext *cx, jsval *result)
#if JS_HAS_SWITCH_STATEMENT
case JSOP_CASE:
NEW_EQUALITY_OP(==, JS_FALSE);
POP();
(void) POP();
if (cond) {
len = GET_JUMP_OFFSET(pc);
CHECK_BRANCH(len);
@@ -1848,7 +1848,16 @@ js_Interpret(JSContext *cx, jsval *result)
case JSOP_NEG:
POP_NUMBER(cx, d);
#ifdef HPUX
/*
* Negation of a zero doesn't produce a negative
* zero on HPUX. Perform the operation by bit
* twiddling.
*/
JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT;
#else
d = -d;
#endif
PUSH_NUMBER(cx, d);
break;

View File

@@ -653,6 +653,16 @@ js_strtod(JSContext *cx, const jschar *s, const jschar **ep, jsdouble *dp)
d = *cx->runtime->jsPositiveInfinity;
else if (d == -HUGE_VAL)
d = *cx->runtime->jsNegativeInfinity;
#ifdef HPUX
if (d == 0.0 && negative) {
/*
* "-0", "-1e-2000" come out as positive zero
* here on HPUX. Force a negative zero instead.
*/
JSDOUBLE_HI32(d) = JSDOUBLE_HI32_SIGNBIT;
JSDOUBLE_LO32(d) = 0;
}
#endif
}
free(cstr);

View File

@@ -2704,7 +2704,16 @@ js_FoldConstants(JSContext *cx, JSParseNode *pn)
break;
case JSOP_NEG:
d = -d;
#ifdef HPUX
/*
* Negation of a zero doesn't produce a negative
* zero on HPUX. Perform the operation by bit
* twiddling.
*/
JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT;
#else
d = -d;
#endif
break;
case JSOP_POS: