OLD | NEW |
---|---|
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 if (%_ArgumentsLength() === 0) { | 545 if (%_ArgumentsLength() === 0) { |
546 return [subject]; | 546 return [subject]; |
547 } | 547 } |
548 | 548 |
549 var length = subject.length; | 549 var length = subject.length; |
550 if (!IS_REGEXP(separator)) { | 550 if (!IS_REGEXP(separator)) { |
551 separator = TO_STRING_INLINE(separator); | 551 separator = TO_STRING_INLINE(separator); |
552 var separator_length = separator.length; | 552 var separator_length = separator.length; |
553 | 553 |
554 // If the separator string is empty then return the elements in the subject. | 554 // If the separator string is empty then return the elements in the subject. |
555 if (separator_length === 0) return %StringToArray(subject); | 555 if (separator_length === 0) return %StringToArray(subject, limit); |
Mads Ager (chromium)
2010/11/10 09:45:32
Accidental indentation change?
| |
556 | 556 |
557 var result = %StringSplit(subject, separator, limit); | 557 var result = %StringSplit(subject, separator, limit); |
558 | 558 |
559 return result; | 559 return result; |
560 } | 560 } |
561 | 561 |
562 %_Log('regexp', 'regexp-split,%0S,%1r', [subject, separator]); | 562 %_Log('regexp', 'regexp-split,%0S,%1r', [subject, separator]); |
563 | 563 |
564 if (length === 0) { | 564 if (length === 0) { |
565 if (DoRegExpExec(separator, subject, 0, 0) != null) { | 565 if (DoRegExpExec(separator, subject, 0, 0) != null) { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 "small", StringSmall, | 929 "small", StringSmall, |
930 "strike", StringStrike, | 930 "strike", StringStrike, |
931 "sub", StringSub, | 931 "sub", StringSub, |
932 "sup", StringSup, | 932 "sup", StringSup, |
933 "toJSON", StringToJSON | 933 "toJSON", StringToJSON |
934 )); | 934 )); |
935 } | 935 } |
936 | 936 |
937 | 937 |
938 SetupString(); | 938 SetupString(); |
OLD | NEW |