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

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

Issue 996213003: Hide native Date implementation in function context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: padded formatting 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 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 // ====================================================
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 "use strict";
27
28 var kMath; 26 var kMath;
29 var rempio2result; 27 var rempio2result;
30 28
31 (function() { 29 (function() {
30
31 "use strict";
32 32
33 const INVPIO2 = kMath[0]; 33 const INVPIO2 = kMath[0];
34 const PIO2_1 = kMath[1]; 34 const PIO2_1 = kMath[1];
35 const PIO2_1T = kMath[2]; 35 const PIO2_1T = kMath[2];
36 const PIO2_2 = kMath[3]; 36 const PIO2_2 = kMath[3];
37 const PIO2_2T = kMath[4]; 37 const PIO2_2T = kMath[4];
38 const PIO2_3 = kMath[5]; 38 const PIO2_3 = kMath[5];
39 const PIO2_3T = kMath[6]; 39 const PIO2_3T = kMath[6];
40 const PIO4 = kMath[32]; 40 const PIO4 = kMath[32];
41 const PIO4LO = kMath[33]; 41 const PIO4LO = kMath[33];
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 997
998 // log2(ax) = (ss + ...) * 2 / (3 * log(2)) = n + dp_h + z_h + z_l 998 // log2(ax) = (ss + ...) * 2 / (3 * log(2)) = n + dp_h + z_h + z_l
999 var t = n; 999 var t = n;
1000 var t1 = %_ConstructDouble(%_DoubleHi(((z_h + z_l) + dp_h) + t), 0); 1000 var t1 = %_ConstructDouble(%_DoubleHi(((z_h + z_l) + dp_h) + t), 0);
1001 var t2 = z_l - (((t1 - t) - dp_h) - z_h); 1001 var t2 = z_l - (((t1 - t) - dp_h) - z_h);
1002 1002
1003 // t1 + t2 = log2(ax), sum up because we do not care about extra precision. 1003 // t1 + t2 = log2(ax), sum up because we do not care about extra precision.
1004 return t1 + t2; 1004 return t1 + t2;
1005 } 1005 }
1006 1006
1007 InstallFunctions($Math, DONT_ENUM, $Array( 1007 //-------------------------------------------------------------------
1008
1009 %CheckIsBootstrapping();
1010
1011 InstallFunctions(global.Math, DONT_ENUM, $Array(
1008 "cos", MathCos, 1012 "cos", MathCos,
1009 "sin", MathSin, 1013 "sin", MathSin,
1010 "tan", MathTan, 1014 "tan", MathTan,
1011 "sinh", MathSinh, 1015 "sinh", MathSinh,
1012 "cosh", MathCosh, 1016 "cosh", MathCosh,
1013 "log10", MathLog10, 1017 "log10", MathLog10,
1014 "log2", MathLog2, 1018 "log2", MathLog2,
1015 "log1p", MathLog1p, 1019 "log1p", MathLog1p,
1016 "expm1", MathExpm1 1020 "expm1", MathExpm1
1017 )); 1021 ));
1018 1022
1019 %SetInlineBuiltinFlag(MathSin); 1023 %SetInlineBuiltinFlag(MathSin);
1020 %SetInlineBuiltinFlag(MathCos); 1024 %SetInlineBuiltinFlag(MathCos);
1021 1025
1022 })(); 1026 })();
OLDNEW
« src/i18n.js ('K') | « src/snapshot-common.cc ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698