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

Unified Diff: src/string.js

Issue 3778004: Restructure RegExp exec cache code. (Closed)
Patch Set: Addressed review comments. Created 10 years, 2 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/regexp.js ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 30eedb3c9a2fe9451ccf08a5d0469ae91b3143d3..d97f632b88dc32975830ecc2f50186199c1768ce 100644
--- a/src/string.js
+++ b/src/string.js
@@ -611,7 +611,7 @@ function StringSplit(separator, limit) {
if (%_ObjectEquals(cache.type, 'split') &&
%_IsRegExpEquivalent(cache.regExp, separator) &&
%_ObjectEquals(cache.subject, subject) &&
- %_ObjectEquals(cache.lastIndex, limit)) {
+ %_ObjectEquals(cache.splitLimit, limit)) {
if (cache.answerSaved) {
return CloneDenseArray(cache.answer);
} else {
@@ -622,8 +622,7 @@ function StringSplit(separator, limit) {
cache.type = 'split';
cache.regExp = separator;
cache.subject = subject;
- // Reuse lastIndex field for split limit when type is "split".
- cache.lastIndex = limit;
+ cache.splitLimit = limit;
%_Log('regexp', 'regexp-split,%0S,%1r', [subject, separator]);
« no previous file with comments | « src/regexp.js ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698