Revision: 12302
Author: [email protected]
Date: Mon Aug 13 08:53:40 2012
Log: Fix indexing bug in regexp, part 2.
The previous fix initialized the start index incorrectly.
BUG=
Review URL: https://chromiumcodereview.appspot.com/10834291
http://code.google.com/p/v8/source/detail?r=12302
Modified:
/branches/bleeding_edge/src/jsregexp.cc
/branches/bleeding_edge/test/mjsunit/regress/regress-crbug-142087.js
=======================================
--- /branches/bleeding_edge/src/jsregexp.cc Mon Aug 13 08:26:46 2012
+++ /branches/bleeding_edge/src/jsregexp.cc Mon Aug 13 08:53:40 2012
@@ -748,12 +748,12 @@
// Set state so that fetching the results the first time triggers a call
// to the compiled regexp.
- current_match_index_ = max_matches_;
+ current_match_index_ = max_matches_ - 1;
num_matches_ = max_matches_;
ASSERT(registers_per_match_ >= 2); // Each match has at least one
capture.
ASSERT_GE(register_array_size_, registers_per_match_);
int32_t* last_match =
- ®ister_array_[(current_match_index_ - 1) * registers_per_match_];
+ ®ister_array_[current_match_index_ * registers_per_match_];
last_match[0] = -1;
last_match[1] = 0;
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-142087.js
Mon Aug 13 08:26:46 2012
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-142087.js
Mon Aug 13 08:53:40 2012
@@ -27,7 +27,7 @@
var string = "What are you looking for?";
-var expected_match = [];
+var expected_match = [""];
for (var i = 0; i < string.length; i++) {
expected_match.push("");
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev