This commit is contained in:
Brian Hackett 2011-06-08 18:15:06 -07:00
commit 5eab4fc3dc
3 changed files with 8 additions and 14 deletions

View File

@ -2906,8 +2906,7 @@ array_indexOfHelper(JSContext *cx, JSBool isLast, uintN argc, Value *vp)
if (!StrictlyEqual(cx, *vp, tosearch, &equal))
return JS_FALSE;
if (equal) {
vp->setNumber(i);
if (!vp->isInt32())
if (!vp->setNumber(i))
MarkTypeCallerOverflow(cx);
return JS_TRUE;
}

View File

@ -132,8 +132,7 @@ js_math_abs(JSContext *cx, uintN argc, Value *vp)
if (!ValueToNumber(cx, vp[2], &x))
return JS_FALSE;
z = fabs(x);
vp->setNumber(z);
if (!vp[2].isDouble() && vp->isDouble())
if (!vp->setNumber(z) && !vp[2].isDouble())
types::MarkTypeCallerOverflow(cx);
return JS_TRUE;
}
@ -278,8 +277,7 @@ js_math_ceil(JSContext *cx, uintN argc, Value *vp)
if (!ValueToNumber(cx, vp[2], &x))
return JS_FALSE;
z = js_math_ceil_impl(x);
vp->setNumber(z);
if (!vp->isInt32())
if (!vp->setNumber(z))
types::MarkTypeCallerOverflow(cx);
return JS_TRUE;
}
@ -355,8 +353,7 @@ js_math_floor(JSContext *cx, uintN argc, Value *vp)
if (!ValueToNumber(cx, vp[2], &x))
return JS_FALSE;
z = js_math_floor_impl(x);
vp->setNumber(z);
if (!vp->isInt32())
if (!vp->setNumber(z))
types::MarkTypeCallerOverflow(cx);
return JS_TRUE;
}
@ -630,8 +627,7 @@ js_math_round(JSContext *cx, uintN argc, Value *vp)
if (!ValueToNumber(cx, vp[2], &x))
return JS_FALSE;
z = js_copysign(floor(x + 0.5), x);
vp->setNumber(z);
if (!vp->isInt32())
if (!vp->setNumber(z))
types::MarkTypeCallerOverflow(cx);
return JS_TRUE;
}

View File

@ -443,8 +443,8 @@ num_parseInt(JSContext *cx, uintN argc, Value *vp)
if (vp[2].isDouble() &&
vp[2].toDouble() > -1.0e21 &&
vp[2].toDouble() < 1.0e21) {
vp->setDouble(ParseIntDoubleHelper(vp[2].toDouble()));
MarkTypeCallerOverflow(cx);
if (!vp->setNumber(ParseIntDoubleHelper(vp[2].toDouble())))
MarkTypeCallerOverflow(cx);
return true;
}
}
@ -483,8 +483,7 @@ num_parseInt(JSContext *cx, uintN argc, Value *vp)
return false;
/* Step 15. */
vp->setNumber(number);
if (!vp->isInt32())
if (!vp->setNumber(number))
MarkTypeCallerOverflow(cx);
return true;
}