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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 5cbe94a35c7be9d71024a39b266ec8e920e022b6..da96d967e10ba55e971716778c2008973074f4a6 100644
--- a/src/math.js
+++ b/src/math.js
@@ -285,44 +285,20 @@ function SetUpMath() {
%FunctionSetInstanceClassName(MathConstructor, 'Math');
// Set up math constants.
- // ECMA-262, section 15.8.1.1.
- %OptimizeObjectForAddingMultipleProperties($Math, 8);
- %SetProperty($Math,
- "E",
- 2.7182818284590452354,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- // ECMA-262, section 15.8.1.2.
- %SetProperty($Math,
- "LN10",
- 2.302585092994046,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- // ECMA-262, section 15.8.1.3.
- %SetProperty($Math,
- "LN2",
- 0.6931471805599453,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- // ECMA-262, section 15.8.1.4.
- %SetProperty($Math,
- "LOG2E",
- 1.4426950408889634,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- %SetProperty($Math,
- "LOG10E",
- 0.4342944819032518,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- %SetProperty($Math,
- "PI",
- 3.1415926535897932,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- %SetProperty($Math,
- "SQRT1_2",
- 0.7071067811865476,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- %SetProperty($Math,
- "SQRT2",
- 1.4142135623730951,
- DONT_ENUM | DONT_DELETE | READ_ONLY);
- %ToFastProperties($Math);
+ InstallConstants($Math, $Array(
+ // ECMA-262, section 15.8.1.1.
+ "E", 2.7182818284590452354,
+ // ECMA-262, section 15.8.1.2.
+ "LN10", 2.302585092994046,
+ // ECMA-262, section 15.8.1.3.
+ "LN2", 0.6931471805599453,
+ // ECMA-262, section 15.8.1.4.
+ "LOG2E", 1.4426950408889634,
+ "LOG10E", 0.4342944819032518,
+ "PI", 3.1415926535897932,
+ "SQRT1_2", 0.7071067811865476,
+ "SQRT2", 1.4142135623730951
+ ));
// Set up non-enumerable functions of the Math object and
// set their names.
« 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