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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 | 722 |
| 723 // Return the length which is the number of arguments to copy to the | 723 // Return the length which is the number of arguments to copy to the |
| 724 // stack. It is guaranteed to be a small integer at this point. | 724 // stack. It is guaranteed to be a small integer at this point. |
| 725 return length; | 725 return length; |
| 726 } | 726 } |
| 727 | 727 |
| 728 | 728 |
| 729 STACK_OVERFLOW = function STACK_OVERFLOW(length) { | 729 STACK_OVERFLOW = function STACK_OVERFLOW(length) { |
| 730 throw %MakeRangeError(kStackOverflow); | 730 throw %MakeRangeError(kStackOverflow); |
| 731 } | 731 } |
| 732 | 732 |
|
arv (Not doing code reviews)
2015/05/20 13:34:14
undo this line removal... (it was probably from wh
Dmitry Lomov (no reviews)
2015/05/20 14:22:03
Done.
| |
| 733 | |
| 734 // Convert the receiver to an object - forward to ToObject. | 733 // Convert the receiver to an object - forward to ToObject. |
| 735 TO_OBJECT = function TO_OBJECT() { | 734 TO_OBJECT = function TO_OBJECT() { |
| 736 return %$toObject(this); | 735 return %$toObject(this); |
| 737 } | 736 } |
| 738 | 737 |
| 739 | 738 |
| 740 // Convert the receiver to a number - forward to ToNumber. | 739 // Convert the receiver to a number - forward to ToNumber. |
| 741 TO_NUMBER = function TO_NUMBER() { | 740 TO_NUMBER = function TO_NUMBER() { |
| 742 return %$toNumber(this); | 741 return %$toNumber(this); |
| 743 } | 742 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 923 | 922 |
| 924 // ES6, section 7.2.4 | 923 // ES6, section 7.2.4 |
| 925 function SameValueZero(x, y) { | 924 function SameValueZero(x, y) { |
| 926 if (typeof x != typeof y) return false; | 925 if (typeof x != typeof y) return false; |
| 927 if (IS_NUMBER(x)) { | 926 if (IS_NUMBER(x)) { |
| 928 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; | 927 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; |
| 929 } | 928 } |
| 930 return x === y; | 929 return x === y; |
| 931 } | 930 } |
| 932 | 931 |
| 932 function SpreadIntoArray(target, iterable) { | |
|
rossberg
2015/05/20 12:57:35
Nit: ConcatIterableToArray
arv (Not doing code reviews)
2015/05/20 13:34:14
It is not to array... it adds it to an existing ar
arv (Not doing code reviews)
2015/05/20 13:39:45
There is also $spreadIterable which almost does th
rossberg
2015/05/20 13:49:39
Hence Concat...ToArray ;)
Dmitry Lomov (no reviews)
2015/05/20 14:22:03
Done.
| |
| 933 var index = target.length; | |
| 934 for (var element of iterable) { | |
| 935 %AddElement(target, index++, element, NONE); | |
| 936 } | |
| 937 return target; | |
| 938 } | |
| 939 | |
| 933 | 940 |
| 934 /* --------------------------------- | 941 /* --------------------------------- |
| 935 - - - U t i l i t i e s - - - | 942 - - - U t i l i t i e s - - - |
| 936 --------------------------------- | 943 --------------------------------- |
| 937 */ | 944 */ |
| 938 | 945 |
| 939 // Returns if the given x is a primitive value - not an object or a | 946 // Returns if the given x is a primitive value - not an object or a |
| 940 // function. | 947 // function. |
| 941 function IsPrimitive(x) { | 948 function IsPrimitive(x) { |
| 942 // Even though the type of null is "object", null is still | 949 // Even though the type of null is "object", null is still |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1008 | 1015 |
| 1009 //---------------------------------------------------------------------------- | 1016 //---------------------------------------------------------------------------- |
| 1010 | 1017 |
| 1011 $defaultNumber = DefaultNumber; | 1018 $defaultNumber = DefaultNumber; |
| 1012 $defaultString = DefaultString; | 1019 $defaultString = DefaultString; |
| 1013 $NaN = %GetRootNaN(); | 1020 $NaN = %GetRootNaN(); |
| 1014 $nonNumberToNumber = NonNumberToNumber; | 1021 $nonNumberToNumber = NonNumberToNumber; |
| 1015 $nonStringToString = NonStringToString; | 1022 $nonStringToString = NonStringToString; |
| 1016 $sameValue = SameValue; | 1023 $sameValue = SameValue; |
| 1017 $sameValueZero = SameValueZero; | 1024 $sameValueZero = SameValueZero; |
| 1025 $spreadIntoArray = SpreadIntoArray; | |
| 1018 $toBoolean = ToBoolean; | 1026 $toBoolean = ToBoolean; |
| 1019 $toInt32 = ToInt32; | 1027 $toInt32 = ToInt32; |
| 1020 $toInteger = ToInteger; | 1028 $toInteger = ToInteger; |
| 1021 $toLength = ToLength; | 1029 $toLength = ToLength; |
| 1022 $toName = ToName; | 1030 $toName = ToName; |
| 1023 $toNumber = ToNumber; | 1031 $toNumber = ToNumber; |
| 1024 $toObject = ToObject; | 1032 $toObject = ToObject; |
| 1025 $toPositiveInteger = ToPositiveInteger; | 1033 $toPositiveInteger = ToPositiveInteger; |
| 1026 $toPrimitive = ToPrimitive; | 1034 $toPrimitive = ToPrimitive; |
| 1027 $toString = ToString; | 1035 $toString = ToString; |
| 1028 $toUint32 = ToUint32; | 1036 $toUint32 = ToUint32; |
| 1029 | 1037 |
| 1030 }) | 1038 }) |
| OLD | NEW |