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

Unified Diff: src/ast.h

Issue 17378: Capture register clearing on loop iteration (Closed)
Patch Set: Created 11 years, 11 months 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/ast.cc » ('j') | src/jsregexp.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 150506b4240bf2e43e96da5e86dc7d639141a32e..5cb716085835948716aec9092aefc867b6ab76ad 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1214,6 +1214,16 @@ class ThisFunction: public Expression {
// Regular expressions
+class RegExpVisitor BASE_EMBEDDED {
+ public:
+ virtual ~RegExpVisitor() { }
+#define MAKE_CASE(Name) \
+ virtual void* Visit##Name(RegExp##Name*, void* data) = 0;
+ FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
+#undef MAKE_CASE
+};
+
+
class RegExpTree: public ZoneObject {
public:
static const int kInfinity = kMaxInt;
@@ -1224,6 +1234,9 @@ class RegExpTree: public ZoneObject {
virtual bool IsTextElement() { return false; }
virtual int min_match() = 0;
virtual int max_match() = 0;
+ // Returns the interval of registers used for captures within this
+ // expression.
+ virtual Interval CaptureRegisters() { return Interval::Empty(); }
virtual void AppendToText(RegExpText* text);
SmartPointer<const char> ToString();
#define MAKE_ASTYPE(Name) \
@@ -1241,6 +1254,7 @@ class RegExpDisjunction: public RegExpTree {
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
RegExpNode* on_success);
virtual RegExpDisjunction* AsDisjunction();
+ virtual Interval CaptureRegisters();
virtual bool IsDisjunction();
virtual int min_match() { return min_match_; }
virtual int max_match() { return max_match_; }
@@ -1259,6 +1273,7 @@ class RegExpAlternative: public RegExpTree {
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
RegExpNode* on_success);
virtual RegExpAlternative* AsAlternative();
+ virtual Interval CaptureRegisters();
virtual bool IsAlternative();
virtual int min_match() { return min_match_; }
virtual int max_match() { return max_match_; }
@@ -1423,6 +1438,7 @@ class RegExpQuantifier: public RegExpTree {
RegExpCompiler* compiler,
RegExpNode* on_success);
virtual RegExpQuantifier* AsQuantifier();
+ virtual Interval CaptureRegisters();
virtual bool IsQuantifier();
virtual int min_match() { return min_match_; }
virtual int max_match() { return max_match_; }
@@ -1458,6 +1474,7 @@ class RegExpCapture: public RegExpTree {
RegExpCompiler* compiler,
RegExpNode* on_success);
virtual RegExpCapture* AsCapture();
+ virtual Interval CaptureRegisters();
virtual bool IsCapture();
virtual int min_match() { return body_->min_match(); }
virtual int max_match() { return body_->max_match(); }
@@ -1485,6 +1502,7 @@ class RegExpLookahead: public RegExpTree {
virtual RegExpNode* ToNode(RegExpCompiler* compiler,
RegExpNode* on_success);
virtual RegExpLookahead* AsLookahead();
+ virtual Interval CaptureRegisters();
virtual bool IsLookahead();
virtual int min_match() { return 0; }
virtual int max_match() { return 0; }
@@ -1530,16 +1548,6 @@ class RegExpEmpty: public RegExpTree {
};
-class RegExpVisitor BASE_EMBEDDED {
- public:
- virtual ~RegExpVisitor() { }
-#define MAKE_CASE(Name) \
- virtual void* Visit##Name(RegExp##Name*, void* data) = 0;
- FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
-#undef MAKE_CASE
-};
-
-
// ----------------------------------------------------------------------------
// Basic visitor
// - leaf node visitors are abstract.
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/jsregexp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698