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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 var current = this[i]; | 976 var current = this[i]; |
977 if (!IS_UNDEFINED(current) || i in this) { | 977 if (!IS_UNDEFINED(current) || i in this) { |
978 result[i] = f.call(receiver, current, i, this); | 978 result[i] = f.call(receiver, current, i, this); |
979 } | 979 } |
980 } | 980 } |
981 return result; | 981 return result; |
982 } | 982 } |
983 | 983 |
984 | 984 |
985 function ArrayIndexOf(element, index) { | 985 function ArrayIndexOf(element, index) { |
986 if (IS_UNDEFINED(element)) { | |
987 throw MakeTypeError('array_indexof_not_defined', [element]); | |
988 } | |
989 var length = this.length; | 986 var length = this.length; |
990 if (index == null) { | 987 if (index == null) { |
991 index = 0; | 988 index = 0; |
992 } else { | 989 } else { |
993 index = TO_INTEGER(index); | 990 index = TO_INTEGER(index); |
994 // If index is negative, index from the end of the array. | 991 // If index is negative, index from the end of the array. |
995 if (index < 0) index = length + index; | 992 if (index < 0) index = length + index; |
996 // If index is still negative, search the entire array. | 993 // If index is still negative, search the entire array. |
997 if (index < 0) index = 0; | 994 if (index < 0) index = 0; |
998 } | 995 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 ArrayIndexOf: 1, | 1145 ArrayIndexOf: 1, |
1149 ArrayLastIndexOf: 1, | 1146 ArrayLastIndexOf: 1, |
1150 ArrayPush: 1, | 1147 ArrayPush: 1, |
1151 ArrayReduce: 1, | 1148 ArrayReduce: 1, |
1152 ArrayReduceRight: 1 | 1149 ArrayReduceRight: 1 |
1153 }); | 1150 }); |
1154 } | 1151 } |
1155 | 1152 |
1156 | 1153 |
1157 SetupArray(); | 1154 SetupArray(); |
OLD | NEW |