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

Unified Diff: src/math.js

Issue 1294583006: Clean up native context slots and add new ones. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 | « src/json-stringifier.h ('k') | src/messages.cc » ('j') | 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 fc3bf2fcdabf1b4fd5b0083d4b9a219454e388b7..51f4d445c7fc780c780cb5e0d947c640aa40928a 100644
--- a/src/math.js
+++ b/src/math.js
@@ -12,6 +12,7 @@ var rngstate; // Initialized to a Uint32Array during genesis.
// -------------------------------------------------------------------
// Imports
+var GlobalMath = global.Math;
var GlobalObject = global.Object;
var InternalArray = utils.InternalArray;
@@ -287,20 +288,10 @@ function CubeRoot(x) {
// -------------------------------------------------------------------
-// Instance class name can only be set on functions. That is the only
-// purpose for MathConstructor.
-function MathConstructor() {}
-
-var Math = new MathConstructor();
-
-%InternalSetPrototype(Math, GlobalObject.prototype);
-%AddNamedProperty(global, "Math", Math, DONT_ENUM);
-%FunctionSetInstanceClassName(MathConstructor, 'Math');
-
-%AddNamedProperty(Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM);
+%AddNamedProperty(GlobalMath, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM);
// Set up math constants.
-utils.InstallConstants(Math, [
+utils.InstallConstants(GlobalMath, [
// ECMA-262, section 15.8.1.1.
"E", 2.7182818284590452354,
// ECMA-262, section 15.8.1.2.
@@ -317,7 +308,7 @@ utils.InstallConstants(Math, [
// Set up non-enumerable functions of the Math object and
// set their names.
-utils.InstallFunctions(Math, DONT_ENUM, [
+utils.InstallFunctions(GlobalMath, DONT_ENUM, [
"random", MathRandom,
"abs", MathAbs,
"acos", MathAcosJS,
« no previous file with comments | « src/json-stringifier.h ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698