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

Unified Diff: src/runtime.cc

Issue 10445038: Merged r11661, r11662 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 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 | « no previous file | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index a3c159a47f0b2e1555e59df94c2449472f796405..4deaabac184f9ef5fbc614788ede4058326020b6 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -3946,7 +3946,6 @@ static int SearchRegExpMultiple(
match = isolate->factory()->NewSubString(subject,
match_start,
match_end);
- first = false;
}
elements->set(0, *match);
for (int i = 1; i <= capture_count; i++) {
@@ -3954,8 +3953,14 @@ static int SearchRegExpMultiple(
if (start >= 0) {
int end = current_match[i * 2 + 1];
ASSERT(start <= end);
- Handle<String> substring =
- isolate->factory()->NewProperSubString(subject, start, end);
+ Handle<String> substring;
+ if (!first) {
+ substring =
+ isolate->factory()->NewProperSubString(subject, start, end);
+ } else {
+ substring =
+ isolate->factory()->NewSubString(subject, start, end);
+ }
elements->set(i, *substring);
} else {
ASSERT(current_match[i * 2 + 1] < 0);
@@ -3966,6 +3971,7 @@ static int SearchRegExpMultiple(
elements->set(capture_count + 2, *subject);
builder->Add(*isolate->factory()->NewJSArrayWithElements(elements));
}
+ first = false;
}
// If we did not get the maximum number of matches, we can stop here
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698