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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 var SHR; | 47 var SHR; |
48 var SHR_STRONG; | 48 var SHR_STRONG; |
49 var DELETE; | 49 var DELETE; |
50 var IN; | 50 var IN; |
51 var INSTANCE_OF; | 51 var INSTANCE_OF; |
52 var FILTER_KEY; | 52 var FILTER_KEY; |
53 var CALL_NON_FUNCTION; | 53 var CALL_NON_FUNCTION; |
54 var CALL_NON_FUNCTION_AS_CONSTRUCTOR; | 54 var CALL_NON_FUNCTION_AS_CONSTRUCTOR; |
55 var CALL_FUNCTION_PROXY; | 55 var CALL_FUNCTION_PROXY; |
56 var CALL_FUNCTION_PROXY_AS_CONSTRUCTOR; | 56 var CALL_FUNCTION_PROXY_AS_CONSTRUCTOR; |
57 var CONCAT_ITERABLE_TO_ARRAY; | |
57 var APPLY_PREPARE; | 58 var APPLY_PREPARE; |
58 var REFLECT_APPLY_PREPARE; | 59 var REFLECT_APPLY_PREPARE; |
59 var REFLECT_CONSTRUCT_PREPARE; | 60 var REFLECT_CONSTRUCT_PREPARE; |
60 var STACK_OVERFLOW; | 61 var STACK_OVERFLOW; |
61 var TO_OBJECT; | 62 var TO_OBJECT; |
62 var TO_NUMBER; | 63 var TO_NUMBER; |
63 var TO_STRING; | 64 var TO_STRING; |
64 var TO_NAME; | 65 var TO_NAME; |
65 | 66 |
66 var StringLengthTF_STUB; | 67 var StringLengthTF_STUB; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
719 // big enough, but sanity check the value to avoid overflow when | 720 // big enough, but sanity check the value to avoid overflow when |
720 // multiplying with pointer size. | 721 // multiplying with pointer size. |
721 if (length > kSafeArgumentsLength) throw %MakeRangeError(kStackOverflow); | 722 if (length > kSafeArgumentsLength) throw %MakeRangeError(kStackOverflow); |
722 | 723 |
723 // Return the length which is the number of arguments to copy to the | 724 // 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. | 725 // stack. It is guaranteed to be a small integer at this point. |
725 return length; | 726 return length; |
726 } | 727 } |
727 | 728 |
728 | 729 |
730 CONCAT_ITERABLE_TO_ARRAY = function CONCAT_ITERABLE_TO_ARRAY(iterable) { | |
731 return %$concatIterableToArray(this, iterable); | |
732 }; | |
733 | |
734 | |
729 STACK_OVERFLOW = function STACK_OVERFLOW(length) { | 735 STACK_OVERFLOW = function STACK_OVERFLOW(length) { |
730 throw %MakeRangeError(kStackOverflow); | 736 throw %MakeRangeError(kStackOverflow); |
731 } | 737 } |
732 | 738 |
733 | 739 |
734 // Convert the receiver to an object - forward to ToObject. | 740 // Convert the receiver to an object - forward to ToObject. |
735 TO_OBJECT = function TO_OBJECT() { | 741 TO_OBJECT = function TO_OBJECT() { |
736 return %$toObject(this); | 742 return %$toObject(this); |
737 } | 743 } |
738 | 744 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
934 | 940 |
935 function ConcatIterableToArray(target, iterable) { | 941 function ConcatIterableToArray(target, iterable) { |
936 var index = target.length; | 942 var index = target.length; |
937 for (var element of iterable) { | 943 for (var element of iterable) { |
938 %AddElement(target, index++, element, NONE); | 944 %AddElement(target, index++, element, NONE); |
939 } | 945 } |
940 return target; | 946 return target; |
941 } | 947 } |
942 | 948 |
943 | 949 |
950 function ConcatIterableToArray(target, iterable) { | |
Dmitry Lomov (no reviews)
2015/05/20 20:36:33
Duplicate function
arv (Not doing code reviews)
2015/05/20 20:57:44
Done.
Merge failure.
| |
951 var index = target.length; | |
952 for (var element of iterable) { | |
953 %AddElement(target, index++, element, NONE); | |
954 } | |
955 return target; | |
956 } | |
957 | |
958 | |
944 /* --------------------------------- | 959 /* --------------------------------- |
945 - - - U t i l i t i e s - - - | 960 - - - U t i l i t i e s - - - |
946 --------------------------------- | 961 --------------------------------- |
947 */ | 962 */ |
948 | 963 |
949 // Returns if the given x is a primitive value - not an object or a | 964 // Returns if the given x is a primitive value - not an object or a |
950 // function. | 965 // function. |
951 function IsPrimitive(x) { | 966 function IsPrimitive(x) { |
952 // Even though the type of null is "object", null is still | 967 // Even though the type of null is "object", null is still |
953 // considered a primitive value. IS_SPEC_OBJECT handles this correctly | 968 // considered a primitive value. IS_SPEC_OBJECT handles this correctly |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1032 $toLength = ToLength; | 1047 $toLength = ToLength; |
1033 $toName = ToName; | 1048 $toName = ToName; |
1034 $toNumber = ToNumber; | 1049 $toNumber = ToNumber; |
1035 $toObject = ToObject; | 1050 $toObject = ToObject; |
1036 $toPositiveInteger = ToPositiveInteger; | 1051 $toPositiveInteger = ToPositiveInteger; |
1037 $toPrimitive = ToPrimitive; | 1052 $toPrimitive = ToPrimitive; |
1038 $toString = ToString; | 1053 $toString = ToString; |
1039 $toUint32 = ToUint32; | 1054 $toUint32 = ToUint32; |
1040 | 1055 |
1041 }) | 1056 }) |
OLD | NEW |