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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 var CONCAT_ITERABLE_TO_ARRAY; | 56 var CONCAT_ITERABLE_TO_ARRAY; |
57 var APPLY_PREPARE; | 57 var APPLY_PREPARE; |
58 var REFLECT_APPLY_PREPARE; | 58 var REFLECT_APPLY_PREPARE; |
59 var REFLECT_CONSTRUCT_PREPARE; | 59 var REFLECT_CONSTRUCT_PREPARE; |
60 var STACK_OVERFLOW; | 60 var STACK_OVERFLOW; |
61 var TO_OBJECT; | 61 var TO_OBJECT; |
62 var TO_NUMBER; | 62 var TO_NUMBER; |
63 var TO_STRING; | 63 var TO_STRING; |
64 var TO_NAME; | 64 var TO_NAME; |
65 | 65 |
| 66 var $createEmptyArray; |
66 var $defaultNumber; | 67 var $defaultNumber; |
67 var $defaultString; | 68 var $defaultString; |
68 var $NaN; | 69 var $NaN; |
69 var $nonNumberToNumber; | 70 var $nonNumberToNumber; |
70 var $nonStringToString; | 71 var $nonStringToString; |
71 var $sameValue; | 72 var $sameValue; |
72 var $sameValueZero; | 73 var $sameValueZero; |
73 var $toBoolean; | 74 var $toBoolean; |
74 var $toInt32; | 75 var $toInt32; |
75 var $toInteger; | 76 var $toInteger; |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 } | 960 } |
960 throw MakeTypeError(kCannotConvertToPrimitive); | 961 throw MakeTypeError(kCannotConvertToPrimitive); |
961 } | 962 } |
962 | 963 |
963 function ToPositiveInteger(x, rangeErrorIndex) { | 964 function ToPositiveInteger(x, rangeErrorIndex) { |
964 var i = TO_INTEGER_MAP_MINUS_ZERO(x); | 965 var i = TO_INTEGER_MAP_MINUS_ZERO(x); |
965 if (i < 0) throw MakeRangeError(rangeErrorIndex); | 966 if (i < 0) throw MakeRangeError(rangeErrorIndex); |
966 return i; | 967 return i; |
967 } | 968 } |
968 | 969 |
| 970 function CreateEmptyArray() { |
| 971 return []; |
| 972 } |
| 973 |
969 //---------------------------------------------------------------------------- | 974 //---------------------------------------------------------------------------- |
970 | 975 |
971 // NOTE: Setting the prototype for Array must take place as early as | 976 // NOTE: Setting the prototype for Array must take place as early as |
972 // possible due to code generation for array literals. When | 977 // possible due to code generation for array literals. When |
973 // generating code for a array literal a boilerplate array is created | 978 // generating code for a array literal a boilerplate array is created |
974 // that is cloned when running the code. It is essential that the | 979 // that is cloned when running the code. It is essential that the |
975 // boilerplate gets the right prototype. | 980 // boilerplate gets the right prototype. |
976 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); | 981 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); |
977 | 982 |
978 //---------------------------------------------------------------------------- | 983 //---------------------------------------------------------------------------- |
(...skipping 10 matching lines...) Expand all Loading... |
989 $toInt32 = ToInt32; | 994 $toInt32 = ToInt32; |
990 $toInteger = ToInteger; | 995 $toInteger = ToInteger; |
991 $toLength = ToLength; | 996 $toLength = ToLength; |
992 $toName = ToName; | 997 $toName = ToName; |
993 $toNumber = ToNumber; | 998 $toNumber = ToNumber; |
994 $toObject = ToObject; | 999 $toObject = ToObject; |
995 $toPositiveInteger = ToPositiveInteger; | 1000 $toPositiveInteger = ToPositiveInteger; |
996 $toPrimitive = ToPrimitive; | 1001 $toPrimitive = ToPrimitive; |
997 $toString = ToString; | 1002 $toString = ToString; |
998 $toUint32 = ToUint32; | 1003 $toUint32 = ToUint32; |
999 | 1004 $createEmptyArray = CreateEmptyArray; |
1000 }) | 1005 }) |
OLD | NEW |