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

Unified Diff: src/jsregexp.h

Issue 10254: Rudimentary analysis (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 | 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 cf358beb16e0179c3015bf8704d2dfefb83facbf..871a00810e6c739d45cdd6b72ed7117107733559 100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -164,6 +164,10 @@ class CharacterRange {
};
+template <typename Node, class Callback>
+static void DoForEach(Node* node, Callback callback);
+
+
// A zone splay tree. The config type parameter encapsulates the
// different configurations of a concrete splay tree:
//
@@ -225,6 +229,10 @@ class ZoneSplayTree : public ZoneObject {
value_(value),
left_(NULL),
right_(NULL) { }
+ Key key() { return key_; }
+ Value value() { return value_; }
+ Node* left() { return left_; }
+ Node* right() { return right_; }
private:
friend class ZoneSplayTree;
friend class Locator;
@@ -238,6 +246,7 @@ class ZoneSplayTree : public ZoneObject {
// exposing the node.
class Locator {
public:
+ Locator(Node* node) : node_(node) { }
Locator() : node_(NULL) { }
const Key& key() { return node_->key_; }
Value& value() { return node_->value_; }
@@ -247,6 +256,11 @@ class ZoneSplayTree : public ZoneObject {
Node* node_;
};
+ template <class Callback>
+ void ForEach(Callback c) {
+ DoForEach<typename ZoneSplayTree<Config>::Node, Callback>(root_, c);
+ }
+
private:
Node* root_;
};
@@ -262,10 +276,10 @@ class OutSet {
void Set(unsigned value);
bool Get(unsigned value);
OutSet Clone();
+ static const unsigned kFirstLimit = 32;
private:
OutSet(uint32_t first, ZoneList<unsigned>* remaining)
: first_(first), remaining_(remaining) { }
- static const unsigned kFirstLimit = 32;
uint32_t first_;
ZoneList<unsigned>* remaining_;
};
@@ -309,6 +323,7 @@ class DispatchTable {
};
void AddRange(CharacterRange range, int value);
OutSet Get(uc16 value);
+ void Dump();
private:
ZoneSplayTree<Config>* tree() { return &tree_; }
ZoneSplayTree<Config> tree_;
« 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