Implement Math.ceil via Math.floor.

This way we get all the Crankshaft goodness and avoid always going
through the runtime: Less code + even some small speedup in Kraken.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/88053002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18072 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5f2d8bc3
......@@ -74,7 +74,7 @@ function MathAtan2(y, x) {
// ECMA 262 - 15.8.2.6
function MathCeil(x) {
return %Math_ceil(TO_NUMBER_INLINE(x));
return -MathFloor(-x);
}
// ECMA 262 - 15.8.2.7
......@@ -348,6 +348,7 @@ function SetUpMath() {
"imul", MathImul
));
%SetInlineBuiltinFlag(MathCeil);
%SetInlineBuiltinFlag(MathRandom);
%SetInlineBuiltinFlag(MathSin);
%SetInlineBuiltinFlag(MathCos);
......
......@@ -7701,16 +7701,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) {
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_ceil) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_ceil()->Increment();
CONVERT_DOUBLE_ARG_CHECKED(x, 0);
return isolate->heap()->NumberFromDouble(ceiling(x));
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_cos) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
......
......@@ -179,7 +179,6 @@ namespace internal {
F(Math_asin, 1, 1) \
F(Math_atan, 1, 1) \
F(Math_atan2, 2, 1) \
F(Math_ceil, 1, 1) \
F(Math_cos, 1, 1) \
F(Math_exp, 1, 1) \
F(Math_floor, 1, 1) \
......
......@@ -242,7 +242,6 @@ namespace internal {
SC(math_asin, V8.MathAsin) \
SC(math_atan, V8.MathAtan) \
SC(math_atan2, V8.MathAtan2) \
SC(math_ceil, V8.MathCeil) \
SC(math_cos, V8.MathCos) \
SC(math_exp, V8.MathExp) \
SC(math_floor, V8.MathFloor) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment