Author: [EMAIL PROTECTED]
Date: Tue Nov 11 01:56:46 2008
New Revision: 730
Modified:
branches/experimental/regexp2000/src/jsregexp.cc
branches/experimental/regexp2000/test/cctest/test-regexp.cc
Log:
Guarded dot-printing so it is only available in debug mode.
Modified: branches/experimental/regexp2000/src/jsregexp.cc
==============================================================================
--- branches/experimental/regexp2000/src/jsregexp.cc (original)
+++ branches/experimental/regexp2000/src/jsregexp.cc Tue Nov 11 01:56:46
2008
@@ -914,6 +914,9 @@
// Dot/dotty output
+#ifdef DEBUG
+
+
class DotPrinter: public NodeVisitor {
public:
DotPrinter() : stream_(&alloc_) { }
@@ -962,9 +965,6 @@
}
-#ifdef DEBUG
-
-
void DotPrinter::PrintOnFailure(RegExpNode* from, RegExpNode* on_failure) {
if (on_failure == EndNode::GetBacktrack()) return;
stream()->Add(" n%p -> n%p [style=dotted];\n", from, on_failure);
@@ -1075,6 +1075,45 @@
}
+class DispatchTableDumper {
+ public:
+ DispatchTableDumper(StringStream* stream) : stream_(stream) { }
+ void Call(uc16 key, DispatchTable::Entry entry);
+ StringStream* stream() { return stream_; }
+ private:
+ StringStream* stream_;
+};
+
+
+void DispatchTableDumper::Call(uc16 key, DispatchTable::Entry entry) {
+ stream()->Add("[%k-%k]: {", key, entry.to());
+ OutSet set = entry.out_set();
+ bool first = true;
+ for (unsigned i = 0; i < OutSet::kFirstLimit; i++) {
+ if (set.Get(i)) {
+ if (first) first = false;
+ else stream()->Add(", ");
+ stream()->Add("%i", i);
+ }
+ }
+ stream()->Add("}\n");
+}
+
+
+void DispatchTable::Dump() {
+ HeapStringAllocator alloc;
+ StringStream stream(&alloc);
+ tree()->ForEach(DispatchTableDumper(&stream));
+ OS::PrintError("%s", *stream.ToCString());
+}
+
+
+void RegExpEngine::DotPrint(const char* label, RegExpNode* node) {
+ DotPrinter printer;
+ printer.PrintNode(label, node);
+}
+
+
#endif // DEBUG
@@ -1451,45 +1490,6 @@
}
-#ifdef DEBUG
-
-
-class DispatchTableDumper {
- public:
- DispatchTableDumper(StringStream* stream) : stream_(stream) { }
- void Call(uc16 key, DispatchTable::Entry entry);
- StringStream* stream() { return stream_; }
- private:
- StringStream* stream_;
-};
-
-
-void DispatchTableDumper::Call(uc16 key, DispatchTable::Entry entry) {
- stream()->Add("[%k-%k]: {", key, entry.to());
- OutSet set = entry.out_set();
- bool first = true;
- for (unsigned i = 0; i < OutSet::kFirstLimit; i++) {
- if (set.Get(i)) {
- if (first) first = false;
- else stream()->Add(", ");
- stream()->Add("%i", i);
- }
- }
- stream()->Add("}\n");
-}
-
-
-void DispatchTable::Dump() {
- HeapStringAllocator alloc;
- StringStream stream(&alloc);
- tree()->ForEach(DispatchTableDumper(&stream));
- OS::PrintError("%s", *stream.ToCString());
-}
-
-
-#endif
-
-
OutSet DispatchTable::Get(uc16 value) {
ZoneSplayTree<Config>::Locator loc;
if (!tree()->FindGreatestLessThan(value, &loc))
@@ -1602,12 +1602,6 @@
Analysis analysis(this);
analysis.Analyze(node);
return node;
-}
-
-
-void RegExpEngine::DotPrint(const char* label, RegExpNode* node) {
- DotPrinter printer;
- printer.PrintNode(label, node);
}
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 Tue Nov 11
01:56:46 2008
@@ -337,10 +337,13 @@
if (!v8::internal::ParseRegExp(&buffer, &result))
return;
RegExpNode* node = RegExpEngine::Compile(&result);
+ USE(node);
+#ifdef DEBUG
if (dot_output) {
RegExpEngine::DotPrint(input, node);
exit(0);
}
+#endif // DEBUG
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---