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

Unified Diff: src/jsregexp.h

Issue 14508: Interest propagation bugfix. (Closed)
Patch Set: Created 12 years 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 | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index 0cac1724ab7221106fc1c5708bf381a03bf0f337..347152fbf71e4aebc276e6ae0dc2e4a178ddcfa6 100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -912,9 +912,26 @@ class ChoiceNode: public RegExpNode {
class LoopChoiceNode: public ChoiceNode {
public:
- explicit LoopChoiceNode(int expected_size) : ChoiceNode(expected_size) { }
+ explicit LoopChoiceNode()
+ : ChoiceNode(2),
+ loop_node_(NULL),
+ continue_node_(NULL) { }
+ void AddLoopAlternative(GuardedAlternative alt);
+ void AddContinueAlternative(GuardedAlternative alt);
virtual bool Emit(RegExpCompiler* compiler, GenerationVariant* variant);
virtual LoopChoiceNode* Clone() { return new LoopChoiceNode(*this); }
+ RegExpNode* loop_node() { return loop_node_; }
+ RegExpNode* continue_node() { return continue_node_; }
+ virtual void Accept(NodeVisitor* visitor);
+
+ private:
+ // AddAlternative is made private for loop nodes because alternatives
+ // should not be added freely, we need to keep track of which node
+ // goes back to the node itself.
+ void AddAlternative(GuardedAlternative node) { ChoiceNode::AddAlternative(node); }
+
+ RegExpNode* loop_node_;
+ RegExpNode* continue_node_;
};
@@ -1024,6 +1041,7 @@ class NodeVisitor {
virtual void Visit##Type(Type##Node* that) = 0;
FOR_EACH_NODE_TYPE(DECLARE_VISIT)
#undef DECLARE_VISIT
+ virtual void VisitLoopChoice(LoopChoiceNode* that) { VisitChoice(that); }
};
@@ -1105,6 +1123,7 @@ class AssertionPropagation: public NodeVisitor {
virtual void Visit##Type(Type##Node* that);
FOR_EACH_NODE_TYPE(DECLARE_VISIT)
#undef DECLARE_VISIT
+ virtual void VisitLoopChoice(LoopChoiceNode* that);
private:
bool ignore_case_;
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698