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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // otherwise we call the runtime system. | 173 // otherwise we call the runtime system. |
174 function SubString(string, start, end) { | 174 function SubString(string, start, end) { |
175 // Use the one character string cache. | 175 // Use the one character string cache. |
176 if (start + 1 == end) { | 176 if (start + 1 == end) { |
177 var char_code = %_FastCharCodeAt(string, start); | 177 var char_code = %_FastCharCodeAt(string, start); |
178 if (!%_IsSmi(char_code)) { | 178 if (!%_IsSmi(char_code)) { |
179 char_code = %StringCharCodeAt(string, start); | 179 char_code = %StringCharCodeAt(string, start); |
180 } | 180 } |
181 return %CharFromCode(char_code); | 181 return %CharFromCode(char_code); |
182 } | 182 } |
183 return %StringSlice(string, start, end); | 183 return %SubString(string, start, end); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 // This has the same size as the lastMatchInfo array, and can be used for | 187 // This has the same size as the lastMatchInfo array, and can be used for |
188 // functions that expect that structure to be returned. It is used when the | 188 // functions that expect that structure to be returned. It is used when the |
189 // needle is a string rather than a regexp. In this case we can't update | 189 // needle is a string rather than a regexp. In this case we can't update |
190 // lastMatchArray without erroneously affecting the properties on the global | 190 // lastMatchArray without erroneously affecting the properties on the global |
191 // RegExp object. | 191 // RegExp object. |
192 var reusableMatchInfo = [2, "", "", -1, -1]; | 192 var reusableMatchInfo = [2, "", "", -1, -1]; |
193 | 193 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 "small", StringSmall, | 892 "small", StringSmall, |
893 "strike", StringStrike, | 893 "strike", StringStrike, |
894 "sub", StringSub, | 894 "sub", StringSub, |
895 "sup", StringSup, | 895 "sup", StringSup, |
896 "toJSON", StringToJSON | 896 "toJSON", StringToJSON |
897 )); | 897 )); |
898 } | 898 } |
899 | 899 |
900 | 900 |
901 SetupString(); | 901 SetupString(); |
OLD | NEW |