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

Unified Diff: src/runtime.cc

Issue 12315005: Constant fold math and string operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: made ctors private Created 7 years, 10 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/hydrogen-instructions.cc ('k') | test/mjsunit/constant-folding-2.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index d804979d2e3927e1affde0146643f534e96fdf07..9b12e7a4a7fa4226a8112c278e72a092bc960e9f 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -7263,19 +7263,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) {
}
CONVERT_DOUBLE_ARG_CHECKED(y, 1);
- int y_int = static_cast<int>(y);
- double result;
- if (y == y_int) {
- result = power_double_int(x, y_int); // Returns 1 if exponent is 0.
- } else if (y == 0.5) {
- result = (isinf(x)) ? V8_INFINITY
- : fast_sqrt(x + 0.0); // Convert -0 to +0.
- } else if (y == -0.5) {
- result = (isinf(x)) ? 0
- : 1.0 / fast_sqrt(x + 0.0); // Convert -0 to +0.
- } else {
- result = power_double_double(x, y);
- }
+ double result = power_helper(x, y);
if (isnan(result)) return isolate->heap()->nan_value();
return isolate->heap()->AllocateHeapNumber(result);
}
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | test/mjsunit/constant-folding-2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698