Remove some unused stuff from regexp implementation.
Review URL: https://chromiumcodereview.appspot.com/10205010 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11423 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c436c70f8b
commit
83cbc638dc
@ -5175,45 +5175,6 @@ void CharacterRange::Negate(ZoneList<CharacterRange>* ranges,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Interest propagation
|
|
||||||
|
|
||||||
|
|
||||||
RegExpNode* RegExpNode::TryGetSibling(NodeInfo* info) {
|
|
||||||
for (int i = 0; i < siblings_.length(); i++) {
|
|
||||||
RegExpNode* sibling = siblings_.Get(i);
|
|
||||||
if (sibling->info()->Matches(info))
|
|
||||||
return sibling;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RegExpNode* RegExpNode::EnsureSibling(NodeInfo* info, bool* cloned) {
|
|
||||||
ASSERT_EQ(false, *cloned);
|
|
||||||
siblings_.Ensure(this);
|
|
||||||
RegExpNode* result = TryGetSibling(info);
|
|
||||||
if (result != NULL) return result;
|
|
||||||
result = this->Clone();
|
|
||||||
NodeInfo* new_info = result->info();
|
|
||||||
new_info->ResetCompilationState();
|
|
||||||
new_info->AddFromPreceding(info);
|
|
||||||
AddSibling(result);
|
|
||||||
*cloned = true;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class C>
|
|
||||||
static RegExpNode* PropagateToEndpoint(C* node, NodeInfo* info) {
|
|
||||||
NodeInfo full_info(*node->info());
|
|
||||||
full_info.AddFromPreceding(info);
|
|
||||||
bool cloned = false;
|
|
||||||
return RegExpNode::EnsureSibling(node, &full_info, &cloned);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Splay tree
|
// Splay tree
|
||||||
|
|
||||||
|
@ -467,25 +467,6 @@ struct NodeInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SiblingList {
|
|
||||||
public:
|
|
||||||
SiblingList() : list_(NULL) { }
|
|
||||||
int length() {
|
|
||||||
return list_ == NULL ? 0 : list_->length();
|
|
||||||
}
|
|
||||||
void Ensure(RegExpNode* parent) {
|
|
||||||
if (list_ == NULL) {
|
|
||||||
list_ = new ZoneList<RegExpNode*>(2);
|
|
||||||
list_->Add(parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Add(RegExpNode* node) { list_->Add(node); }
|
|
||||||
RegExpNode* Get(int index) { return list_->at(index); }
|
|
||||||
private:
|
|
||||||
ZoneList<RegExpNode*>* list_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Details of a quick mask-compare check that can look ahead in the
|
// Details of a quick mask-compare check that can look ahead in the
|
||||||
// input stream.
|
// input stream.
|
||||||
class QuickCheckDetails {
|
class QuickCheckDetails {
|
||||||
@ -540,7 +521,7 @@ class QuickCheckDetails {
|
|||||||
|
|
||||||
class RegExpNode: public ZoneObject {
|
class RegExpNode: public ZoneObject {
|
||||||
public:
|
public:
|
||||||
RegExpNode() : first_character_set_(NULL), trace_count_(0) {
|
RegExpNode() : trace_count_(0) {
|
||||||
bm_info_[0] = bm_info_[1] = NULL;
|
bm_info_[0] = bm_info_[1] = NULL;
|
||||||
}
|
}
|
||||||
virtual ~RegExpNode();
|
virtual ~RegExpNode();
|
||||||
@ -609,47 +590,15 @@ class RegExpNode: public ZoneObject {
|
|||||||
|
|
||||||
NodeInfo* info() { return &info_; }
|
NodeInfo* info() { return &info_; }
|
||||||
|
|
||||||
void AddSibling(RegExpNode* node) { siblings_.Add(node); }
|
|
||||||
|
|
||||||
// Static version of EnsureSibling that expresses the fact that the
|
|
||||||
// result has the same type as the input.
|
|
||||||
template <class C>
|
|
||||||
static C* EnsureSibling(C* node, NodeInfo* info, bool* cloned) {
|
|
||||||
return static_cast<C*>(node->EnsureSibling(info, cloned));
|
|
||||||
}
|
|
||||||
|
|
||||||
SiblingList* siblings() { return &siblings_; }
|
|
||||||
void set_siblings(SiblingList* other) { siblings_ = *other; }
|
|
||||||
|
|
||||||
// Get and set the cached first character set value.
|
|
||||||
ZoneList<CharacterRange>* first_character_set() {
|
|
||||||
return first_character_set_;
|
|
||||||
}
|
|
||||||
void set_first_character_set(ZoneList<CharacterRange>* character_set) {
|
|
||||||
first_character_set_ = character_set;
|
|
||||||
}
|
|
||||||
BoyerMooreLookahead* bm_info(bool not_at_start) {
|
BoyerMooreLookahead* bm_info(bool not_at_start) {
|
||||||
return bm_info_[not_at_start ? 1 : 0];
|
return bm_info_[not_at_start ? 1 : 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum LimitResult { DONE, CONTINUE };
|
enum LimitResult { DONE, CONTINUE };
|
||||||
static const int kComputeFirstCharacterSetFail = -1;
|
|
||||||
|
|
||||||
LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace);
|
LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace);
|
||||||
|
|
||||||
// Returns a sibling of this node whose interests and assumptions
|
|
||||||
// match the ones in the given node info. If no sibling exists NULL
|
|
||||||
// is returned.
|
|
||||||
RegExpNode* TryGetSibling(NodeInfo* info);
|
|
||||||
|
|
||||||
// Returns a sibling of this node whose interests match the ones in
|
|
||||||
// the given node info. The info must not contain any assertions.
|
|
||||||
// If no node exists a new one will be created by cloning the current
|
|
||||||
// node. The result will always be an instance of the same concrete
|
|
||||||
// class as this node.
|
|
||||||
RegExpNode* EnsureSibling(NodeInfo* info, bool* cloned);
|
|
||||||
|
|
||||||
// Returns a clone of this node initialized using the copy constructor
|
// Returns a clone of this node initialized using the copy constructor
|
||||||
// of its concrete class. Note that the node may have to be pre-
|
// of its concrete class. Note that the node may have to be pre-
|
||||||
// processed before it is on a usable state.
|
// processed before it is on a usable state.
|
||||||
@ -663,8 +612,6 @@ class RegExpNode: public ZoneObject {
|
|||||||
static const int kFirstCharBudget = 10;
|
static const int kFirstCharBudget = 10;
|
||||||
Label label_;
|
Label label_;
|
||||||
NodeInfo info_;
|
NodeInfo info_;
|
||||||
SiblingList siblings_;
|
|
||||||
ZoneList<CharacterRange>* first_character_set_;
|
|
||||||
// This variable keeps track of how many times code has been generated for
|
// This variable keeps track of how many times code has been generated for
|
||||||
// this node (in different traces). We don't keep track of where the
|
// this node (in different traces). We don't keep track of where the
|
||||||
// generated code is located unless the code is generated at the start of
|
// generated code is located unless the code is generated at the start of
|
||||||
|
Loading…
Reference in New Issue
Block a user