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

Side by Side Diff: src/math.js

Issue 1154483002: Hook up more import/exports in natives. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: do not leak utils object Created 5 years, 7 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
« no previous file with comments | « src/macros.py ('k') | src/messages.js » ('j') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var rngstate; // Initialized to a Uint32Array during genesis. 5 var rngstate; // Initialized to a Uint32Array during genesis.
6 6
7 (function(global, utils) { 7 (function(global, utils) {
8 8
9 "use strict"; 9 "use strict";
10 10
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 var Math = new MathConstructor(); 286 var Math = new MathConstructor();
287 287
288 %InternalSetPrototype(Math, GlobalObject.prototype); 288 %InternalSetPrototype(Math, GlobalObject.prototype);
289 %AddNamedProperty(global, "Math", Math, DONT_ENUM); 289 %AddNamedProperty(global, "Math", Math, DONT_ENUM);
290 %FunctionSetInstanceClassName(MathConstructor, 'Math'); 290 %FunctionSetInstanceClassName(MathConstructor, 'Math');
291 291
292 %AddNamedProperty(Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM); 292 %AddNamedProperty(Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM);
293 293
294 // Set up math constants. 294 // Set up math constants.
295 $installConstants(Math, [ 295 utils.InstallConstants(Math, [
296 // ECMA-262, section 15.8.1.1. 296 // ECMA-262, section 15.8.1.1.
297 "E", 2.7182818284590452354, 297 "E", 2.7182818284590452354,
298 // ECMA-262, section 15.8.1.2. 298 // ECMA-262, section 15.8.1.2.
299 "LN10", 2.302585092994046, 299 "LN10", 2.302585092994046,
300 // ECMA-262, section 15.8.1.3. 300 // ECMA-262, section 15.8.1.3.
301 "LN2", 0.6931471805599453, 301 "LN2", 0.6931471805599453,
302 // ECMA-262, section 15.8.1.4. 302 // ECMA-262, section 15.8.1.4.
303 "LOG2E", 1.4426950408889634, 303 "LOG2E", 1.4426950408889634,
304 "LOG10E", 0.4342944819032518, 304 "LOG10E", 0.4342944819032518,
305 "PI", 3.1415926535897932, 305 "PI", 3.1415926535897932,
306 "SQRT1_2", 0.7071067811865476, 306 "SQRT1_2", 0.7071067811865476,
307 "SQRT2", 1.4142135623730951 307 "SQRT2", 1.4142135623730951
308 ]); 308 ]);
309 309
310 // Set up non-enumerable functions of the Math object and 310 // Set up non-enumerable functions of the Math object and
311 // set their names. 311 // set their names.
312 $installFunctions(Math, DONT_ENUM, [ 312 utils.InstallFunctions(Math, DONT_ENUM, [
313 "random", MathRandom, 313 "random", MathRandom,
314 "abs", MathAbs, 314 "abs", MathAbs,
315 "acos", MathAcosJS, 315 "acos", MathAcosJS,
316 "asin", MathAsinJS, 316 "asin", MathAsinJS,
317 "atan", MathAtanJS, 317 "atan", MathAtanJS,
318 "ceil", MathCeil, 318 "ceil", MathCeil,
319 "exp", MathExp, 319 "exp", MathExp,
320 "floor", MathFloorJS, 320 "floor", MathFloorJS,
321 "log", MathLog, 321 "log", MathLog,
322 "round", MathRound, 322 "round", MathRound,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 utils.Export(function(to) { 357 utils.Export(function(to) {
358 to.MathAbs = MathAbs; 358 to.MathAbs = MathAbs;
359 to.MathExp = MathExp; 359 to.MathExp = MathExp;
360 to.MathFloor = MathFloorJS; 360 to.MathFloor = MathFloorJS;
361 to.MathMax = MathMax; 361 to.MathMax = MathMax;
362 to.MathMin = MathMin; 362 to.MathMin = MathMin;
363 }); 363 });
364 364
365 }) 365 })
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698