| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 function StringMatch(regexp) { | 182 function StringMatch(regexp) { |
| 183 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 183 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { |
| 184 throw MakeTypeError("called_on_null_or_undefined", | 184 throw MakeTypeError("called_on_null_or_undefined", |
| 185 ["String.prototype.match"]); | 185 ["String.prototype.match"]); |
| 186 } | 186 } |
| 187 var subject = TO_STRING_INLINE(this); | 187 var subject = TO_STRING_INLINE(this); |
| 188 if (IS_REGEXP(regexp)) { | 188 if (IS_REGEXP(regexp)) { |
| 189 if (!regexp.global) return RegExpExecNoTests(regexp, subject, 0); | 189 if (!regexp.global) return RegExpExecNoTests(regexp, subject, 0); |
| 190 %_Log('regexp', 'regexp-match,%0S,%1r', [subject, regexp]); | 190 %_Log('regexp', 'regexp-match,%0S,%1r', [subject, regexp]); |
| 191 // lastMatchInfo is defined in regexp.js. | 191 // lastMatchInfo is defined in regexp.js. |
| 192 return %StringMatch(subject, regexp, lastMatchInfo); | 192 var result = %StringMatch(subject, regexp, lastMatchInfo); |
| 193 if (result !== null) lastMatchInfoOverride = null; |
| 194 return result; |
| 193 } | 195 } |
| 194 // Non-regexp argument. | 196 // Non-regexp argument. |
| 195 regexp = new $RegExp(regexp); | 197 regexp = new $RegExp(regexp); |
| 196 return RegExpExecNoTests(regexp, subject, 0); | 198 return RegExpExecNoTests(regexp, subject, 0); |
| 197 } | 199 } |
| 198 | 200 |
| 199 | 201 |
| 200 // SubString is an internal function that returns the sub string of 'string'. | 202 // SubString is an internal function that returns the sub string of 'string'. |
| 201 // If resulting string is of length 1, we use the one character cache | 203 // If resulting string is of length 1, we use the one character cache |
| 202 // otherwise we call the runtime system. | 204 // otherwise we call the runtime system. |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 "fixed", StringFixed, | 1012 "fixed", StringFixed, |
| 1011 "italics", StringItalics, | 1013 "italics", StringItalics, |
| 1012 "small", StringSmall, | 1014 "small", StringSmall, |
| 1013 "strike", StringStrike, | 1015 "strike", StringStrike, |
| 1014 "sub", StringSub, | 1016 "sub", StringSub, |
| 1015 "sup", StringSup | 1017 "sup", StringSup |
| 1016 )); | 1018 )); |
| 1017 } | 1019 } |
| 1018 | 1020 |
| 1019 SetUpString(); | 1021 SetUpString(); |
| OLD | NEW |