OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // remaining elements are also likely to be numbers. | 165 // remaining elements are also likely to be numbers. |
166 if (!IS_NUMBER(array[0])) { | 166 if (!IS_NUMBER(array[0])) { |
167 for (var i = 0; i < length; i++) { | 167 for (var i = 0; i < length; i++) { |
168 var e = array[i]; | 168 var e = array[i]; |
169 if (!IS_STRING(e)) e = convert(e); | 169 if (!IS_STRING(e)) e = convert(e); |
170 elements[i] = e; | 170 elements[i] = e; |
171 } | 171 } |
172 } else { | 172 } else { |
173 for (var i = 0; i < length; i++) { | 173 for (var i = 0; i < length; i++) { |
174 var e = array[i]; | 174 var e = array[i]; |
175 if (IS_NUMBER(e)) { | 175 if (IS_NUMBER(e)) { |
176 e = %_NumberToString(e); | 176 e = %_NumberToString(e); |
177 } else if (!IS_STRING(e)) { | 177 } else if (!IS_STRING(e)) { |
178 e = convert(e); | 178 e = convert(e); |
179 } | 179 } |
180 elements[i] = e; | 180 elements[i] = e; |
181 } | 181 } |
182 } | 182 } |
183 var result = %_FastAsciiArrayJoin(elements, separator); | 183 var result = %_FastAsciiArrayJoin(elements, separator); |
184 if (!IS_UNDEFINED(result)) return result; | 184 if (!IS_UNDEFINED(result)) return result; |
185 | 185 |
186 return %StringBuilderJoin(elements, length, separator); | 186 return %StringBuilderJoin(elements, length, separator); |
187 } finally { | 187 } finally { |
188 // Make sure to remove the last element of the visited array no | 188 // Make sure to remove the last element of the visited array no |
189 // matter what happens. | 189 // matter what happens. |
190 if (is_array) visited_arrays.length = visited_arrays.length - 1; | 190 if (is_array) visited_arrays.length = visited_arrays.length - 1; |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 // exposed to user code. | 1415 // exposed to user code. |
1416 // Adding only the functions that are actually used. | 1416 // Adding only the functions that are actually used. |
1417 SetUpLockedPrototype(InternalArray, $Array(), $Array( | 1417 SetUpLockedPrototype(InternalArray, $Array(), $Array( |
1418 "join", getFunction("join", ArrayJoin), | 1418 "join", getFunction("join", ArrayJoin), |
1419 "pop", getFunction("pop", ArrayPop), | 1419 "pop", getFunction("pop", ArrayPop), |
1420 "push", getFunction("push", ArrayPush) | 1420 "push", getFunction("push", ArrayPush) |
1421 )); | 1421 )); |
1422 } | 1422 } |
1423 | 1423 |
1424 SetUpArray(); | 1424 SetUpArray(); |
OLD | NEW |