OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // has to be -0, which wouldn't be the case with the shift. | 106 // has to be -0, which wouldn't be the case with the shift. |
107 return TO_UINT32(x); | 107 return TO_UINT32(x); |
108 } else { | 108 } else { |
109 return %Math_floor(x); | 109 return %Math_floor(x); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 // ECMA 262 - 15.8.2.10 | 113 // ECMA 262 - 15.8.2.10 |
114 function MathLog(x) { | 114 function MathLog(x) { |
115 if (!IS_NUMBER(x)) x = ToNumber(x); | 115 if (!IS_NUMBER(x)) x = ToNumber(x); |
116 return %Math_log(x); | 116 return %_MathLog(x); |
117 } | 117 } |
118 | 118 |
119 // ECMA 262 - 15.8.2.11 | 119 // ECMA 262 - 15.8.2.11 |
120 function MathMax(arg1, arg2) { // length == 2 | 120 function MathMax(arg1, arg2) { // length == 2 |
121 var length = %_ArgumentsLength(); | 121 var length = %_ArgumentsLength(); |
122 if (length == 0) { | 122 if (length == 0) { |
123 return -1/0; // Compiler constant-folds this to -Infinity. | 123 return -1/0; // Compiler constant-folds this to -Infinity. |
124 } | 124 } |
125 var r = arg1; | 125 var r = arg1; |
126 if (!IS_NUMBER(r)) r = ToNumber(r); | 126 if (!IS_NUMBER(r)) r = ToNumber(r); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 "tan", MathTan, | 255 "tan", MathTan, |
256 "atan2", MathAtan2, | 256 "atan2", MathAtan2, |
257 "pow", MathPow, | 257 "pow", MathPow, |
258 "max", MathMax, | 258 "max", MathMax, |
259 "min", MathMin | 259 "min", MathMin |
260 )); | 260 )); |
261 }; | 261 }; |
262 | 262 |
263 | 263 |
264 SetupMath(); | 264 SetupMath(); |
OLD | NEW |