Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(754)

Unified Diff: src/math.js

Issue 990963003: [turbofan] Unify Math.floor / Math.ceil optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 2da38779e7cc31a1f7fcd29c9c83e83f1cbdb7cd..83bca9348efd6294b5e606f2a4f8655ec8471e1b 100644
--- a/src/math.js
+++ b/src/math.js
@@ -57,7 +57,7 @@ function MathAtan2JS(y, x) {
// ECMA 262 - 15.8.2.6
function MathCeil(x) {
- return -MathFloor(-x);
+ return -%_MathFloor(-x);
}
// ECMA 262 - 15.8.2.8
@@ -67,18 +67,7 @@ function MathExp(x) {
// ECMA 262 - 15.8.2.9
function MathFloor(x) {
- x = TO_NUMBER_INLINE(x);
- // It's more common to call this with a positive number that's out
- // of range than negative numbers; check the upper bound first.
- if (x < 0x80000000 && x > 0) {
- // Numbers in the range [0, 2^31) can be floored by converting
- // them to an unsigned 32-bit value using the shift operator.
- // We avoid doing so for -0, because the result of Math.floor(-0)
- // has to be -0, which wouldn't be the case with the shift.
- return TO_UINT32(x);
- } else {
- return %MathFloorRT(x);
- }
+ return %_MathFloor(+x);
}
// ECMA 262 - 15.8.2.10
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698