Index: src/js/regexp.js |
diff --git a/src/js/regexp.js b/src/js/regexp.js |
index 830fc75b30f7f3d999e99b7971cf08d3a41243f8..2b5a88d6dbd509316c34b3229f8afa5e54a9513c 100644 |
--- a/src/js/regexp.js |
+++ b/src/js/regexp.js |
@@ -122,7 +122,7 @@ function RegExpCompileJS(pattern, flags) { |
function DoRegExpExec(regexp, string, index) { |
- return %_RegExpExec(regexp, string, index, RegExpLastMatchInfo); |
Dan Ehrenberg
2016/03/23 15:55:41
Why this change? Will it have performance implicat
Yang
2016/03/24 06:14:13
Thanks for catching this. I changed it for easier
|
+ return %RegExpExec(regexp, string, index, RegExpLastMatchInfo); |
} |
@@ -154,7 +154,7 @@ endmacro |
function RegExpExecNoTests(regexp, string, start) { |
// Must be called with RegExp, string and positive integer as arguments. |
- var matchInfo = %_RegExpExec(regexp, string, start, RegExpLastMatchInfo); |
+ var matchInfo = %RegExpExec(regexp, string, start, RegExpLastMatchInfo); |
if (matchInfo !== null) { |
// ES6 21.2.5.2.2 step 18. |
if (REGEXP_STICKY(regexp)) regexp.lastIndex = matchInfo[CAPTURE1]; |
@@ -189,7 +189,7 @@ function RegExpExecJS(string) { |
} |
// matchIndices is either null or the RegExpLastMatchInfo array. |
- var matchIndices = %_RegExpExec(this, string, i, RegExpLastMatchInfo); |
+ var matchIndices = %RegExpExec(this, string, i, RegExpLastMatchInfo); |
if (IS_NULL(matchIndices)) { |
this.lastIndex = 0; |
@@ -231,7 +231,7 @@ function RegExpTest(string) { |
return false; |
} |
// matchIndices is either null or the RegExpLastMatchInfo array. |
- var matchIndices = %_RegExpExec(this, string, i, RegExpLastMatchInfo); |
+ var matchIndices = %RegExpExec(this, string, i, RegExpLastMatchInfo); |
if (IS_NULL(matchIndices)) { |
this.lastIndex = 0; |
return false; |
@@ -252,7 +252,7 @@ function RegExpTest(string) { |
regexp = TrimRegExp(regexp); |
} |
// matchIndices is either null or the RegExpLastMatchInfo array. |
- var matchIndices = %_RegExpExec(regexp, string, 0, RegExpLastMatchInfo); |
+ var matchIndices = %RegExpExec(regexp, string, 0, RegExpLastMatchInfo); |
if (IS_NULL(matchIndices)) { |
this.lastIndex = 0; |
return false; |
@@ -775,14 +775,37 @@ for (var i = 1; i < 10; ++i) { |
%ToFastProperties(GlobalRegExp); |
// ------------------------------------------------------------------- |
+// Internal |
+ |
+var InternalRegExpMatchInfo = UNDEFINED; |
+ |
+function InternalRegExpMatch(regexp, subject) { |
+ if (IS_UNDEFINED(InternalRegExpMatchInfo)) { |
+ InternalRegExpMatchInfo = new InternalPackedArray(2, "", UNDEFINED, 0, 0); |
+ } |
+ var matchInfo = %RegExpExec(regexp, subject, 0, InternalRegExpMatchInfo); |
+ if (!IS_NULL(matchInfo)) { |
+ RETURN_NEW_RESULT_FROM_MATCH_INFO(matchInfo, subject); |
+ } |
+ return null; |
+} |
+ |
+function InternalRegExpReplace(regexp, subject, replacement) { |
+ return %StringReplaceGlobalRegExpWithString( |
+ subject, regexp, replacement, InternalRegExpMatchInfo); |
+} |
+ |
+// ------------------------------------------------------------------- |
// Exports |
utils.Export(function(to) { |
+ to.InternalRegExpMatch = InternalRegExpMatch; |
+ to.InternalRegExpReplace = InternalRegExpReplace; |
+ to.IsRegExp = IsRegExp; |
to.RegExpExec = DoRegExpExec; |
to.RegExpExecNoTests = RegExpExecNoTests; |
to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
to.RegExpTest = RegExpTest; |
- to.IsRegExp = IsRegExp; |
}); |
}) |