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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 utils.InstallGetterSetter(GlobalRegExp, "$'", RegExpGetRightContext, NoOpSetter, | 1167 utils.InstallGetterSetter(GlobalRegExp, "$'", RegExpGetRightContext, NoOpSetter, |
1168 DONT_ENUM | DONT_DELETE); | 1168 DONT_ENUM | DONT_DELETE); |
1169 | 1169 |
1170 for (var i = 1; i < 10; ++i) { | 1170 for (var i = 1; i < 10; ++i) { |
1171 utils.InstallGetterSetter(GlobalRegExp, '$' + i, RegExpMakeCaptureGetter(i), | 1171 utils.InstallGetterSetter(GlobalRegExp, '$' + i, RegExpMakeCaptureGetter(i), |
1172 NoOpSetter, DONT_DELETE); | 1172 NoOpSetter, DONT_DELETE); |
1173 } | 1173 } |
1174 %ToFastProperties(GlobalRegExp); | 1174 %ToFastProperties(GlobalRegExp); |
1175 | 1175 |
1176 // ------------------------------------------------------------------- | 1176 // ------------------------------------------------------------------- |
| 1177 // Internal |
| 1178 |
| 1179 var InternalRegExpMatchInfo = new InternalPackedArray(2, "", UNDEFINED, 0, 0); |
| 1180 |
| 1181 function InternalRegExpMatch(regexp, subject) { |
| 1182 var matchInfo = %_RegExpExec(regexp, subject, 0, InternalRegExpMatchInfo); |
| 1183 if (!IS_NULL(matchInfo)) { |
| 1184 RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, subject); |
| 1185 } |
| 1186 return null; |
| 1187 } |
| 1188 |
| 1189 function InternalRegExpReplace(regexp, subject, replacement) { |
| 1190 return %StringReplaceGlobalRegExpWithString( |
| 1191 subject, regexp, replacement, InternalRegExpMatchInfo); |
| 1192 } |
| 1193 |
| 1194 // ------------------------------------------------------------------- |
1177 // Exports | 1195 // Exports |
1178 | 1196 |
1179 utils.Export(function(to) { | 1197 utils.Export(function(to) { |
| 1198 to.InternalRegExpMatch = InternalRegExpMatch; |
| 1199 to.InternalRegExpReplace = InternalRegExpReplace; |
| 1200 to.IsRegExp = IsRegExp; |
1180 to.RegExpExec = DoRegExpExec; | 1201 to.RegExpExec = DoRegExpExec; |
1181 to.RegExpInitialize = RegExpInitialize; | 1202 to.RegExpInitialize = RegExpInitialize; |
1182 to.RegExpLastMatchInfo = RegExpLastMatchInfo; | 1203 to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
1183 to.RegExpSubclassExecJS = RegExpSubclassExecJS; | 1204 to.RegExpSubclassExecJS = RegExpSubclassExecJS; |
1184 to.RegExpSubclassMatch = RegExpSubclassMatch; | 1205 to.RegExpSubclassMatch = RegExpSubclassMatch; |
1185 to.RegExpSubclassReplace = RegExpSubclassReplace; | 1206 to.RegExpSubclassReplace = RegExpSubclassReplace; |
1186 to.RegExpSubclassSearch = RegExpSubclassSearch; | 1207 to.RegExpSubclassSearch = RegExpSubclassSearch; |
1187 to.RegExpSubclassSplit = RegExpSubclassSplit; | 1208 to.RegExpSubclassSplit = RegExpSubclassSplit; |
1188 to.RegExpSubclassTest = RegExpSubclassTest; | 1209 to.RegExpSubclassTest = RegExpSubclassTest; |
1189 to.RegExpTest = RegExpTest; | 1210 to.RegExpTest = RegExpTest; |
1190 to.IsRegExp = IsRegExp; | |
1191 }); | 1211 }); |
1192 | 1212 |
1193 }) | 1213 }) |
OLD | NEW |