Chromium Code Reviews| Index: runtime/lib/math_patch.dart |
| =================================================================== |
| --- runtime/lib/math_patch.dart (revision 35942) |
| +++ runtime/lib/math_patch.dart (working copy) |
| @@ -19,6 +19,11 @@ |
| if (exponent == 0.0) { |
| return 1.0; // ECMA-262 15.8.2.13 |
| } |
| + // Speed up simple cases. |
| + if (exponent == 1.0) return base; |
| + if (exponent == 2.0) return base * base; |
| + if (exponent == 3.0) return base * base * base; |
| + |
| if (base == 1.0) return 1.0; |
| if (base.isNaN || exponent.isNaN) { |