Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. | 5 // This files contains runtime support implemented in JavaScript. |
| 6 | 6 |
| 7 // CAUTION: Some of the functions specified in this file are called | 7 // CAUTION: Some of the functions specified in this file are called |
| 8 // directly from compiled code. These are the functions with names in | 8 // directly from compiled code. These are the functions with names in |
| 9 // ALL CAPS. The compiled code passes the first argument in 'this'. | 9 // ALL CAPS. The compiled code passes the first argument in 'this'. |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 var harmony_tolength = false; | 27 var harmony_tolength = false; |
| 28 | 28 |
| 29 (function(global, utils) { | 29 (function(global, utils) { |
| 30 | 30 |
| 31 %CheckIsBootstrapping(); | 31 %CheckIsBootstrapping(); |
| 32 | 32 |
| 33 var GlobalArray = global.Array; | 33 var GlobalArray = global.Array; |
| 34 var GlobalBoolean = global.Boolean; | 34 var GlobalBoolean = global.Boolean; |
| 35 var GlobalString = global.String; | 35 var GlobalString = global.String; |
| 36 var GlobalNumber = global.Number; | 36 var GlobalNumber = global.Number; |
|
adamk
2015/09/17 21:07:08
I don't think you need this import anymore.
aperez
2015/09/17 23:33:08
Acknowledged.
| |
| 37 var isConcatSpreadableSymbol = | 37 var isConcatSpreadableSymbol = |
| 38 utils.ImportNow("is_concat_spreadable_symbol"); | 38 utils.ImportNow("is_concat_spreadable_symbol"); |
| 39 | 39 |
| 40 // ---------------------------------------------------------------------------- | 40 // ---------------------------------------------------------------------------- |
| 41 | 41 |
| 42 /* ----------------------------------- | 42 /* ----------------------------------- |
| 43 - - - C o m p a r i s o n - - - | 43 - - - C o m p a r i s o n - - - |
| 44 ----------------------------------- | 44 ----------------------------------- |
| 45 */ | 45 */ |
| 46 | 46 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 function ToInteger(x) { | 295 function ToInteger(x) { |
| 296 if (%_IsSmi(x)) return x; | 296 if (%_IsSmi(x)) return x; |
| 297 return %NumberToInteger(ToNumber(x)); | 297 return %NumberToInteger(ToNumber(x)); |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 // ES6, draft 08-24-14, section 7.1.15 | 301 // ES6, draft 08-24-14, section 7.1.15 |
| 302 function ToLength(arg) { | 302 function ToLength(arg) { |
| 303 arg = ToInteger(arg); | 303 arg = ToInteger(arg); |
| 304 if (arg < 0) return 0; | 304 if (arg < 0) return 0; |
| 305 return arg < GlobalNumber.MAX_SAFE_INTEGER ? arg | 305 return arg < kMaxSafeInteger ? arg : kMaxSafeInteger; |
| 306 : GlobalNumber.MAX_SAFE_INTEGER; | |
| 307 } | 306 } |
| 308 | 307 |
| 309 | 308 |
| 310 // ES5, section 9.12 | 309 // ES5, section 9.12 |
| 311 function SameValue(x, y) { | 310 function SameValue(x, y) { |
| 312 if (typeof x != typeof y) return false; | 311 if (typeof x != typeof y) return false; |
| 313 if (IS_NUMBER(x)) { | 312 if (IS_NUMBER(x)) { |
| 314 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; | 313 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; |
| 315 // x is +0 and y is -0 or vice versa. | 314 // x is +0 and y is -0 or vice versa. |
| 316 if (x === 0 && y === 0 && %_IsMinusZero(x) != %_IsMinusZero(y)) { | 315 if (x === 0 && y === 0 && %_IsMinusZero(x) != %_IsMinusZero(y)) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 | 454 |
| 456 utils.Export(function(to) { | 455 utils.Export(function(to) { |
| 457 to.ToBoolean = ToBoolean; | 456 to.ToBoolean = ToBoolean; |
| 458 to.ToLength = ToLength; | 457 to.ToLength = ToLength; |
| 459 to.ToNumber = ToNumber; | 458 to.ToNumber = ToNumber; |
| 460 to.ToPrimitive = ToPrimitive; | 459 to.ToPrimitive = ToPrimitive; |
| 461 to.ToString = ToString; | 460 to.ToString = ToString; |
| 462 }); | 461 }); |
| 463 | 462 |
| 464 }) | 463 }) |
| OLD | NEW |