| 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 |
| 11 | 11 |
| 12 // The following declarations are shared with other native JS files. | 12 // The following declarations are shared with other native JS files. |
| 13 // They are all declared at this one spot to avoid redeclaration errors. | 13 // They are all declared at this one spot to avoid redeclaration errors. |
| 14 var $defaultNumber; | |
| 15 var $defaultString; | 14 var $defaultString; |
| 16 var $NaN; | 15 var $NaN; |
| 17 var $nonNumberToNumber; | 16 var $nonNumberToNumber; |
| 18 var $nonStringToString; | 17 var $nonStringToString; |
| 19 var $sameValue; | 18 var $sameValue; |
| 20 var $sameValueZero; | 19 var $sameValueZero; |
| 21 var $toInteger; | 20 var $toInteger; |
| 22 var $toLength; | 21 var $toLength; |
| 23 var $toName; | 22 var $toName; |
| 24 var $toNumber; | 23 var $toNumber; |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 // NOTE: Setting the prototype for Array must take place as early as | 818 // NOTE: Setting the prototype for Array must take place as early as |
| 820 // possible due to code generation for array literals. When | 819 // possible due to code generation for array literals. When |
| 821 // generating code for a array literal a boilerplate array is created | 820 // generating code for a array literal a boilerplate array is created |
| 822 // that is cloned when running the code. It is essential that the | 821 // that is cloned when running the code. It is essential that the |
| 823 // boilerplate gets the right prototype. | 822 // boilerplate gets the right prototype. |
| 824 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); | 823 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); |
| 825 | 824 |
| 826 // ---------------------------------------------------------------------------- | 825 // ---------------------------------------------------------------------------- |
| 827 // Exports | 826 // Exports |
| 828 | 827 |
| 829 $defaultNumber = DefaultNumber; | |
| 830 $defaultString = DefaultString; | 828 $defaultString = DefaultString; |
| 831 $NaN = %GetRootNaN(); | 829 $NaN = %GetRootNaN(); |
| 832 $nonNumberToNumber = NonNumberToNumber; | 830 $nonNumberToNumber = NonNumberToNumber; |
| 833 $nonStringToString = NonStringToString; | 831 $nonStringToString = NonStringToString; |
| 834 $sameValue = SameValue; | 832 $sameValue = SameValue; |
| 835 $sameValueZero = SameValueZero; | 833 $sameValueZero = SameValueZero; |
| 836 $toInteger = ToInteger; | 834 $toInteger = ToInteger; |
| 837 $toLength = ToLength; | 835 $toLength = ToLength; |
| 838 $toName = ToName; | 836 $toName = ToName; |
| 839 $toNumber = ToNumber; | 837 $toNumber = ToNumber; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 "shl_builtin", SHL, | 871 "shl_builtin", SHL, |
| 874 "shl_strong_builtin", SHL_STRONG, | 872 "shl_strong_builtin", SHL_STRONG, |
| 875 "shr_builtin", SHR, | 873 "shr_builtin", SHR, |
| 876 "shr_strong_builtin", SHR_STRONG, | 874 "shr_strong_builtin", SHR_STRONG, |
| 877 "stack_overflow_builtin", STACK_OVERFLOW, | 875 "stack_overflow_builtin", STACK_OVERFLOW, |
| 878 "string_add_left_builtin", STRING_ADD_LEFT, | 876 "string_add_left_builtin", STRING_ADD_LEFT, |
| 879 "string_add_right_builtin", STRING_ADD_RIGHT, | 877 "string_add_right_builtin", STRING_ADD_RIGHT, |
| 880 "sub_builtin", SUB, | 878 "sub_builtin", SUB, |
| 881 "sub_strong_builtin", SUB_STRONG, | 879 "sub_strong_builtin", SUB_STRONG, |
| 882 "to_name_builtin", TO_NAME, | 880 "to_name_builtin", TO_NAME, |
| 883 "to_number_builtin", TO_NUMBER, | |
| 884 "to_string_builtin", TO_STRING, | 881 "to_string_builtin", TO_STRING, |
| 885 ]); | 882 ]); |
| 886 | 883 |
| 887 %InstallToContext([ | 884 %InstallToContext([ |
| 888 "concat_iterable_to_array", ConcatIterableToArray, | 885 "concat_iterable_to_array", ConcatIterableToArray, |
| 889 "non_number_to_number", NonNumberToNumber, | 886 "non_number_to_number", NonNumberToNumber, |
| 890 "non_string_to_string", NonStringToString, | 887 "non_string_to_string", NonStringToString, |
| 891 "to_integer_fun", ToInteger, | 888 "to_integer_fun", ToInteger, |
| 892 "to_length_fun", ToLength, | 889 "to_length_fun", ToLength, |
| 893 "to_name", ToName, | 890 "to_name", ToName, |
| 894 "to_number_fun", ToNumber, | 891 "to_number_fun", ToNumber, |
| 895 "to_primitive", ToPrimitive, | 892 "to_primitive", ToPrimitive, |
| 896 "to_string_fun", ToString, | 893 "to_string_fun", ToString, |
| 897 ]); | 894 ]); |
| 898 | 895 |
| 899 utils.Export(function(to) { | 896 utils.Export(function(to) { |
| 900 to.ToBoolean = ToBoolean; | 897 to.ToBoolean = ToBoolean; |
| 901 to.ToLength = ToLength; | 898 to.ToLength = ToLength; |
| 902 to.ToName = ToName; | 899 to.ToName = ToName; |
| 903 to.ToNumber = ToNumber; | 900 to.ToNumber = ToNumber; |
| 904 to.ToPrimitive = ToPrimitive; | 901 to.ToPrimitive = ToPrimitive; |
| 905 to.ToString = ToString; | 902 to.ToString = ToString; |
| 906 }); | 903 }); |
| 907 | 904 |
| 908 }) | 905 }) |
| OLD | NEW |