Commit 421b501f authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Add 2 asserts in search-replace implementation.

Review URL: http://codereview.chromium.org/115507

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1997 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2ff3901c
...@@ -1420,6 +1420,7 @@ class ReplacementStringBuilder { ...@@ -1420,6 +1420,7 @@ class ReplacementStringBuilder {
void AddElement(Object* element) { void AddElement(Object* element) {
ASSERT(element->IsSmi() || element->IsString()); ASSERT(element->IsSmi() || element->IsString());
ASSERT(parts_->length() > part_count_);
parts_->set(part_count_, element); parts_->set(part_count_, element);
part_count_++; part_count_++;
} }
...@@ -1589,6 +1590,7 @@ class CompiledReplacement { ...@@ -1589,6 +1590,7 @@ class CompiledReplacement {
if (i > last) { if (i > last) {
parts->Add(ReplacementPart::ReplacementSubString(last, i)); parts->Add(ReplacementPart::ReplacementSubString(last, i));
} }
ASSERT(capture_ref <= capture_count);
parts->Add(ReplacementPart::SubjectCapture(capture_ref)); parts->Add(ReplacementPart::SubjectCapture(capture_ref));
last = next_index + 1; last = next_index + 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment