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

Unified Diff: src/math.js

Issue 14125004: Move global code for builtins into setup functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 7 years, 8 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.js ('k') | src/proxy.js » ('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 0e025410254f9ca48f59c79b515fea6d1d1e1c67..e5ab70cc1eb6ee236c79e21db7d73d633533a6b0 100644
--- a/src/math.js
+++ b/src/math.js
@@ -25,6 +25,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// This file relies on the fact that the following declarations have been made
+// in runtime.js:
+// var $Object = global.Object;
// Keep reference to original values of some global properties. This
// has the added benefit that the code in this file is isolated from
@@ -35,10 +38,9 @@ var $abs = MathAbs;
// Instance class name can only be set on functions. That is the only
// purpose for MathConstructor.
function MathConstructor() {}
-%FunctionSetInstanceClassName(MathConstructor, 'Math');
var $Math = new MathConstructor();
-%SetPrototype($Math, $Object.prototype);
-%SetProperty(global, "Math", $Math, DONT_ENUM);
+
+// -------------------------------------------------------------------
// ECMA 262 - 15.8.2.1
function MathAbs(x) {
@@ -216,6 +218,11 @@ function MathTan(x) {
function SetUpMath() {
%CheckIsBootstrapping();
+
+ %SetPrototype($Math, $Object.prototype);
+ %SetProperty(global, "Math", $Math, DONT_ENUM);
+ %FunctionSetInstanceClassName(MathConstructor, 'Math');
+
// Set up math constants.
// ECMA-262, section 15.8.1.1.
%OptimizeObjectForAddingMultipleProperties($Math, 8);
« no previous file with comments | « src/json.js ('k') | src/proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698