Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: src/js/regexp.js

Issue 1819313002: [regexp, intl] Intl should not cause side effects to the RegExp object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/i18n.js ('k') | test/intl/regexp-assert.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/regexp.js
diff --git a/src/js/regexp.js b/src/js/regexp.js
index 8169ba3c34f3dba2106bd2ad7191b6c45206a8ca..773dd201c1bac6402d6442ed6428d29ef3d7eeae 100644
--- a/src/js/regexp.js
+++ b/src/js/regexp.js
@@ -1174,9 +1174,30 @@ for (var i = 1; i < 10; ++i) {
%ToFastProperties(GlobalRegExp);
// -------------------------------------------------------------------
+// Internal
+
+var InternalRegExpMatchInfo = new InternalPackedArray(2, "", UNDEFINED, 0, 0);
+
+function InternalRegExpMatch(regexp, subject) {
+ 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.RegExpInitialize = RegExpInitialize;
to.RegExpLastMatchInfo = RegExpLastMatchInfo;
@@ -1187,7 +1208,6 @@ utils.Export(function(to) {
to.RegExpSubclassSplit = RegExpSubclassSplit;
to.RegExpSubclassTest = RegExpSubclassTest;
to.RegExpTest = RegExpTest;
- to.IsRegExp = IsRegExp;
});
})
« no previous file with comments | « src/js/i18n.js ('k') | test/intl/regexp-assert.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698