| OLD | NEW |
| 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 // ==================================================== |
| 11 // | 11 // |
| 12 // The original source code covered by the above license above has been | 12 // The original source code covered by the above license above has been |
| 13 // modified significantly by Google Inc. | 13 // modified significantly by Google Inc. |
| 14 // Copyright 2014 the V8 project authors. All rights reserved. | 14 // Copyright 2014 the V8 project authors. All rights reserved. |
| 15 // | 15 // |
| 16 // The following is a straightforward translation of fdlibm routines | 16 // The following is a straightforward translation of fdlibm routines |
| 17 // by Raymond Toy (rtoy@google.com). | 17 // by Raymond Toy (rtoy@google.com). |
| 18 | 18 |
| 19 // Double constants that do not have empty lower 32 bits are found in fdlibm.cc | 19 // Double constants that do not have empty lower 32 bits are found in fdlibm.cc |
| 20 // and exposed through kMath as typed array. We assume the compiler to convert | 20 // and exposed through kMath as typed array. We assume the compiler to convert |
| 21 // from decimal to binary accurately enough to produce the intended values. | 21 // from decimal to binary accurately enough to produce the intended values. |
| 22 // kMath is initialized to a Float64Array during genesis and not writable. | 22 // kMath is initialized to a Float64Array during genesis and not writable. |
| 23 // rempio2result is used as a container for return values of %RemPiO2. It is | 23 // rempio2result is used as a container for return values of %RemPiO2. It is |
| 24 // initialized to a two-element Float64Array during genesis. | 24 // initialized to a two-element Float64Array during genesis. |
| 25 | 25 |
| 26 var kMath; | |
| 27 var rempio2result; | |
| 28 | |
| 29 (function(global, utils) { | 26 (function(global, utils) { |
| 30 | 27 |
| 31 "use strict"; | 28 "use strict"; |
| 32 | 29 |
| 33 %CheckIsBootstrapping(); | 30 %CheckIsBootstrapping(); |
| 34 | 31 |
| 35 // ------------------------------------------------------------------- | 32 // ------------------------------------------------------------------- |
| 36 // Imports | 33 // Imports |
| 37 | 34 |
| 38 var GlobalMath = global.Math; | 35 var GlobalMath = global.Math; |
| 36 var kMath; |
| 39 var MathAbs; | 37 var MathAbs; |
| 40 var MathExp; | 38 var MathExp; |
| 41 var NaN = %GetRootNaN(); | 39 var NaN = %GetRootNaN(); |
| 40 var rempio2result; |
| 42 | 41 |
| 43 utils.Import(function(from) { | 42 utils.Import(function(from) { |
| 44 MathAbs = from.MathAbs; | 43 MathAbs = from.MathAbs; |
| 45 MathExp = from.MathExp; | 44 MathExp = from.MathExp; |
| 46 }); | 45 }); |
| 47 | 46 |
| 47 utils.SetupTypedArray(function(arg1, arg2, arg3) { |
| 48 kMath = arg2; |
| 49 rempio2result = arg3; |
| 50 }); |
| 51 |
| 48 // ------------------------------------------------------------------- | 52 // ------------------------------------------------------------------- |
| 49 | 53 |
| 50 define INVPIO2 = kMath[0]; | 54 define INVPIO2 = kMath[0]; |
| 51 define PIO2_1 = kMath[1]; | 55 define PIO2_1 = kMath[1]; |
| 52 define PIO2_1T = kMath[2]; | 56 define PIO2_1T = kMath[2]; |
| 53 define PIO2_2 = kMath[3]; | 57 define PIO2_2 = kMath[3]; |
| 54 define PIO2_2T = kMath[4]; | 58 define PIO2_2T = kMath[4]; |
| 55 define PIO2_3 = kMath[5]; | 59 define PIO2_3 = kMath[5]; |
| 56 define PIO2_3T = kMath[6]; | 60 define PIO2_3T = kMath[6]; |
| 57 define PIO4 = kMath[32]; | 61 define PIO4 = kMath[32]; |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 "log10", MathLog10, | 1094 "log10", MathLog10, |
| 1091 "log2", MathLog2, | 1095 "log2", MathLog2, |
| 1092 "log1p", MathLog1p, | 1096 "log1p", MathLog1p, |
| 1093 "expm1", MathExpm1 | 1097 "expm1", MathExpm1 |
| 1094 ]); | 1098 ]); |
| 1095 | 1099 |
| 1096 %SetForceInlineFlag(MathSin); | 1100 %SetForceInlineFlag(MathSin); |
| 1097 %SetForceInlineFlag(MathCos); | 1101 %SetForceInlineFlag(MathCos); |
| 1098 | 1102 |
| 1099 }) | 1103 }) |
| OLD | NEW |