Chromium Code Reviews| Index: src/jsregexp.cc |
| =================================================================== |
| --- src/jsregexp.cc (revision 804) |
| +++ src/jsregexp.cc (working copy) |
| @@ -1282,6 +1282,19 @@ |
| } |
| +bool BackReferenceNode::Emit(RegExpCompiler* compiler) { |
| + RegExpMacroAssembler* macro = compiler->macro_assembler(); |
| + Bind(macro); |
| + // Check whether the registers are uninitialized and always |
| + // succeed if they are. |
| + macro->IfRegisterLT(start_reg_, 0, on_success()->label()); |
| + macro->IfRegisterLT(end_reg_, 0, on_success()->label()); |
| + ASSERT(start_reg_ + 1 == end_reg_); |
|
Christian Plesner Hansen
2008/11/21 11:16:39
ASSERT_EQ
|
| + macro->CheckNotBackReference(start_reg_, on_failure_->label()); |
| + return on_success()->GoTo(compiler); |
| +} |
| + |
| + |
| // ------------------------------------------------------------------- |
| // Dot/dotty output |
| @@ -1445,7 +1458,7 @@ |
| } |
| -void DotPrinter::VisitBackreference(BackreferenceNode* that) { |
| +void DotPrinter::VisitBackReference(BackReferenceNode* that) { |
| stream()->Add(" n%p [label=\"$%i..$%i\", shape=doubleoctagon];\n", |
| that, |
| that->start_register(), |
| @@ -1678,10 +1691,10 @@ |
| } |
| -RegExpNode* RegExpBackreference::ToNode(RegExpCompiler* compiler, |
| +RegExpNode* RegExpBackReference::ToNode(RegExpCompiler* compiler, |
| RegExpNode* on_success, |
| RegExpNode* on_failure) { |
| - return new BackreferenceNode(RegExpCapture::StartRegister(index()), |
| + return new BackReferenceNode(RegExpCapture::StartRegister(index()), |
| RegExpCapture::EndRegister(index()), |
| on_success, |
| on_failure); |
| @@ -1936,7 +1949,7 @@ |
| } |
| -RegExpNode* BackreferenceNode::PropagateInterest(NodeInfo* info) { |
| +RegExpNode* BackReferenceNode::PropagateInterest(NodeInfo* info) { |
| return PropagateToEndpoint(this, info); |
| } |
| @@ -2146,7 +2159,7 @@ |
| } |
| -void Analysis::VisitBackreference(BackreferenceNode* that) { |
| +void Analysis::VisitBackReference(BackReferenceNode* that) { |
| EnsureAnalyzed(that->on_success()); |
| EnsureAnalyzed(that->on_failure()); |
| } |
| @@ -2203,8 +2216,14 @@ |
| } |
| -void DispatchTableConstructor::VisitBackreference(BackreferenceNode* that) { |
| - // TODO(plesner): What should this do? |
| +void DispatchTableConstructor::VisitBackReference(BackReferenceNode* that) { |
| + // TODO(plesner): Find the node that we refer back to and propagate its start |
| + // set back to here. For now we just accept anything. |
| + AddRange(CharacterRange::Everything()); |
| + RegExpNode* next = that->on_success(); |
| + that->info()->determine_newline = next->info()->prev_determine_newline(); |
|
Christian Plesner Hansen
2008/11/21 11:16:39
Propagating this stuff is not the dispatch table c
|
| + that->info()->determine_word = next->info()->prev_determine_word(); |
| + that->info()->determine_start = next->info()->prev_determine_start(); |
| } |