| 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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 | 923 |
| 924 // ES6, section 7.2.4 | 924 // ES6, section 7.2.4 |
| 925 function SameValueZero(x, y) { | 925 function SameValueZero(x, y) { |
| 926 if (typeof x != typeof y) return false; | 926 if (typeof x != typeof y) return false; |
| 927 if (IS_NUMBER(x)) { | 927 if (IS_NUMBER(x)) { |
| 928 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; | 928 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; |
| 929 } | 929 } |
| 930 return x === y; | 930 return x === y; |
| 931 } | 931 } |
| 932 | 932 |
| 933 function ConcatIterableToArray(target, iterable) { |
| 934 var index = target.length; |
| 935 for (var element of iterable) { |
| 936 %AddElement(target, index++, element, NONE); |
| 937 } |
| 938 return target; |
| 939 } |
| 940 |
| 933 | 941 |
| 934 /* --------------------------------- | 942 /* --------------------------------- |
| 935 - - - U t i l i t i e s - - - | 943 - - - U t i l i t i e s - - - |
| 936 --------------------------------- | 944 --------------------------------- |
| 937 */ | 945 */ |
| 938 | 946 |
| 939 // Returns if the given x is a primitive value - not an object or a | 947 // Returns if the given x is a primitive value - not an object or a |
| 940 // function. | 948 // function. |
| 941 function IsPrimitive(x) { | 949 function IsPrimitive(x) { |
| 942 // Even though the type of null is "object", null is still | 950 // Even though the type of null is "object", null is still |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 | 1009 |
| 1002 // NOTE: Setting the prototype for Array must take place as early as | 1010 // NOTE: Setting the prototype for Array must take place as early as |
| 1003 // possible due to code generation for array literals. When | 1011 // possible due to code generation for array literals. When |
| 1004 // generating code for a array literal a boilerplate array is created | 1012 // generating code for a array literal a boilerplate array is created |
| 1005 // that is cloned when running the code. It is essential that the | 1013 // that is cloned when running the code. It is essential that the |
| 1006 // boilerplate gets the right prototype. | 1014 // boilerplate gets the right prototype. |
| 1007 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); | 1015 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); |
| 1008 | 1016 |
| 1009 //---------------------------------------------------------------------------- | 1017 //---------------------------------------------------------------------------- |
| 1010 | 1018 |
| 1019 $concatIterableToArray = ConcatIterableToArray; |
| 1011 $defaultNumber = DefaultNumber; | 1020 $defaultNumber = DefaultNumber; |
| 1012 $defaultString = DefaultString; | 1021 $defaultString = DefaultString; |
| 1013 $NaN = %GetRootNaN(); | 1022 $NaN = %GetRootNaN(); |
| 1014 $nonNumberToNumber = NonNumberToNumber; | 1023 $nonNumberToNumber = NonNumberToNumber; |
| 1015 $nonStringToString = NonStringToString; | 1024 $nonStringToString = NonStringToString; |
| 1016 $sameValue = SameValue; | 1025 $sameValue = SameValue; |
| 1017 $sameValueZero = SameValueZero; | 1026 $sameValueZero = SameValueZero; |
| 1018 $toBoolean = ToBoolean; | 1027 $toBoolean = ToBoolean; |
| 1019 $toInt32 = ToInt32; | 1028 $toInt32 = ToInt32; |
| 1020 $toInteger = ToInteger; | 1029 $toInteger = ToInteger; |
| 1021 $toLength = ToLength; | 1030 $toLength = ToLength; |
| 1022 $toName = ToName; | 1031 $toName = ToName; |
| 1023 $toNumber = ToNumber; | 1032 $toNumber = ToNumber; |
| 1024 $toObject = ToObject; | 1033 $toObject = ToObject; |
| 1025 $toPositiveInteger = ToPositiveInteger; | 1034 $toPositiveInteger = ToPositiveInteger; |
| 1026 $toPrimitive = ToPrimitive; | 1035 $toPrimitive = ToPrimitive; |
| 1027 $toString = ToString; | 1036 $toString = ToString; |
| 1028 $toUint32 = ToUint32; | 1037 $toUint32 = ToUint32; |
| 1029 | 1038 |
| 1030 }) | 1039 }) |
| OLD | NEW |