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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 // ECMA 262 - 15.8.2.18 | 189 // ECMA 262 - 15.8.2.18 |
190 function MathTan(x) { | 190 function MathTan(x) { |
191 if (!IS_NUMBER(x)) x = NonNumberToNumber(x); | 191 if (!IS_NUMBER(x)) x = NonNumberToNumber(x); |
192 return %Math_tan(x); | 192 return %Math_tan(x); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 // ------------------------------------------------------------------- | 196 // ------------------------------------------------------------------- |
197 | 197 |
198 function SetUpMath() { | 198 function SetupMath() { |
199 %CheckIsBootstrapping(); | 199 // Setup math constants. |
200 // Set up math constants. | |
201 // ECMA-262, section 15.8.1.1. | 200 // ECMA-262, section 15.8.1.1. |
202 %OptimizeObjectForAddingMultipleProperties($Math, 8); | 201 %OptimizeObjectForAddingMultipleProperties($Math, 8); |
203 %SetProperty($Math, | 202 %SetProperty($Math, |
204 "E", | 203 "E", |
205 2.7182818284590452354, | 204 2.7182818284590452354, |
206 DONT_ENUM | DONT_DELETE | READ_ONLY); | 205 DONT_ENUM | DONT_DELETE | READ_ONLY); |
207 // ECMA-262, section 15.8.1.2. | 206 // ECMA-262, section 15.8.1.2. |
208 %SetProperty($Math, | 207 %SetProperty($Math, |
209 "LN10", | 208 "LN10", |
210 2.302585092994046, | 209 2.302585092994046, |
(...skipping 19 matching lines...) Expand all Loading... |
230 %SetProperty($Math, | 229 %SetProperty($Math, |
231 "SQRT1_2", | 230 "SQRT1_2", |
232 0.7071067811865476, | 231 0.7071067811865476, |
233 DONT_ENUM | DONT_DELETE | READ_ONLY); | 232 DONT_ENUM | DONT_DELETE | READ_ONLY); |
234 %SetProperty($Math, | 233 %SetProperty($Math, |
235 "SQRT2", | 234 "SQRT2", |
236 1.4142135623730951, | 235 1.4142135623730951, |
237 DONT_ENUM | DONT_DELETE | READ_ONLY); | 236 DONT_ENUM | DONT_DELETE | READ_ONLY); |
238 %ToFastProperties($Math); | 237 %ToFastProperties($Math); |
239 | 238 |
240 // Set up non-enumerable functions of the Math object and | 239 // Setup non-enumerable functions of the Math object and |
241 // set their names. | 240 // set their names. |
242 InstallFunctionsOnHiddenPrototype($Math, DONT_ENUM, $Array( | 241 InstallFunctionsOnHiddenPrototype($Math, DONT_ENUM, $Array( |
243 "random", MathRandom, | 242 "random", MathRandom, |
244 "abs", MathAbs, | 243 "abs", MathAbs, |
245 "acos", MathAcos, | 244 "acos", MathAcos, |
246 "asin", MathAsin, | 245 "asin", MathAsin, |
247 "atan", MathAtan, | 246 "atan", MathAtan, |
248 "ceil", MathCeil, | 247 "ceil", MathCeil, |
249 "cos", MathCos, | 248 "cos", MathCos, |
250 "exp", MathExp, | 249 "exp", MathExp, |
251 "floor", MathFloor, | 250 "floor", MathFloor, |
252 "log", MathLog, | 251 "log", MathLog, |
253 "round", MathRound, | 252 "round", MathRound, |
254 "sin", MathSin, | 253 "sin", MathSin, |
255 "sqrt", MathSqrt, | 254 "sqrt", MathSqrt, |
256 "tan", MathTan, | 255 "tan", MathTan, |
257 "atan2", MathAtan2, | 256 "atan2", MathAtan2, |
258 "pow", MathPow, | 257 "pow", MathPow, |
259 "max", MathMax, | 258 "max", MathMax, |
260 "min", MathMin | 259 "min", MathMin |
261 )); | 260 )); |
262 } | 261 }; |
263 | 262 |
264 SetUpMath(); | 263 |
| 264 SetupMath(); |
OLD | NEW |