OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } else { | 210 } else { |
211 return TO_STRING(x); | 211 return TO_STRING(x); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 function ConvertToLocaleString(e) { | 216 function ConvertToLocaleString(e) { |
217 if (IS_NULL_OR_UNDEFINED(e)) { | 217 if (IS_NULL_OR_UNDEFINED(e)) { |
218 return ''; | 218 return ''; |
219 } else { | 219 } else { |
220 // According to ES5, section 15.4.4.3, the toLocaleString conversion | 220 return TO_STRING(e.toLocaleString()); |
221 // must throw a TypeError if ToObject(e).toLocaleString isn't | |
222 // callable. | |
223 var e_obj = TO_OBJECT(e); | |
224 return TO_STRING(e_obj.toLocaleString()); | |
225 } | 221 } |
226 } | 222 } |
227 | 223 |
228 | 224 |
229 // This function implements the optimized splice implementation that can use | 225 // This function implements the optimized splice implementation that can use |
230 // special array operations to handle sparse arrays in a sensible fashion. | 226 // special array operations to handle sparse arrays in a sensible fashion. |
231 function SparseSlice(array, start_i, del_count, len, deleted_elements) { | 227 function SparseSlice(array, start_i, del_count, len, deleted_elements) { |
232 // Move deleted elements to a new array (the return value from splice). | 228 // Move deleted elements to a new array (the return value from splice). |
233 var indices = %GetArrayKeys(array, start_i + del_count); | 229 var indices = %GetArrayKeys(array, start_i + del_count); |
234 if (IS_NUMBER(indices)) { | 230 if (IS_NUMBER(indices)) { |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 %InstallToContext([ | 1650 %InstallToContext([ |
1655 "array_pop", ArrayPop, | 1651 "array_pop", ArrayPop, |
1656 "array_push", ArrayPush, | 1652 "array_push", ArrayPush, |
1657 "array_shift", ArrayShift, | 1653 "array_shift", ArrayShift, |
1658 "array_splice", ArraySplice, | 1654 "array_splice", ArraySplice, |
1659 "array_slice", ArraySlice, | 1655 "array_slice", ArraySlice, |
1660 "array_unshift", ArrayUnshift, | 1656 "array_unshift", ArrayUnshift, |
1661 ]); | 1657 ]); |
1662 | 1658 |
1663 }); | 1659 }); |
OLD | NEW |