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

Side by Side Diff: src/js/v8natives.js

Issue 2116753002: [builtins] Unify most of the remaining Math builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2102223005
Patch Set: Created 4 years, 5 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
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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 function NumberIsNaN(number) { 356 function NumberIsNaN(number) {
357 return IS_NUMBER(number) && NUMBER_IS_NAN(number); 357 return IS_NUMBER(number) && NUMBER_IS_NAN(number);
358 } 358 }
359 359
360 360
361 // Harmony isSafeInteger 361 // Harmony isSafeInteger
362 function NumberIsSafeInteger(number) { 362 function NumberIsSafeInteger(number) {
363 if (NumberIsFinite(number)) { 363 if (NumberIsFinite(number)) {
364 var integral = TO_INTEGER(number); 364 var integral = TO_INTEGER(number);
365 if (integral == number) { 365 if (integral == number) {
366 return %math_abs(integral) <= kMaxSafeInteger; 366 return -kMaxSafeInteger <= integral && integral <= kMaxSafeInteger;
367 } 367 }
368 } 368 }
369 return false; 369 return false;
370 } 370 }
371 371
372 372
373 // ---------------------------------------------------------------------------- 373 // ----------------------------------------------------------------------------
374 374
375 %FunctionSetPrototype(GlobalNumber, new GlobalNumber(0)); 375 %FunctionSetPrototype(GlobalNumber, new GlobalNumber(0));
376 376
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 to.NumberIsNaN = NumberIsNaN; 449 to.NumberIsNaN = NumberIsNaN;
450 to.NumberIsInteger = NumberIsInteger; 450 to.NumberIsInteger = NumberIsInteger;
451 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; 451 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty;
452 }); 452 });
453 453
454 %InstallToContext([ 454 %InstallToContext([
455 "object_value_of", ObjectValueOf, 455 "object_value_of", ObjectValueOf,
456 ]); 456 ]);
457 457
458 }) 458 })
OLDNEW
« src/compiler/js-builtin-reducer.cc ('K') | « src/js/math.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698