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 (function(global, utils) { |
8 var $exp; | |
9 var $floor; | |
10 var $max; | |
11 var $min; | |
12 | |
13 (function(global, shared, exports) { | |
14 | 8 |
15 "use strict"; | 9 "use strict"; |
16 | 10 |
17 %CheckIsBootstrapping(); | 11 %CheckIsBootstrapping(); |
18 | 12 |
19 // ------------------------------------------------------------------- | 13 // ------------------------------------------------------------------- |
20 // Imports | 14 // Imports |
21 | 15 |
22 var GlobalObject = global.Object; | 16 var GlobalObject = global.Object; |
23 var InternalArray = shared.InternalArray; | 17 var InternalArray = utils.InternalArray; |
24 | 18 |
25 //------------------------------------------------------------------- | 19 //------------------------------------------------------------------- |
26 | 20 |
27 // ECMA 262 - 15.8.2.1 | 21 // ECMA 262 - 15.8.2.1 |
28 function MathAbs(x) { | 22 function MathAbs(x) { |
29 x = +x; | 23 x = +x; |
30 return (x > 0) ? x : 0 - x; | 24 return (x > 0) ? x : 0 - x; |
31 } | 25 } |
32 | 26 |
33 // ECMA 262 - 15.8.2.2 | 27 // ECMA 262 - 15.8.2.2 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 %SetInlineBuiltinFlag(MathAtanJS); | 344 %SetInlineBuiltinFlag(MathAtanJS); |
351 %SetInlineBuiltinFlag(MathAtan2JS); | 345 %SetInlineBuiltinFlag(MathAtan2JS); |
352 %SetInlineBuiltinFlag(MathCeil); | 346 %SetInlineBuiltinFlag(MathCeil); |
353 %SetInlineBuiltinFlag(MathClz32JS); | 347 %SetInlineBuiltinFlag(MathClz32JS); |
354 %SetInlineBuiltinFlag(MathFloorJS); | 348 %SetInlineBuiltinFlag(MathFloorJS); |
355 %SetInlineBuiltinFlag(MathRandom); | 349 %SetInlineBuiltinFlag(MathRandom); |
356 %SetInlineBuiltinFlag(MathSign); | 350 %SetInlineBuiltinFlag(MathSign); |
357 %SetInlineBuiltinFlag(MathSqrtJS); | 351 %SetInlineBuiltinFlag(MathSqrtJS); |
358 %SetInlineBuiltinFlag(MathTrunc); | 352 %SetInlineBuiltinFlag(MathTrunc); |
359 | 353 |
360 // Expose to the global scope. | 354 // ------------------------------------------------------------------- |
361 $abs = MathAbs; | 355 // Exports |
362 $exp = MathExp; | 356 |
363 $floor = MathFloorJS; | 357 utils.Export(function(to) { |
364 $max = MathMax; | 358 to.MathAbs = MathAbs; |
365 $min = MathMin; | 359 to.MathExp = MathExp; |
| 360 to.MathFloor = MathFloorJS; |
| 361 to.MathMax = MathMax; |
| 362 to.MathMin = MathMin; |
| 363 }); |
366 | 364 |
367 }) | 365 }) |
OLD | NEW |