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

Unified Diff: src/ast.h

Issue 507051: Attempt to make \b\w+ faster. Slight performance increase on, e.g., string unpacking. (Closed)
Patch Set: Addressed review comments. Created 10 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 | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »
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 3a710ab26b9a0b0666d4819be1a82c9fbeb04bf0..5d2a8b6382d5fca293f26a9679f65f87f93df2dc 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1526,6 +1526,7 @@ class CharacterSet BASE_EMBEDDED {
standard_set_type_ = special_set_type;
}
bool is_standard() { return standard_set_type_ != 0; }
+ void Canonicalize();
private:
ZoneList<CharacterRange>* ranges_;
// If non-zero, the value represents a standard set (e.g., all whitespace
@@ -1619,12 +1620,13 @@ class RegExpText: public RegExpTree {
class RegExpQuantifier: public RegExpTree {
public:
- RegExpQuantifier(int min, int max, bool is_greedy, RegExpTree* body)
- : min_(min),
+ enum Type { GREEDY, NON_GREEDY, POSSESSIVE };
+ RegExpQuantifier(int min, int max, Type type, RegExpTree* body)
+ : body_(body),
+ min_(min),
max_(max),
- is_greedy_(is_greedy),
- body_(body),
- min_match_(min * body->min_match()) {
+ min_match_(min * body->min_match()),
+ type_(type) {
if (max > 0 && body->max_match() > kInfinity / max) {
max_match_ = kInfinity;
} else {
@@ -1648,15 +1650,17 @@ class RegExpQuantifier: public RegExpTree {
virtual int max_match() { return max_match_; }
int min() { return min_; }
int max() { return max_; }
- bool is_greedy() { return is_greedy_; }
+ bool is_possessive() { return type_ == POSSESSIVE; }
+ bool is_non_greedy() { return type_ == NON_GREEDY; }
+ bool is_greedy() { return type_ == GREEDY; }
RegExpTree* body() { return body_; }
private:
+ RegExpTree* body_;
int min_;
int max_;
- bool is_greedy_;
- RegExpTree* body_;
int min_match_;
int max_match_;
+ Type type_;
};
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698