Reviewers: Mads Ager,

Description:
- Fixed regexp logging issue.
- Removed use of std::set.

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

Affected files:
   M src/jsregexp.h
   M src/jsregexp.cc
   M src/log.cc


Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index  
8bafc28d66e0ef26188dfb4d40d3a64284a5763c..bf9d4dea4d491e6890ec59b503912fe0f5937a91
  
100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -25,9 +25,6 @@
  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-#define _HAS_EXCEPTIONS 0
-#include <set>
-
  #include "v8.h"

  #include "ast.h"
@@ -1587,7 +1584,6 @@ FOR_EACH_NODE_TYPE(DECLARE_VISIT)
    bool ignore_case_;
    HeapStringAllocator alloc_;
    StringStream stream_;
-  std::set<RegExpNode*> seen_;
  };


@@ -1614,9 +1610,8 @@ void DotPrinter::PrintNode(const char* label,  
RegExpNode* node) {


  void DotPrinter::Visit(RegExpNode* node) {
-  if (seen_.find(node) != seen_.end())
-    return;
-  seen_.insert(node);
+  if (node->info()->visited) return;
+  node->info()->visited = true;
    node->Accept(this);
  }

Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index  
38357d670ce86ce3aee98c27ec81f5db3046af46..3ab6651632f537b93210610649c2687a3b54379c
  
100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -467,7 +467,8 @@ struct NodeInfo {
          at_end(false),
          follows_word(UNKNOWN),
          follows_newline(UNKNOWN),
-        follows_start(UNKNOWN) { }
+        follows_start(UNKNOWN),
+        visited(false) { }

    // Returns true if the interests and assumptions of this node
    // matches the given one.
@@ -566,6 +567,8 @@ struct NodeInfo {
    TriBool follows_word: 2;
    TriBool follows_newline: 2;
    TriBool follows_start: 2;
+
+  bool visited: 1;
  };


Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index  
803dfe84df97a4a5e5cc42a204da6240f42e7f1f..d145480f07ae3264df7a7ec1328f63058bcb9275
  
100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -356,12 +356,14 @@ void Logger::LogString(Handle<String> str) {
      len = 256;
    for (int i = 0; i < len; i++) {
      uc32 c = str->Get(shape, i);
-    if (c < 32 || (c > 126 && c <= 255)) {
-      fprintf(logfile_, "\\x%02x", c);
-    } else if (c > 255) {
+    if (c > 0xff) {
        fprintf(logfile_, "\\u%04x", c);
+    } else if (c < 32 || c > 126) {
+      fprintf(logfile_, "\\x%02x", c);
      } else if (c == ',') {
        fprintf(logfile_, "\\,");
+    } else if (c == '\\') {
+      fprintf(logfile_, "\\\\");
      } else {
        fprintf(logfile_, "%lc", c);
      }



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

Reply via email to