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; |
| 67 var $createStrongEmptyArray; |
66 var $defaultNumber; | 68 var $defaultNumber; |
67 var $defaultString; | 69 var $defaultString; |
68 var $NaN; | 70 var $NaN; |
69 var $nonNumberToNumber; | 71 var $nonNumberToNumber; |
70 var $nonStringToString; | 72 var $nonStringToString; |
71 var $sameValue; | 73 var $sameValue; |
72 var $sameValueZero; | 74 var $sameValueZero; |
73 var $toBoolean; | 75 var $toBoolean; |
74 var $toInt32; | 76 var $toInt32; |
75 var $toInteger; | 77 var $toInteger; |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 979 } |
978 throw MakeTypeError(kCannotConvertToPrimitive); | 980 throw MakeTypeError(kCannotConvertToPrimitive); |
979 } | 981 } |
980 | 982 |
981 function ToPositiveInteger(x, rangeErrorIndex) { | 983 function ToPositiveInteger(x, rangeErrorIndex) { |
982 var i = TO_INTEGER_MAP_MINUS_ZERO(x); | 984 var i = TO_INTEGER_MAP_MINUS_ZERO(x); |
983 if (i < 0) throw MakeRangeError(rangeErrorIndex); | 985 if (i < 0) throw MakeRangeError(rangeErrorIndex); |
984 return i; | 986 return i; |
985 } | 987 } |
986 | 988 |
| 989 function CreateEmptyArray() { |
| 990 return []; |
| 991 } |
| 992 |
| 993 function CreateStrongEmptyArray() { |
| 994 "use strong"; |
| 995 return []; |
| 996 } |
| 997 |
987 //---------------------------------------------------------------------------- | 998 //---------------------------------------------------------------------------- |
988 | 999 |
989 // NOTE: Setting the prototype for Array must take place as early as | 1000 // NOTE: Setting the prototype for Array must take place as early as |
990 // possible due to code generation for array literals. When | 1001 // possible due to code generation for array literals. When |
991 // generating code for a array literal a boilerplate array is created | 1002 // generating code for a array literal a boilerplate array is created |
992 // that is cloned when running the code. It is essential that the | 1003 // that is cloned when running the code. It is essential that the |
993 // boilerplate gets the right prototype. | 1004 // boilerplate gets the right prototype. |
994 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); | 1005 %FunctionSetPrototype(GlobalArray, new GlobalArray(0)); |
995 | 1006 |
996 //---------------------------------------------------------------------------- | 1007 //---------------------------------------------------------------------------- |
(...skipping 10 matching lines...) Expand all Loading... |
1007 $toInt32 = ToInt32; | 1018 $toInt32 = ToInt32; |
1008 $toInteger = ToInteger; | 1019 $toInteger = ToInteger; |
1009 $toLength = ToLength; | 1020 $toLength = ToLength; |
1010 $toName = ToName; | 1021 $toName = ToName; |
1011 $toNumber = ToNumber; | 1022 $toNumber = ToNumber; |
1012 $toObject = ToObject; | 1023 $toObject = ToObject; |
1013 $toPositiveInteger = ToPositiveInteger; | 1024 $toPositiveInteger = ToPositiveInteger; |
1014 $toPrimitive = ToPrimitive; | 1025 $toPrimitive = ToPrimitive; |
1015 $toString = ToString; | 1026 $toString = ToString; |
1016 $toUint32 = ToUint32; | 1027 $toUint32 = ToUint32; |
| 1028 $createEmptyArray = CreateEmptyArray |
| 1029 $createStrongEmptyArray = CreateStrongEmptyArray; |
1017 | 1030 |
1018 }) | 1031 }) |
OLD | NEW |