Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Side by Side Diff: src/math.js

Issue 127863002: Cleanup SetUpMath to use InstallConstants helper. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // ------------------------------------------------------------------- 278 // -------------------------------------------------------------------
279 279
280 function SetUpMath() { 280 function SetUpMath() {
281 %CheckIsBootstrapping(); 281 %CheckIsBootstrapping();
282 282
283 %SetPrototype($Math, $Object.prototype); 283 %SetPrototype($Math, $Object.prototype);
284 %SetProperty(global, "Math", $Math, DONT_ENUM); 284 %SetProperty(global, "Math", $Math, DONT_ENUM);
285 %FunctionSetInstanceClassName(MathConstructor, 'Math'); 285 %FunctionSetInstanceClassName(MathConstructor, 'Math');
286 286
287 // Set up math constants. 287 // Set up math constants.
288 // ECMA-262, section 15.8.1.1. 288 InstallConstants($Math, $Array(
289 %OptimizeObjectForAddingMultipleProperties($Math, 8); 289 // ECMA-262, section 15.8.1.1.
290 %SetProperty($Math, 290 "E", 2.7182818284590452354,
291 "E", 291 // ECMA-262, section 15.8.1.2.
292 2.7182818284590452354, 292 "LN10", 2.302585092994046,
293 DONT_ENUM | DONT_DELETE | READ_ONLY); 293 // ECMA-262, section 15.8.1.3.
294 // ECMA-262, section 15.8.1.2. 294 "LN2", 0.6931471805599453,
295 %SetProperty($Math, 295 // ECMA-262, section 15.8.1.4.
296 "LN10", 296 "LOG2E", 1.4426950408889634,
297 2.302585092994046, 297 "LOG10E", 0.4342944819032518,
298 DONT_ENUM | DONT_DELETE | READ_ONLY); 298 "PI", 3.1415926535897932,
299 // ECMA-262, section 15.8.1.3. 299 "SQRT1_2", 0.7071067811865476,
300 %SetProperty($Math, 300 "SQRT2", 1.4142135623730951
301 "LN2", 301 ));
302 0.6931471805599453,
303 DONT_ENUM | DONT_DELETE | READ_ONLY);
304 // ECMA-262, section 15.8.1.4.
305 %SetProperty($Math,
306 "LOG2E",
307 1.4426950408889634,
308 DONT_ENUM | DONT_DELETE | READ_ONLY);
309 %SetProperty($Math,
310 "LOG10E",
311 0.4342944819032518,
312 DONT_ENUM | DONT_DELETE | READ_ONLY);
313 %SetProperty($Math,
314 "PI",
315 3.1415926535897932,
316 DONT_ENUM | DONT_DELETE | READ_ONLY);
317 %SetProperty($Math,
318 "SQRT1_2",
319 0.7071067811865476,
320 DONT_ENUM | DONT_DELETE | READ_ONLY);
321 %SetProperty($Math,
322 "SQRT2",
323 1.4142135623730951,
324 DONT_ENUM | DONT_DELETE | READ_ONLY);
325 %ToFastProperties($Math);
326 302
327 // Set up non-enumerable functions of the Math object and 303 // Set up non-enumerable functions of the Math object and
328 // set their names. 304 // set their names.
329 InstallFunctions($Math, DONT_ENUM, $Array( 305 InstallFunctions($Math, DONT_ENUM, $Array(
330 "random", MathRandom, 306 "random", MathRandom,
331 "abs", MathAbs, 307 "abs", MathAbs,
332 "acos", MathAcos, 308 "acos", MathAcos,
333 "asin", MathAsin, 309 "asin", MathAsin,
334 "atan", MathAtan, 310 "atan", MathAtan,
335 "ceil", MathCeil, 311 "ceil", MathCeil,
(...skipping 14 matching lines...) Expand all
350 326
351 %SetInlineBuiltinFlag(MathCeil); 327 %SetInlineBuiltinFlag(MathCeil);
352 %SetInlineBuiltinFlag(MathRandom); 328 %SetInlineBuiltinFlag(MathRandom);
353 %SetInlineBuiltinFlag(MathSin); 329 %SetInlineBuiltinFlag(MathSin);
354 %SetInlineBuiltinFlag(MathCos); 330 %SetInlineBuiltinFlag(MathCos);
355 %SetInlineBuiltinFlag(MathTan); 331 %SetInlineBuiltinFlag(MathTan);
356 %SetInlineBuiltinFlag(TrigonometricInterpolation); 332 %SetInlineBuiltinFlag(TrigonometricInterpolation);
357 } 333 }
358 334
359 SetUpMath(); 335 SetUpMath();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698