| 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 var $toString; | 26 var $toString; |
| 27 | 27 |
| 28 (function(global, utils) { | 28 (function(global, utils) { |
| 29 | 29 |
| 30 %CheckIsBootstrapping(); | 30 %CheckIsBootstrapping(); |
| 31 | 31 |
| 32 var GlobalArray = global.Array; | 32 var GlobalArray = global.Array; |
| 33 var GlobalBoolean = global.Boolean; | 33 var GlobalBoolean = global.Boolean; |
| 34 var GlobalString = global.String; | 34 var GlobalString = global.String; |
| 35 var GlobalNumber = global.Number; | 35 var GlobalNumber = global.Number; |
| 36 var isConcatSpreadableSymbol = |
| 37 utils.ImportNow("is_concat_spreadable_symbol"); |
| 36 | 38 |
| 37 // ---------------------------------------------------------------------------- | 39 // ---------------------------------------------------------------------------- |
| 38 | 40 |
| 39 /* ----------------------------------- | 41 /* ----------------------------------- |
| 40 - - - C o m p a r i s o n - - - | 42 - - - C o m p a r i s o n - - - |
| 41 ----------------------------------- | 43 ----------------------------------- |
| 42 */ | 44 */ |
| 43 | 45 |
| 44 // ECMA-262 Section 11.9.3. | 46 // ECMA-262 Section 11.9.3. |
| 45 function EQUALS(y) { | 47 function EQUALS(y) { |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 // Even though the type of null is "object", null is still | 760 // Even though the type of null is "object", null is still |
| 759 // considered a primitive value. IS_SPEC_OBJECT handles this correctly | 761 // considered a primitive value. IS_SPEC_OBJECT handles this correctly |
| 760 // (i.e., it will return false if x is null). | 762 // (i.e., it will return false if x is null). |
| 761 return !IS_SPEC_OBJECT(x); | 763 return !IS_SPEC_OBJECT(x); |
| 762 } | 764 } |
| 763 | 765 |
| 764 | 766 |
| 765 // ES6, draft 10-14-14, section 22.1.3.1.1 | 767 // ES6, draft 10-14-14, section 22.1.3.1.1 |
| 766 function IsConcatSpreadable(O) { | 768 function IsConcatSpreadable(O) { |
| 767 if (!IS_SPEC_OBJECT(O)) return false; | 769 if (!IS_SPEC_OBJECT(O)) return false; |
| 768 var spreadable = O[symbolIsConcatSpreadable]; | 770 var spreadable = O[isConcatSpreadableSymbol]; |
| 769 if (IS_UNDEFINED(spreadable)) return IS_ARRAY(O); | 771 if (IS_UNDEFINED(spreadable)) return IS_ARRAY(O); |
| 770 return ToBoolean(spreadable); | 772 return ToBoolean(spreadable); |
| 771 } | 773 } |
| 772 | 774 |
| 773 | 775 |
| 774 // ECMA-262, section 8.6.2.6, page 28. | 776 // ECMA-262, section 8.6.2.6, page 28. |
| 775 function DefaultNumber(x) { | 777 function DefaultNumber(x) { |
| 776 var valueOf = x.valueOf; | 778 var valueOf = x.valueOf; |
| 777 if (IS_SPEC_FUNCTION(valueOf)) { | 779 if (IS_SPEC_FUNCTION(valueOf)) { |
| 778 var v = %_CallFunction(x, valueOf); | 780 var v = %_CallFunction(x, valueOf); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 utils.Export(function(to) { | 898 utils.Export(function(to) { |
| 897 to.ToBoolean = ToBoolean; | 899 to.ToBoolean = ToBoolean; |
| 898 to.ToLength = ToLength; | 900 to.ToLength = ToLength; |
| 899 to.ToName = ToName; | 901 to.ToName = ToName; |
| 900 to.ToNumber = ToNumber; | 902 to.ToNumber = ToNumber; |
| 901 to.ToPrimitive = ToPrimitive; | 903 to.ToPrimitive = ToPrimitive; |
| 902 to.ToString = ToString; | 904 to.ToString = ToString; |
| 903 }); | 905 }); |
| 904 | 906 |
| 905 }) | 907 }) |
| OLD | NEW |