[INFER] Fix parseInt to return integers instead of doubles where possible, rewrite some setNumber calls, bug 662766. r=bhackett

This commit is contained in:
Jan de Mooij
2011-06-08 20:11:42 +02:00
parent e524f14662
commit cb59186efd
3 changed files with 8 additions and 14 deletions

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;
}