| 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 var rngstate; // Initialized to a Uint32Array during genesis. | 5 var rngstate; // Initialized to a Uint32Array during genesis. |
| 6 | 6 |
| 7 var $abs; | 7 var $abs; |
| 8 var $exp; | 8 var $exp; |
| 9 var $floor; | 9 var $floor; |
| 10 var $max; | 10 var $max; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 var Math = new MathConstructor(); | 288 var Math = new MathConstructor(); |
| 289 | 289 |
| 290 %InternalSetPrototype(Math, GlobalObject.prototype); | 290 %InternalSetPrototype(Math, GlobalObject.prototype); |
| 291 %AddNamedProperty(global, "Math", Math, DONT_ENUM); | 291 %AddNamedProperty(global, "Math", Math, DONT_ENUM); |
| 292 %FunctionSetInstanceClassName(MathConstructor, 'Math'); | 292 %FunctionSetInstanceClassName(MathConstructor, 'Math'); |
| 293 | 293 |
| 294 %AddNamedProperty(Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM); | 294 %AddNamedProperty(Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM); |
| 295 | 295 |
| 296 // Set up math constants. | 296 // Set up math constants. |
| 297 InstallConstants(Math, [ | 297 $installConstants(Math, [ |
| 298 // ECMA-262, section 15.8.1.1. | 298 // ECMA-262, section 15.8.1.1. |
| 299 "E", 2.7182818284590452354, | 299 "E", 2.7182818284590452354, |
| 300 // ECMA-262, section 15.8.1.2. | 300 // ECMA-262, section 15.8.1.2. |
| 301 "LN10", 2.302585092994046, | 301 "LN10", 2.302585092994046, |
| 302 // ECMA-262, section 15.8.1.3. | 302 // ECMA-262, section 15.8.1.3. |
| 303 "LN2", 0.6931471805599453, | 303 "LN2", 0.6931471805599453, |
| 304 // ECMA-262, section 15.8.1.4. | 304 // ECMA-262, section 15.8.1.4. |
| 305 "LOG2E", 1.4426950408889634, | 305 "LOG2E", 1.4426950408889634, |
| 306 "LOG10E", 0.4342944819032518, | 306 "LOG10E", 0.4342944819032518, |
| 307 "PI", 3.1415926535897932, | 307 "PI", 3.1415926535897932, |
| 308 "SQRT1_2", 0.7071067811865476, | 308 "SQRT1_2", 0.7071067811865476, |
| 309 "SQRT2", 1.4142135623730951 | 309 "SQRT2", 1.4142135623730951 |
| 310 ]); | 310 ]); |
| 311 | 311 |
| 312 // Set up non-enumerable functions of the Math object and | 312 // Set up non-enumerable functions of the Math object and |
| 313 // set their names. | 313 // set their names. |
| 314 InstallFunctions(Math, DONT_ENUM, [ | 314 $installFunctions(Math, DONT_ENUM, [ |
| 315 "random", MathRandom, | 315 "random", MathRandom, |
| 316 "abs", MathAbs, | 316 "abs", MathAbs, |
| 317 "acos", MathAcosJS, | 317 "acos", MathAcosJS, |
| 318 "asin", MathAsinJS, | 318 "asin", MathAsinJS, |
| 319 "atan", MathAtanJS, | 319 "atan", MathAtanJS, |
| 320 "ceil", MathCeil, | 320 "ceil", MathCeil, |
| 321 "exp", MathExp, | 321 "exp", MathExp, |
| 322 "floor", MathFloorJS, | 322 "floor", MathFloorJS, |
| 323 "log", MathLog, | 323 "log", MathLog, |
| 324 "round", MathRound, | 324 "round", MathRound, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 354 %SetInlineBuiltinFlag(MathTrunc); | 354 %SetInlineBuiltinFlag(MathTrunc); |
| 355 | 355 |
| 356 // Expose to the global scope. | 356 // Expose to the global scope. |
| 357 $abs = MathAbs; | 357 $abs = MathAbs; |
| 358 $exp = MathExp; | 358 $exp = MathExp; |
| 359 $floor = MathFloorJS; | 359 $floor = MathFloorJS; |
| 360 $max = MathMax; | 360 $max = MathMax; |
| 361 $min = MathMin; | 361 $min = MathMin; |
| 362 | 362 |
| 363 })(); | 363 })(); |
| OLD | NEW |