OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 var InitTrigonometricFunctions; | 213 var InitTrigonometricFunctions; |
214 | 214 |
215 | 215 |
216 // Define constants and interpolation functions. | 216 // Define constants and interpolation functions. |
217 // Also define the initialization function that populates the lookup table | 217 // Also define the initialization function that populates the lookup table |
218 // and then wires up the function definitions. | 218 // and then wires up the function definitions. |
219 function SetupTrigonometricFunctions() { | 219 function SetupTrigonometricFunctions() { |
220 var samples = 2048; // Table size. | 220 var samples = 1800; // Table size. |
221 var pi = 3.1415926535897932; | 221 var pi = 3.1415926535897932; |
222 var pi_half = pi / 2; | 222 var pi_half = pi / 2; |
223 var inverse_pi_half = 1 / pi_half; | 223 var inverse_pi_half = 1 / pi_half; |
224 var two_pi = pi * 2; | 224 var two_pi = pi * 2; |
225 var interval = pi_half / samples; | 225 var interval = pi_half / samples; |
226 var inverse_interval = samples / pi_half; | 226 var inverse_interval = samples / pi_half; |
227 var table_sin; | 227 var table_sin; |
228 var table_cos_interval; | 228 var table_cos_interval; |
229 | 229 |
230 // This implements sine using the following algorithm. | 230 // This implements sine using the following algorithm. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 "min", MathMin, | 356 "min", MathMin, |
357 "imul", MathImul | 357 "imul", MathImul |
358 )); | 358 )); |
359 | 359 |
360 %SetInlineBuiltinFlag(MathSin); | 360 %SetInlineBuiltinFlag(MathSin); |
361 %SetInlineBuiltinFlag(MathCos); | 361 %SetInlineBuiltinFlag(MathCos); |
362 %SetInlineBuiltinFlag(MathTan); | 362 %SetInlineBuiltinFlag(MathTan); |
363 } | 363 } |
364 | 364 |
365 SetUpMath(); | 365 SetUpMath(); |
OLD | NEW |