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

Unified Diff: src/regexp.js

Issue 281953002: Fix performance regression in regular expressions after Array.push() optimizations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/code-stubs-hydrogen.cc ('k') | src/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp.js
diff --git a/src/regexp.js b/src/regexp.js
index 6a0e2b5d92c00782d29ef1a78b42d382b10ae55c..bb1958bbca31a647710d975ec6881bd2474c1a70 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -112,8 +112,10 @@ function BuildResultFromMatchInfo(lastMatchInfo, s) {
var numResults = NUMBER_OF_CAPTURES(lastMatchInfo) >> 1;
var start = lastMatchInfo[CAPTURE0];
var end = lastMatchInfo[CAPTURE1];
+ var first_match = %_SubString(s, start, end);
var result = %_RegExpConstructResult(numResults, start, s);
- result[0] = %_SubString(s, start, end);
+ result[0] = first_match;
Yang 2014/05/14 13:25:23 Is this change necessary?
+ if (numResults == 1) return result;
var j = REGEXP_FIRST_CAPTURE + 2;
for (var i = 1; i < numResults; i++) {
start = lastMatchInfo[j++];
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698