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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 // ------------------------------------------------------------------- | 315 // ------------------------------------------------------------------- |
316 | 316 |
317 function SetUpMath() { | 317 function SetUpMath() { |
318 %CheckIsBootstrapping(); | 318 %CheckIsBootstrapping(); |
319 | 319 |
320 %InternalSetPrototype($Math, $Object.prototype); | 320 %InternalSetPrototype($Math, $Object.prototype); |
321 %AddNamedProperty(global, "Math", $Math, DONT_ENUM); | 321 %AddNamedProperty(global, "Math", $Math, DONT_ENUM); |
322 %FunctionSetInstanceClassName(MathConstructor, 'Math'); | 322 %FunctionSetInstanceClassName(MathConstructor, 'Math'); |
323 | 323 |
| 324 %AddNamedProperty($Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM); |
| 325 |
324 // Set up math constants. | 326 // Set up math constants. |
325 InstallConstants($Math, $Array( | 327 InstallConstants($Math, $Array( |
326 // ECMA-262, section 15.8.1.1. | 328 // ECMA-262, section 15.8.1.1. |
327 "E", 2.7182818284590452354, | 329 "E", 2.7182818284590452354, |
328 // ECMA-262, section 15.8.1.2. | 330 // ECMA-262, section 15.8.1.2. |
329 "LN10", 2.302585092994046, | 331 "LN10", 2.302585092994046, |
330 // ECMA-262, section 15.8.1.3. | 332 // ECMA-262, section 15.8.1.3. |
331 "LN2", 0.6931471805599453, | 333 "LN2", 0.6931471805599453, |
332 // ECMA-262, section 15.8.1.4. | 334 // ECMA-262, section 15.8.1.4. |
333 "LOG2E", 1.4426950408889634, | 335 "LOG2E", 1.4426950408889634, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 "expm1", MathExpm1 // implemented by third_party/fdlibm | 379 "expm1", MathExpm1 // implemented by third_party/fdlibm |
378 )); | 380 )); |
379 | 381 |
380 %SetInlineBuiltinFlag(MathCeil); | 382 %SetInlineBuiltinFlag(MathCeil); |
381 %SetInlineBuiltinFlag(MathRandom); | 383 %SetInlineBuiltinFlag(MathRandom); |
382 %SetInlineBuiltinFlag(MathSin); | 384 %SetInlineBuiltinFlag(MathSin); |
383 %SetInlineBuiltinFlag(MathCos); | 385 %SetInlineBuiltinFlag(MathCos); |
384 } | 386 } |
385 | 387 |
386 SetUpMath(); | 388 SetUpMath(); |
OLD | NEW |