Reviewers: Lasse Reichstein,

Description:
Add 2 asserts in search-replace implementation.

Please review this at http://codereview.chromium.org/115507

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/runtime.cc


Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 1985)
+++ src/runtime.cc      (working copy)
@@ -1420,6 +1420,7 @@

    void AddElement(Object* element) {
      ASSERT(element->IsSmi() || element->IsString());
+    ASSERT(parts_->length() > part_count_);
      parts_->set(part_count_, element);
      part_count_++;
    }
@@ -1589,6 +1590,7 @@
              if (i > last) {
                parts->Add(ReplacementPart::ReplacementSubString(last, i));
              }
+            ASSERT(capture_ref <= capture_count);
              parts->Add(ReplacementPart::SubjectCapture(capture_ref));
              last = next_index + 1;
            }



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to