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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 var length2 = (length << 1) - 1; | 164 var length2 = (length << 1) - 1; |
165 var j = length2; | 165 var j = length2; |
166 var i = length; | 166 var i = length; |
167 elements[--j] = elements[--i]; | 167 elements[--j] = elements[--i]; |
168 while (i > 0) { | 168 while (i > 0) { |
169 elements[--j] = separator; | 169 elements[--j] = separator; |
170 elements[--j] = elements[--i]; | 170 elements[--j] = elements[--i]; |
171 } | 171 } |
172 return %StringBuilderConcat(elements, length2, ''); | 172 return %StringBuilderConcat(elements, length2, ''); |
173 } finally { | 173 } finally { |
174 // Make sure to pop the visited array no matter what happens. | 174 // Make sure to pop the visited array no matter what happens. |
Søren Thygesen Gjesse
2011/02/01 12:23:02
pop -> remove the last element?
Mads Ager (chromium)
2011/02/01 12:29:45
Done.
| |
175 if (is_array) visited_arrays.pop(); | 175 if (is_array) visited_arrays.length = visited_arrays.length - 1; |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 function ConvertToString(x) { | 180 function ConvertToString(x) { |
181 // Assumes x is a non-string. | 181 // Assumes x is a non-string. |
182 if (IS_NUMBER(x)) return %_NumberToString(x); | 182 if (IS_NUMBER(x)) return %_NumberToString(x); |
183 if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; | 183 if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; |
184 return (IS_NULL_OR_UNDEFINED(x)) ? '' : %ToString(%DefaultString(x)); | 184 return (IS_NULL_OR_UNDEFINED(x)) ? '' : %ToString(%DefaultString(x)); |
185 } | 185 } |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), | 1227 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), |
1228 "reduce", getFunction("reduce", ArrayReduce, 1), | 1228 "reduce", getFunction("reduce", ArrayReduce, 1), |
1229 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) | 1229 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) |
1230 )); | 1230 )); |
1231 | 1231 |
1232 %FinishArrayPrototypeSetup($Array.prototype); | 1232 %FinishArrayPrototypeSetup($Array.prototype); |
1233 } | 1233 } |
1234 | 1234 |
1235 | 1235 |
1236 SetupArray(); | 1236 SetupArray(); |
OLD | NEW |