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