| 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 "use strict"; | 5 "use strict"; |
| 6 | 6 |
| 7 // This file relies on the fact that the following declarations have been made | 7 // This file relies on the fact that the following declarations have been made |
| 8 // in runtime.js: | 8 // in runtime.js: |
| 9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
| 10 | 10 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 var length = TO_UINT32(array.length); | 371 var length = TO_UINT32(array.length); |
| 372 if (IS_UNDEFINED(separator)) { | 372 if (IS_UNDEFINED(separator)) { |
| 373 separator = ','; | 373 separator = ','; |
| 374 } else if (!IS_STRING(separator)) { | 374 } else if (!IS_STRING(separator)) { |
| 375 separator = NonStringToString(separator); | 375 separator = NonStringToString(separator); |
| 376 } | 376 } |
| 377 | 377 |
| 378 var result = %_FastOneByteArrayJoin(array, separator); | 378 var result = %_FastOneByteArrayJoin(array, separator); |
| 379 if (!IS_UNDEFINED(result)) return result; | 379 if (!IS_UNDEFINED(result)) return result; |
| 380 | 380 |
| 381 // Fast case for one-element arrays. |
| 382 if (length === 1) { |
| 383 var e = array[0]; |
| 384 if (IS_STRING(e)) return e; |
| 385 if (IS_NULL_OR_UNDEFINED(e)) return ''; |
| 386 return NonStringToString(e); |
| 387 } |
| 388 |
| 381 return Join(array, length, separator, ConvertToString); | 389 return Join(array, length, separator, ConvertToString); |
| 382 } | 390 } |
| 383 | 391 |
| 384 | 392 |
| 385 function ObservedArrayPop(n) { | 393 function ObservedArrayPop(n) { |
| 386 n--; | 394 n--; |
| 387 var value = this[n]; | 395 var value = this[n]; |
| 388 | 396 |
| 389 try { | 397 try { |
| 390 BeginPerformSplice(this); | 398 BeginPerformSplice(this); |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 )); | 1555 )); |
| 1548 | 1556 |
| 1549 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( | 1557 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( |
| 1550 "join", getFunction("join", ArrayJoin), | 1558 "join", getFunction("join", ArrayJoin), |
| 1551 "pop", getFunction("pop", ArrayPop), | 1559 "pop", getFunction("pop", ArrayPop), |
| 1552 "push", getFunction("push", ArrayPush) | 1560 "push", getFunction("push", ArrayPush) |
| 1553 )); | 1561 )); |
| 1554 } | 1562 } |
| 1555 | 1563 |
| 1556 SetUpArray(); | 1564 SetUpArray(); |
| OLD | NEW |