| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 return Join(array, len, ',', ConvertToLocaleString); | 406 return Join(array, len, ',', ConvertToLocaleString); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 function ArrayJoin(separator) { | 410 function ArrayJoin(separator) { |
| 411 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 411 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { |
| 412 throw MakeTypeError("called_on_null_or_undefined", | 412 throw MakeTypeError("called_on_null_or_undefined", |
| 413 ["Array.prototype.join"]); | 413 ["Array.prototype.join"]); |
| 414 } | 414 } |
| 415 | 415 |
| 416 var length = TO_UINT32(this.length); |
| 416 if (IS_UNDEFINED(separator)) { | 417 if (IS_UNDEFINED(separator)) { |
| 417 separator = ','; | 418 separator = ','; |
| 418 } else if (!IS_STRING(separator)) { | 419 } else if (!IS_STRING(separator)) { |
| 419 separator = NonStringToString(separator); | 420 separator = NonStringToString(separator); |
| 420 } | 421 } |
| 421 | 422 |
| 422 var result = %_FastAsciiArrayJoin(this, separator); | 423 var result = %_FastAsciiArrayJoin(this, separator); |
| 423 if (!IS_UNDEFINED(result)) return result; | 424 if (!IS_UNDEFINED(result)) return result; |
| 424 | 425 |
| 425 return Join(this, TO_UINT32(this.length), separator, ConvertToString); | 426 return Join(this, length, separator, ConvertToString); |
| 426 } | 427 } |
| 427 | 428 |
| 428 | 429 |
| 429 // Removes the last element from the array and returns it. See | 430 // Removes the last element from the array and returns it. See |
| 430 // ECMA-262, section 15.4.4.6. | 431 // ECMA-262, section 15.4.4.6. |
| 431 function ArrayPop() { | 432 function ArrayPop() { |
| 432 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 433 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { |
| 433 throw MakeTypeError("called_on_null_or_undefined", | 434 throw MakeTypeError("called_on_null_or_undefined", |
| 434 ["Array.prototype.pop"]); | 435 ["Array.prototype.pop"]); |
| 435 } | 436 } |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 SetUpLockedPrototype(InternalArray, $Array(), $Array( | 1555 SetUpLockedPrototype(InternalArray, $Array(), $Array( |
| 1555 "indexOf", getFunction("indexOf", ArrayIndexOf), | 1556 "indexOf", getFunction("indexOf", ArrayIndexOf), |
| 1556 "join", getFunction("join", ArrayJoin), | 1557 "join", getFunction("join", ArrayJoin), |
| 1557 "pop", getFunction("pop", ArrayPop), | 1558 "pop", getFunction("pop", ArrayPop), |
| 1558 "push", getFunction("push", ArrayPush), | 1559 "push", getFunction("push", ArrayPush), |
| 1559 "splice", getFunction("splice", ArraySplice) | 1560 "splice", getFunction("splice", ArraySplice) |
| 1560 )); | 1561 )); |
| 1561 } | 1562 } |
| 1562 | 1563 |
| 1563 SetUpArray(); | 1564 SetUpArray(); |
| OLD | NEW |