OLD | NEW |
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 Loading... |
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 Loading... |
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 }) |
OLD | NEW |