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

Side by Side Diff: src/third_party/fdlibm/fdlibm.js

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm), 1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm),
2 // 2 //
3 // ==================================================== 3 // ====================================================
4 // Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. 4 // Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
5 // 5 //
6 // Developed at SunSoft, a Sun Microsystems, Inc. business. 6 // Developed at SunSoft, a Sun Microsystems, Inc. business.
7 // Permission to use, copy, modify, and distribute this 7 // Permission to use, copy, modify, and distribute this
8 // software is freely granted, provided that this notice 8 // software is freely granted, provided that this notice
9 // is preserved. 9 // is preserved.
10 // ==================================================== 10 // ====================================================
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 967
968 // Infinity or NaN. 968 // Infinity or NaN.
969 if (hx >= 0x7ff00000) return x; 969 if (hx >= 0x7ff00000) return x;
970 970
971 k += (hx >> 20) - 1023; 971 k += (hx >> 20) - 1023;
972 var i = (k & 0x80000000) >>> 31; 972 var i = (k & 0x80000000) >>> 31;
973 hx = (hx & 0x000fffff) | ((0x3ff - i) << 20); 973 hx = (hx & 0x000fffff) | ((0x3ff - i) << 20);
974 var y = k + i; 974 var y = k + i;
975 x = %_ConstructDouble(hx, lx); 975 x = %_ConstructDouble(hx, lx);
976 976
977 var z = y * LOG10_2LO + IVLN10 * %_MathLogRT(x); 977 var z = y * LOG10_2LO + IVLN10 * %math_log(x);
978 return z + y * LOG10_2HI; 978 return z + y * LOG10_2HI;
979 } 979 }
980 980
981 981
982 // ES6 draft 09-27-13, section 20.2.2.22. 982 // ES6 draft 09-27-13, section 20.2.2.22.
983 // Return the base 2 logarithm of x 983 // Return the base 2 logarithm of x
984 // 984 //
985 // fdlibm does not have an explicit log2 function, but fdlibm's pow 985 // fdlibm does not have an explicit log2 function, but fdlibm's pow
986 // function does implement an accurate log2 function as part of the 986 // function does implement an accurate log2 function as part of the
987 // pow implementation. This extracts the core parts of that as a 987 // pow implementation. This extracts the core parts of that as a
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 "log10", MathLog10, 1108 "log10", MathLog10,
1109 "log2", MathLog2, 1109 "log2", MathLog2,
1110 "log1p", MathLog1p, 1110 "log1p", MathLog1p,
1111 "expm1", MathExpm1 1111 "expm1", MathExpm1
1112 ]); 1112 ]);
1113 1113
1114 %SetForceInlineFlag(MathSin); 1114 %SetForceInlineFlag(MathSin);
1115 %SetForceInlineFlag(MathCos); 1115 %SetForceInlineFlag(MathCos);
1116 1116
1117 }) 1117 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698