| Index: src/ast.cc
|
| diff --git a/src/ast.cc b/src/ast.cc
|
| index 1433fe7ad07bbc5d153d4208d319b98a7e3d38dd..5034151efd607de55ccc62dfdd3d888178548b84 100644
|
| --- a/src/ast.cc
|
| +++ b/src/ast.cc
|
| @@ -210,6 +210,40 @@ FOR_EACH_REG_EXP_TREE_TYPE(MAKE_TYPE_CASE)
|
| RegExpEmpty RegExpEmpty::kInstance;
|
|
|
|
|
| +static Interval ListCaptureRegisters(ZoneList<RegExpTree*>* children) {
|
| + Interval result = Interval::Empty();
|
| + for (int i = 0; i < children->length(); i++)
|
| + result = result.Union(children->at(i)->CaptureRegisters());
|
| + return result;
|
| +}
|
| +
|
| +
|
| +Interval RegExpAlternative::CaptureRegisters() {
|
| + return ListCaptureRegisters(nodes());
|
| +}
|
| +
|
| +
|
| +Interval RegExpDisjunction::CaptureRegisters() {
|
| + return ListCaptureRegisters(alternatives());
|
| +}
|
| +
|
| +
|
| +Interval RegExpLookahead::CaptureRegisters() {
|
| + return body()->CaptureRegisters();
|
| +}
|
| +
|
| +
|
| +Interval RegExpCapture::CaptureRegisters() {
|
| + Interval self(StartRegister(index()), EndRegister(index()));
|
| + return self.Union(body()->CaptureRegisters());
|
| +}
|
| +
|
| +
|
| +Interval RegExpQuantifier::CaptureRegisters() {
|
| + return body()->CaptureRegisters();
|
| +}
|
| +
|
| +
|
| // Convert regular expression trees to a simple sexp representation.
|
| // This representation should be different from the input grammar
|
| // in as many cases as possible, to make it more difficult for incorrect
|
|
|