Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Unified Diff: src/jsregexp.cc

Issue 10293: Only enable dot printing in debug mode (Closed)
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index f2fa4604506c01b81fb3f5cd3c8f814bf9236611..d09d2fa336d9cadc287edb81e9a62254cc00ccc1 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -914,6 +914,9 @@ FOR_EACH_NODE_TYPE(DEFINE_ACCEPT)
// Dot/dotty output
+#ifdef DEBUG
+
+
class DotPrinter: public NodeVisitor {
public:
DotPrinter() : stream_(&alloc_) { }
@@ -962,9 +965,6 @@ void DotPrinter::Visit(RegExpNode* node) {
}
-#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 @@ void DotPrinter::VisitAction(ActionNode* that) {
}
+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 @@ void DispatchTable::AddRange(CharacterRange full_range, int value) {
}
-#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))
@@ -1605,12 +1605,6 @@ RegExpNode* RegExpCompiler::Compile(RegExpTree* tree,
}
-void RegExpEngine::DotPrint(const char* label, RegExpNode* node) {
- DotPrinter printer;
- printer.PrintNode(label, node);
-}
-
-
RegExpNode* RegExpEngine::Compile(RegExpParseResult* input) {
RegExpCompiler compiler(input->capture_count);
RegExpNode* node = compiler.Compile(input->tree,
« no previous file with comments | « no previous file | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698