| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // ECMA 262 - 15.8.2.6 | 78 // ECMA 262 - 15.8.2.6 |
| 79 function MathCeil(x) { | 79 function MathCeil(x) { |
| 80 if (!IS_NUMBER(x)) x = ToNumber(x); | 80 if (!IS_NUMBER(x)) x = ToNumber(x); |
| 81 return %Math_ceil(x); | 81 return %Math_ceil(x); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // ECMA 262 - 15.8.2.7 | 84 // ECMA 262 - 15.8.2.7 |
| 85 function MathCos(x) { | 85 function MathCos(x) { |
| 86 if (!IS_NUMBER(x)) x = ToNumber(x); | 86 if (!IS_NUMBER(x)) x = ToNumber(x); |
| 87 return %Math_cos(x); | 87 return %_Math_cos(x); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // ECMA 262 - 15.8.2.8 | 90 // ECMA 262 - 15.8.2.8 |
| 91 function MathExp(x) { | 91 function MathExp(x) { |
| 92 if (!IS_NUMBER(x)) x = ToNumber(x); | 92 if (!IS_NUMBER(x)) x = ToNumber(x); |
| 93 return %Math_exp(x); | 93 return %Math_exp(x); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // ECMA 262 - 15.8.2.9 | 96 // ECMA 262 - 15.8.2.9 |
| 97 function MathFloor(x) { | 97 function MathFloor(x) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // ECMA 262 - 15.8.2.15 | 170 // ECMA 262 - 15.8.2.15 |
| 171 function MathRound(x) { | 171 function MathRound(x) { |
| 172 if (!IS_NUMBER(x)) x = ToNumber(x); | 172 if (!IS_NUMBER(x)) x = ToNumber(x); |
| 173 return %Math_round(x); | 173 return %Math_round(x); |
| 174 } | 174 } |
| 175 | 175 |
| 176 // ECMA 262 - 15.8.2.16 | 176 // ECMA 262 - 15.8.2.16 |
| 177 function MathSin(x) { | 177 function MathSin(x) { |
| 178 if (!IS_NUMBER(x)) x = ToNumber(x); | 178 if (!IS_NUMBER(x)) x = ToNumber(x); |
| 179 return %Math_sin(x); | 179 return %_Math_sin(x); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // ECMA 262 - 15.8.2.17 | 182 // ECMA 262 - 15.8.2.17 |
| 183 function MathSqrt(x) { | 183 function MathSqrt(x) { |
| 184 if (!IS_NUMBER(x)) x = ToNumber(x); | 184 if (!IS_NUMBER(x)) x = ToNumber(x); |
| 185 return %Math_sqrt(x); | 185 return %Math_sqrt(x); |
| 186 } | 186 } |
| 187 | 187 |
| 188 // ECMA 262 - 15.8.2.18 | 188 // ECMA 262 - 15.8.2.18 |
| 189 function MathTan(x) { | 189 function MathTan(x) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 3.1415926535897932, | 226 3.1415926535897932, |
| 227 DONT_ENUM | DONT_DELETE | READ_ONLY); | 227 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 228 %SetProperty($Math, | 228 %SetProperty($Math, |
| 229 "SQRT1_2", | 229 "SQRT1_2", |
| 230 0.7071067811865476, | 230 0.7071067811865476, |
| 231 DONT_ENUM | DONT_DELETE | READ_ONLY); | 231 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 232 %SetProperty($Math, | 232 %SetProperty($Math, |
| 233 "SQRT2", | 233 "SQRT2", |
| 234 1.4142135623730951, | 234 1.4142135623730951, |
| 235 DONT_ENUM | DONT_DELETE | READ_ONLY); | 235 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 236 %TransformToFastProperties($Math); | 236 %ToFastProperties($Math); |
| 237 | 237 |
| 238 // Setup non-enumerable functions of the Math object and | 238 // Setup non-enumerable functions of the Math object and |
| 239 // set their names. | 239 // set their names. |
| 240 InstallFunctionsOnHiddenPrototype($Math, DONT_ENUM, $Array( | 240 InstallFunctionsOnHiddenPrototype($Math, DONT_ENUM, $Array( |
| 241 "random", MathRandom, | 241 "random", MathRandom, |
| 242 "abs", MathAbs, | 242 "abs", MathAbs, |
| 243 "acos", MathAcos, | 243 "acos", MathAcos, |
| 244 "asin", MathAsin, | 244 "asin", MathAsin, |
| 245 "atan", MathAtan, | 245 "atan", MathAtan, |
| 246 "ceil", MathCeil, | 246 "ceil", MathCeil, |
| 247 "cos", MathCos, | 247 "cos", MathCos, |
| 248 "exp", MathExp, | 248 "exp", MathExp, |
| 249 "floor", MathFloor, | 249 "floor", MathFloor, |
| 250 "log", MathLog, | 250 "log", MathLog, |
| 251 "round", MathRound, | 251 "round", MathRound, |
| 252 "sin", MathSin, | 252 "sin", MathSin, |
| 253 "sqrt", MathSqrt, | 253 "sqrt", MathSqrt, |
| 254 "tan", MathTan, | 254 "tan", MathTan, |
| 255 "atan2", MathAtan2, | 255 "atan2", MathAtan2, |
| 256 "pow", MathPow, | 256 "pow", MathPow, |
| 257 "max", MathMax, | 257 "max", MathMax, |
| 258 "min", MathMin | 258 "min", MathMin |
| 259 )); | 259 )); |
| 260 }; | 260 }; |
| 261 | 261 |
| 262 | 262 |
| 263 SetupMath(); | 263 SetupMath(); |
| OLD | NEW |