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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893; | 191 var approx_hi = MathFloorJS(%_DoubleHi(x) / 3) + 0x2A9F7893; |
192 var approx = %_ConstructDouble(approx_hi | 0, 0); | 192 var approx = %_ConstructDouble(approx_hi | 0, 0); |
193 approx = NEWTON_ITERATION_CBRT(x, approx); | 193 approx = NEWTON_ITERATION_CBRT(x, approx); |
194 approx = NEWTON_ITERATION_CBRT(x, approx); | 194 approx = NEWTON_ITERATION_CBRT(x, approx); |
195 approx = NEWTON_ITERATION_CBRT(x, approx); | 195 approx = NEWTON_ITERATION_CBRT(x, approx); |
196 return NEWTON_ITERATION_CBRT(x, approx); | 196 return NEWTON_ITERATION_CBRT(x, approx); |
197 } | 197 } |
198 | 198 |
199 // ------------------------------------------------------------------- | 199 // ------------------------------------------------------------------- |
200 | 200 |
| 201 %InstallToContext([ |
| 202 "math_pow", MathPowJS, |
| 203 ]); |
| 204 |
201 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM); | 205 %AddNamedProperty(GlobalMath, toStringTagSymbol, "Math", READ_ONLY | DONT_ENUM); |
202 | 206 |
203 // Set up math constants. | 207 // Set up math constants. |
204 utils.InstallConstants(GlobalMath, [ | 208 utils.InstallConstants(GlobalMath, [ |
205 // ECMA-262, section 15.8.1.1. | 209 // ECMA-262, section 15.8.1.1. |
206 "E", 2.7182818284590452354, | 210 "E", 2.7182818284590452354, |
207 // ECMA-262, section 15.8.1.2. | 211 // ECMA-262, section 15.8.1.2. |
208 "LN10", 2.302585092994046, | 212 "LN10", 2.302585092994046, |
209 // ECMA-262, section 15.8.1.3. | 213 // ECMA-262, section 15.8.1.3. |
210 "LN2", 0.6931471805599453, | 214 "LN2", 0.6931471805599453, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // Exports | 257 // Exports |
254 | 258 |
255 utils.Export(function(to) { | 259 utils.Export(function(to) { |
256 to.MathAbs = MathAbs; | 260 to.MathAbs = MathAbs; |
257 to.MathExp = MathExp; | 261 to.MathExp = MathExp; |
258 to.MathFloor = MathFloorJS; | 262 to.MathFloor = MathFloorJS; |
259 to.IntRandom = MathRandomRaw; | 263 to.IntRandom = MathRandomRaw; |
260 }); | 264 }); |
261 | 265 |
262 }) | 266 }) |
OLD | NEW |