OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 "use strict"; | 6 "use strict"; |
7 | 7 |
8 %CheckIsBootstrapping(); | 8 %CheckIsBootstrapping(); |
9 | 9 |
10 // ------------------------------------------------------------------- | 10 // ------------------------------------------------------------------- |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893; | 195 var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893; |
196 var approx = %_ConstructDouble(approx_hi | 0, 0); | 196 var approx = %_ConstructDouble(approx_hi | 0, 0); |
197 approx = NEWTON_ITERATION_CBRT(x, approx); | 197 approx = NEWTON_ITERATION_CBRT(x, approx); |
198 approx = NEWTON_ITERATION_CBRT(x, approx); | 198 approx = NEWTON_ITERATION_CBRT(x, approx); |
199 approx = NEWTON_ITERATION_CBRT(x, approx); | 199 approx = NEWTON_ITERATION_CBRT(x, approx); |
200 return NEWTON_ITERATION_CBRT(x, approx); | 200 return NEWTON_ITERATION_CBRT(x, approx); |
201 } | 201 } |
202 | 202 |
203 // ------------------------------------------------------------------- | 203 // ------------------------------------------------------------------- |
204 | 204 |
| 205 %InstallToContext([ |
| 206 "math_pow", MathPowJS, |
| 207 ]); |
| 208 |
205 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM); | 209 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM); |
206 | 210 |
207 // Set up math constants. | 211 // Set up math constants. |
208 utils.InstallConstants(GlobalMath, [ | 212 utils.InstallConstants(GlobalMath, [ |
209 // ECMA-262, section 15.8.1.1. | 213 // ECMA-262, section 15.8.1.1. |
210 "E", 2.7182818284590452354, | 214 "E", 2.7182818284590452354, |
211 // ECMA-262, section 15.8.1.2. | 215 // ECMA-262, section 15.8.1.2. |
212 "LN10", 2.302585092994046, | 216 "LN10", 2.302585092994046, |
213 // ECMA-262, section 15.8.1.3. | 217 // ECMA-262, section 15.8.1.3. |
214 "LN2", 0.6931471805599453, | 218 "LN2", 0.6931471805599453, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Exports | 261 // Exports |
258 | 262 |
259 utils.Export(function(to) { | 263 utils.Export(function(to) { |
260 to.MathAbs = MathAbs; | 264 to.MathAbs = MathAbs; |
261 to.MathExp = MathExp; | 265 to.MathExp = MathExp; |
262 to.MathFloor = MathFloorJS; | 266 to.MathFloor = MathFloorJS; |
263 to.IntRandom = MathRandomRaw; | 267 to.IntRandom = MathRandomRaw; |
264 }); | 268 }); |
265 | 269 |
266 }) | 270 }) |
OLD | NEW |