| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return %StringBuilderJoin(elements, length, separator); | 202 return %StringBuilderJoin(elements, length, separator); |
| 203 } finally { | 203 } finally { |
| 204 // Make sure to remove the last element of the visited array no | 204 // Make sure to remove the last element of the visited array no |
| 205 // matter what happens. | 205 // matter what happens. |
| 206 if (is_array) visited_arrays.length = visited_arrays.length - 1; | 206 if (is_array) visited_arrays.length = visited_arrays.length - 1; |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 function ConvertToString(x) { | 211 function ConvertToString(x) { |
| 212 // Assumes x is a non-string. | 212 if (IS_NULL_OR_UNDEFINED(x)) { |
| 213 if (IS_NUMBER(x)) return %_NumberToString(x); | 213 return ''; |
| 214 if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; | 214 } else { |
| 215 return (IS_NULL_OR_UNDEFINED(x)) ? '' : ToString($defaultString(x)); | 215 return TO_STRING(x); |
| 216 } |
| 216 } | 217 } |
| 217 | 218 |
| 218 | 219 |
| 219 function ConvertToLocaleString(e) { | 220 function ConvertToLocaleString(e) { |
| 220 if (IS_NULL_OR_UNDEFINED(e)) { | 221 if (IS_NULL_OR_UNDEFINED(e)) { |
| 221 return ''; | 222 return ''; |
| 222 } else { | 223 } else { |
| 223 // According to ES5, section 15.4.4.3, the toLocaleString conversion | 224 // According to ES5, section 15.4.4.3, the toLocaleString conversion |
| 224 // must throw a TypeError if ToObject(e).toLocaleString isn't | 225 // must throw a TypeError if ToObject(e).toLocaleString isn't |
| 225 // callable. | 226 // callable. |
| 226 var e_obj = TO_OBJECT(e); | 227 var e_obj = TO_OBJECT(e); |
| 227 return ToString(e_obj.toLocaleString()); | 228 return TO_STRING(e_obj.toLocaleString()); |
| 228 } | 229 } |
| 229 } | 230 } |
| 230 | 231 |
| 231 | 232 |
| 232 // This function implements the optimized splice implementation that can use | 233 // This function implements the optimized splice implementation that can use |
| 233 // special array operations to handle sparse arrays in a sensible fashion. | 234 // special array operations to handle sparse arrays in a sensible fashion. |
| 234 function SparseSlice(array, start_i, del_count, len, deleted_elements) { | 235 function SparseSlice(array, start_i, del_count, len, deleted_elements) { |
| 235 // Move deleted elements to a new array (the return value from splice). | 236 // Move deleted elements to a new array (the return value from splice). |
| 236 var indices = %GetArrayKeys(array, start_i + del_count); | 237 var indices = %GetArrayKeys(array, start_i + del_count); |
| 237 if (IS_NUMBER(indices)) { | 238 if (IS_NUMBER(indices)) { |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 %InstallToContext([ | 1658 %InstallToContext([ |
| 1658 "array_pop", ArrayPop, | 1659 "array_pop", ArrayPop, |
| 1659 "array_push", ArrayPush, | 1660 "array_push", ArrayPush, |
| 1660 "array_shift", ArrayShift, | 1661 "array_shift", ArrayShift, |
| 1661 "array_splice", ArraySplice, | 1662 "array_splice", ArraySplice, |
| 1662 "array_slice", ArraySlice, | 1663 "array_slice", ArraySlice, |
| 1663 "array_unshift", ArrayUnshift, | 1664 "array_unshift", ArrayUnshift, |
| 1664 ]); | 1665 ]); |
| 1665 | 1666 |
| 1666 }); | 1667 }); |
| OLD | NEW |