Revision: 18072
Author:   [email protected]
Date:     Tue Nov 26 12:29:47 2013 UTC
Log:      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.

[email protected]

Review URL: https://codereview.chromium.org/88053002
http://code.google.com/p/v8/source/detail?r=18072

Modified:
 /branches/bleeding_edge/src/math.js
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/runtime.h
 /branches/bleeding_edge/src/v8-counters.h

=======================================
--- /branches/bleeding_edge/src/math.js Mon Nov 25 12:50:52 2013 UTC
+++ /branches/bleeding_edge/src/math.js Tue Nov 26 12:29:47 2013 UTC
@@ -74,7 +74,7 @@

 // 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 @@
     "imul", MathImul
   ));

+  %SetInlineBuiltinFlag(MathCeil);
   %SetInlineBuiltinFlag(MathRandom);
   %SetInlineBuiltinFlag(MathSin);
   %SetInlineBuiltinFlag(MathCos);
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Nov 25 14:41:46 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Tue Nov 26 12:29:47 2013 UTC
@@ -7699,16 +7699,6 @@
   }
   return isolate->heap()->AllocateHeapNumber(result);
 }
-
-
-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) {
=======================================
--- /branches/bleeding_edge/src/runtime.h       Mon Nov 25 14:41:46 2013 UTC
+++ /branches/bleeding_edge/src/runtime.h       Tue Nov 26 12:29:47 2013 UTC
@@ -179,7 +179,6 @@
   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) \
=======================================
--- /branches/bleeding_edge/src/v8-counters.h   Fri Nov 22 17:37:34 2013 UTC
+++ /branches/bleeding_edge/src/v8-counters.h   Tue Nov 26 12:29:47 2013 UTC
@@ -242,7 +242,6 @@
   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)                                        \

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to