Author: [EMAIL PROTECTED]
Date: Wed Nov 12 06:40:28 2008
New Revision: 742

Modified:
    branches/experimental/regexp2000/src/jsregexp.cc
    branches/experimental/regexp2000/src/jsregexp.h
    branches/experimental/regexp2000/test/cctest/test-regexp.cc

Log:
Fixed a bug in graph conversion and one in dispatch table
construction.


Modified: branches/experimental/regexp2000/src/jsregexp.cc
==============================================================================
--- branches/experimental/regexp2000/src/jsregexp.cc    (original)
+++ branches/experimental/regexp2000/src/jsregexp.cc    Wed Nov 12 06:40:28  
2008
@@ -1567,7 +1567,8 @@
    }
    while (current.is_valid()) {
      if (tree()->FindLeastGreaterThan(current.from(), &loc) &&
-        (loc.value().from() <= current.to())) {
+        (loc.value().from() <= current.to()) &&
+        (loc.value().to() >= current.from())) {
        Entry* entry = &loc.value();
        // We have overlap.  If there is space between the start point of
        // the range we're adding and where the overlapping range starts
@@ -1596,6 +1597,11 @@
        // we're adding so we can just update it and move the start point
        // of the range we're adding just past it.
        entry->AddValue(value);
+      // Bail out if the last interval ended at 0xFFFF since otherwise
+      // adding 1 will wrap around to 0.
+      if (entry->to() == 0xFFFF)
+        break;
+      ASSERT(entry->to() + 1 > current.from());
        current.set_from(entry->to() + 1);
      } else {
        // There is no overlap so we can just add the range
@@ -1736,10 +1742,7 @@
  RegExpNode* RegExpCompiler::Compile(RegExpTree* tree,
                                      RegExpNode* on_success,
                                      RegExpNode* on_failure) {
-  RegExpNode* node = tree->ToNode(this, on_success, on_failure);
-  Analysis analysis(this);
-  analysis.Analyze(node);
-  return node;
+  return tree->ToNode(this, on_success, on_failure);
  }


@@ -1748,6 +1751,8 @@
    RegExpNode* node = compiler.Compile(input->tree,
                                        EndNode::GetAccept(),
                                        EndNode::GetBacktrack());
+  Analysis analysis(&compiler);
+  analysis.Analyze(node);
    return node;
  }


Modified: branches/experimental/regexp2000/src/jsregexp.h
==============================================================================
--- branches/experimental/regexp2000/src/jsregexp.h     (original)
+++ branches/experimental/regexp2000/src/jsregexp.h     Wed Nov 12 06:40:28 2008
@@ -287,7 +287,7 @@
    ZoneList<OutSet*>* successors() { return successors_; }

    OutSet(uint32_t first, ZoneList<unsigned>* remaining)
-    : first_(first), remaining_(remaining) { }
+    : first_(first), remaining_(remaining), successors_(NULL) { }
    uint32_t first_;
    ZoneList<unsigned>* remaining_;
    ZoneList<OutSet*>* successors_;
@@ -301,7 +301,7 @@
    class Entry {
     public:
      Entry()
-      : from_(0), to_(0) { }
+      : from_(0), to_(0), out_set_(NULL) { }
      Entry(uc16 from, uc16 to, OutSet* out_set)
        : from_(from), to_(to), out_set_(out_set) { }
      uc16 from() { return from_; }

Modified: branches/experimental/regexp2000/test/cctest/test-regexp.cc
==============================================================================
--- branches/experimental/regexp2000/test/cctest/test-regexp.cc (original)
+++ branches/experimental/regexp2000/test/cctest/test-regexp.cc Wed Nov 12  
06:40:28 2008
@@ -351,9 +351,9 @@

  TEST(Execution) {
    V8::Initialize(NULL);
-  // Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbegh");
-  // Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefh");
-  // Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefd");
+  Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbegh");
+  Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefh");
+  Execute(".*?(?:a[bc]d|e[fg]h)", "xxxabbefd");
  }


@@ -690,5 +690,5 @@


  TEST(Graph) {
-  Execute("([^a]|\\w)", "", true);
+  Execute(".*?a", "", true);
  }

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

Reply via email to