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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declarations have been made | 7 // This file relies on the fact that the following declarations have been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Object = global.Object; | 9 // var $Object = global.Object; |
10 | 10 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } else { // Use regular log if not close enough to 0. | 365 } else { // Use regular log if not close enough to 0. |
366 return MathLog(1 + x); | 366 return MathLog(1 + x); |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 // ------------------------------------------------------------------- | 370 // ------------------------------------------------------------------- |
371 | 371 |
372 function SetUpMath() { | 372 function SetUpMath() { |
373 %CheckIsBootstrapping(); | 373 %CheckIsBootstrapping(); |
374 | 374 |
375 %SetPrototype($Math, $Object.prototype); | 375 %InternalSetPrototype($Math, $Object.prototype); |
376 %AddNamedProperty(global, "Math", $Math, DONT_ENUM); | 376 %AddNamedProperty(global, "Math", $Math, DONT_ENUM); |
377 %FunctionSetInstanceClassName(MathConstructor, 'Math'); | 377 %FunctionSetInstanceClassName(MathConstructor, 'Math'); |
378 | 378 |
379 // Set up math constants. | 379 // Set up math constants. |
380 InstallConstants($Math, $Array( | 380 InstallConstants($Math, $Array( |
381 // ECMA-262, section 15.8.1.1. | 381 // ECMA-262, section 15.8.1.1. |
382 "E", 2.7182818284590452354, | 382 "E", 2.7182818284590452354, |
383 // ECMA-262, section 15.8.1.2. | 383 // ECMA-262, section 15.8.1.2. |
384 "LN10", 2.302585092994046, | 384 "LN10", 2.302585092994046, |
385 // ECMA-262, section 15.8.1.3. | 385 // ECMA-262, section 15.8.1.3. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 "expm1", MathExpm1 | 432 "expm1", MathExpm1 |
433 )); | 433 )); |
434 | 434 |
435 %SetInlineBuiltinFlag(MathCeil); | 435 %SetInlineBuiltinFlag(MathCeil); |
436 %SetInlineBuiltinFlag(MathRandom); | 436 %SetInlineBuiltinFlag(MathRandom); |
437 %SetInlineBuiltinFlag(MathSin); | 437 %SetInlineBuiltinFlag(MathSin); |
438 %SetInlineBuiltinFlag(MathCos); | 438 %SetInlineBuiltinFlag(MathCos); |
439 } | 439 } |
440 | 440 |
441 SetUpMath(); | 441 SetUpMath(); |
OLD | NEW |