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; |
11 var $min; | 11 var $min; |
12 | 12 |
13 (function() { | 13 (function() { |
14 | 14 |
15 "use strict"; | 15 "use strict"; |
16 | 16 |
17 %CheckIsBootstrapping(); | 17 %CheckIsBootstrapping(); |
18 | 18 |
19 var GlobalObject = global.Object; | 19 var GlobalObject = global.Object; |
20 var GlobalArray = global.Array; | 20 var GlobalArray = global.Array; |
21 | 21 |
22 //------------------------------------------------------------------- | 22 //------------------------------------------------------------------- |
23 | 23 |
24 // ECMA 262 - 15.8.2.1 | 24 // ECMA 262 - 15.8.2.1 |
25 function MathAbs(x) { | 25 function MathAbs(x) { |
26 x = +x; | 26 x = +x; |
27 if (x > 0) return x; | 27 return (x > 0) ? x : 0 - x; |
28 return 0 - x; | |
29 } | 28 } |
30 | 29 |
31 // ECMA 262 - 15.8.2.2 | 30 // ECMA 262 - 15.8.2.2 |
32 function MathAcosJS(x) { | 31 function MathAcosJS(x) { |
33 return %_MathAcos(+x); | 32 return %_MathAcos(+x); |
34 } | 33 } |
35 | 34 |
36 // ECMA 262 - 15.8.2.3 | 35 // ECMA 262 - 15.8.2.3 |
37 function MathAsinJS(x) { | 36 function MathAsinJS(x) { |
38 return %_MathAsin(+x); | 37 return %_MathAsin(+x); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 %SetInlineBuiltinFlag(MathTrunc); | 355 %SetInlineBuiltinFlag(MathTrunc); |
357 | 356 |
358 // Expose to the global scope. | 357 // Expose to the global scope. |
359 $abs = MathAbs; | 358 $abs = MathAbs; |
360 $exp = MathExp; | 359 $exp = MathExp; |
361 $floor = MathFloorJS; | 360 $floor = MathFloorJS; |
362 $max = MathMax; | 361 $max = MathMax; |
363 $min = MathMin; | 362 $min = MathMin; |
364 | 363 |
365 })(); | 364 })(); |
OLD | NEW |