| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_REGEXP_JSREGEXP_H_ | 5 #ifndef V8_REGEXP_JSREGEXP_H_ |
| 6 #define V8_REGEXP_JSREGEXP_H_ | 6 #define V8_REGEXP_JSREGEXP_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/regexp/regexp-ast.h" | 10 #include "src/regexp/regexp-ast.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 return NULL; | 529 return NULL; |
| 530 } | 530 } |
| 531 | 531 |
| 532 // Collects information on the possible code units (mod 128) that can match if | 532 // Collects information on the possible code units (mod 128) that can match if |
| 533 // we look forward. This is used for a Boyer-Moore-like string searching | 533 // we look forward. This is used for a Boyer-Moore-like string searching |
| 534 // implementation. TODO(erikcorry): This should share more code with | 534 // implementation. TODO(erikcorry): This should share more code with |
| 535 // EatsAtLeast, GetQuickCheckDetails. The budget argument is used to limit | 535 // EatsAtLeast, GetQuickCheckDetails. The budget argument is used to limit |
| 536 // the number of nodes we are willing to look at in order to create this data. | 536 // the number of nodes we are willing to look at in order to create this data. |
| 537 static const int kRecursionBudget = 200; | 537 static const int kRecursionBudget = 200; |
| 538 bool KeepRecursing(RegExpCompiler* compiler); | 538 bool KeepRecursing(RegExpCompiler* compiler); |
| 539 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 539 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 540 BoyerMooreLookahead* bm, bool not_at_start) { | 540 BoyerMooreLookahead* bm, bool not_at_start) { |
| 541 UNREACHABLE(); | 541 UNREACHABLE(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 // If we know that the input is one-byte then there are some nodes that can | 544 // If we know that the input is one-byte then there are some nodes that can |
| 545 // never match. This method returns a node that can be substituted for | 545 // never match. This method returns a node that can be substituted for |
| 546 // itself, or NULL if the node can never match. | 546 // itself, or NULL if the node can never match. |
| 547 virtual RegExpNode* FilterOneByte(int depth, bool ignore_case) { | 547 virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler) { |
| 548 return this; | 548 return this; |
| 549 } | 549 } |
| 550 // Helper for FilterOneByte. | 550 // Helper for FilterOneByte. |
| 551 RegExpNode* replacement() { | 551 RegExpNode* replacement() { |
| 552 DCHECK(info()->replacement_calculated); | 552 DCHECK(info()->replacement_calculated); |
| 553 return replacement_; | 553 return replacement_; |
| 554 } | 554 } |
| 555 RegExpNode* set_replacement(RegExpNode* replacement) { | 555 RegExpNode* set_replacement(RegExpNode* replacement) { |
| 556 info()->replacement_calculated = true; | 556 info()->replacement_calculated = true; |
| 557 replacement_ = replacement; | 557 replacement_ = replacement; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 Zone* zone_; | 611 Zone* zone_; |
| 612 }; | 612 }; |
| 613 | 613 |
| 614 | 614 |
| 615 class SeqRegExpNode: public RegExpNode { | 615 class SeqRegExpNode: public RegExpNode { |
| 616 public: | 616 public: |
| 617 explicit SeqRegExpNode(RegExpNode* on_success) | 617 explicit SeqRegExpNode(RegExpNode* on_success) |
| 618 : RegExpNode(on_success->zone()), on_success_(on_success) { } | 618 : RegExpNode(on_success->zone()), on_success_(on_success) { } |
| 619 RegExpNode* on_success() { return on_success_; } | 619 RegExpNode* on_success() { return on_success_; } |
| 620 void set_on_success(RegExpNode* node) { on_success_ = node; } | 620 void set_on_success(RegExpNode* node) { on_success_ = node; } |
| 621 virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 621 virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); |
| 622 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 622 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 623 BoyerMooreLookahead* bm, bool not_at_start) { | 623 BoyerMooreLookahead* bm, bool not_at_start) { |
| 624 on_success_->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start); | 624 on_success_->FillInBMInfo(compiler, offset, budget - 1, bm, not_at_start); |
| 625 if (offset == 0) set_bm_info(not_at_start, bm); | 625 if (offset == 0) set_bm_info(not_at_start, bm); |
| 626 } | 626 } |
| 627 | 627 |
| 628 protected: | 628 protected: |
| 629 RegExpNode* FilterSuccessor(int depth, bool ignore_case); | 629 RegExpNode* FilterSuccessor(int depth, RegExpCompiler* compiler); |
| 630 | 630 |
| 631 private: | 631 private: |
| 632 RegExpNode* on_success_; | 632 RegExpNode* on_success_; |
| 633 }; | 633 }; |
| 634 | 634 |
| 635 | 635 |
| 636 class ActionNode: public SeqRegExpNode { | 636 class ActionNode: public SeqRegExpNode { |
| 637 public: | 637 public: |
| 638 enum ActionType { | 638 enum ActionType { |
| 639 SET_REGISTER, | 639 SET_REGISTER, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 665 virtual void Accept(NodeVisitor* visitor); | 665 virtual void Accept(NodeVisitor* visitor); |
| 666 virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 666 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
| 667 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 667 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); |
| 668 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 668 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 669 RegExpCompiler* compiler, | 669 RegExpCompiler* compiler, |
| 670 int filled_in, | 670 int filled_in, |
| 671 bool not_at_start) { | 671 bool not_at_start) { |
| 672 return on_success()->GetQuickCheckDetails( | 672 return on_success()->GetQuickCheckDetails( |
| 673 details, compiler, filled_in, not_at_start); | 673 details, compiler, filled_in, not_at_start); |
| 674 } | 674 } |
| 675 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 675 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 676 BoyerMooreLookahead* bm, bool not_at_start); | 676 BoyerMooreLookahead* bm, bool not_at_start); |
| 677 ActionType action_type() { return action_type_; } | 677 ActionType action_type() { return action_type_; } |
| 678 // TODO(erikcorry): We should allow some action nodes in greedy loops. | 678 // TODO(erikcorry): We should allow some action nodes in greedy loops. |
| 679 virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; } | 679 virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; } |
| 680 | 680 |
| 681 private: | 681 private: |
| 682 union { | 682 union { |
| 683 struct { | 683 struct { |
| 684 int reg; | 684 int reg; |
| 685 int value; | 685 int value; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 744 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 745 RegExpCompiler* compiler, | 745 RegExpCompiler* compiler, |
| 746 int characters_filled_in, | 746 int characters_filled_in, |
| 747 bool not_at_start); | 747 bool not_at_start); |
| 748 ZoneList<TextElement>* elements() { return elms_; } | 748 ZoneList<TextElement>* elements() { return elms_; } |
| 749 bool read_backward() { return read_backward_; } | 749 bool read_backward() { return read_backward_; } |
| 750 void MakeCaseIndependent(Isolate* isolate, bool is_one_byte); | 750 void MakeCaseIndependent(Isolate* isolate, bool is_one_byte); |
| 751 virtual int GreedyLoopTextLength(); | 751 virtual int GreedyLoopTextLength(); |
| 752 virtual RegExpNode* GetSuccessorOfOmnivorousTextNode( | 752 virtual RegExpNode* GetSuccessorOfOmnivorousTextNode( |
| 753 RegExpCompiler* compiler); | 753 RegExpCompiler* compiler); |
| 754 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 754 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 755 BoyerMooreLookahead* bm, bool not_at_start); | 755 BoyerMooreLookahead* bm, bool not_at_start); |
| 756 void CalculateOffsets(); | 756 void CalculateOffsets(); |
| 757 virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 757 virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); |
| 758 | 758 |
| 759 private: | 759 private: |
| 760 enum TextEmitPassType { | 760 enum TextEmitPassType { |
| 761 NON_LATIN1_MATCH, // Check for characters that can't match. | 761 NON_LATIN1_MATCH, // Check for characters that can't match. |
| 762 SIMPLE_CHARACTER_MATCH, // Case-dependent single character check. | 762 SIMPLE_CHARACTER_MATCH, // Case-dependent single character check. |
| 763 NON_LETTER_CHARACTER_MATCH, // Check characters that have no case equivs. | 763 NON_LETTER_CHARACTER_MATCH, // Check characters that have no case equivs. |
| 764 CASE_CHARACTER_MATCH, // Case-independent single character check. | 764 CASE_CHARACTER_MATCH, // Case-independent single character check. |
| 765 CHARACTER_CLASS_MATCH // Character class. | 765 CHARACTER_CLASS_MATCH // Character class. |
| 766 }; | 766 }; |
| 767 static bool SkipPass(int pass, bool ignore_case); | 767 static bool SkipPass(int pass, bool ignore_case); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 static AssertionNode* AfterNewline(RegExpNode* on_success) { | 803 static AssertionNode* AfterNewline(RegExpNode* on_success) { |
| 804 return new(on_success->zone()) AssertionNode(AFTER_NEWLINE, on_success); | 804 return new(on_success->zone()) AssertionNode(AFTER_NEWLINE, on_success); |
| 805 } | 805 } |
| 806 virtual void Accept(NodeVisitor* visitor); | 806 virtual void Accept(NodeVisitor* visitor); |
| 807 virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 807 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
| 808 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 808 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); |
| 809 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 809 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 810 RegExpCompiler* compiler, | 810 RegExpCompiler* compiler, |
| 811 int filled_in, | 811 int filled_in, |
| 812 bool not_at_start); | 812 bool not_at_start); |
| 813 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 813 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 814 BoyerMooreLookahead* bm, bool not_at_start); | 814 BoyerMooreLookahead* bm, bool not_at_start); |
| 815 AssertionType assertion_type() { return assertion_type_; } | 815 AssertionType assertion_type() { return assertion_type_; } |
| 816 | 816 |
| 817 private: | 817 private: |
| 818 void EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace); | 818 void EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace); |
| 819 enum IfPrevious { kIsNonWord, kIsWord }; | 819 enum IfPrevious { kIsNonWord, kIsWord }; |
| 820 void BacktrackIfPrevious(RegExpCompiler* compiler, | 820 void BacktrackIfPrevious(RegExpCompiler* compiler, |
| 821 Trace* trace, | 821 Trace* trace, |
| 822 IfPrevious backtrack_if_previous); | 822 IfPrevious backtrack_if_previous); |
| 823 AssertionNode(AssertionType t, RegExpNode* on_success) | 823 AssertionNode(AssertionType t, RegExpNode* on_success) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 841 virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 841 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
| 842 virtual int EatsAtLeast(int still_to_find, | 842 virtual int EatsAtLeast(int still_to_find, |
| 843 int recursion_depth, | 843 int recursion_depth, |
| 844 bool not_at_start); | 844 bool not_at_start); |
| 845 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 845 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 846 RegExpCompiler* compiler, | 846 RegExpCompiler* compiler, |
| 847 int characters_filled_in, | 847 int characters_filled_in, |
| 848 bool not_at_start) { | 848 bool not_at_start) { |
| 849 return; | 849 return; |
| 850 } | 850 } |
| 851 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 851 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 852 BoyerMooreLookahead* bm, bool not_at_start); | 852 BoyerMooreLookahead* bm, bool not_at_start); |
| 853 | 853 |
| 854 private: | 854 private: |
| 855 int start_reg_; | 855 int start_reg_; |
| 856 int end_reg_; | 856 int end_reg_; |
| 857 bool read_backward_; | 857 bool read_backward_; |
| 858 }; | 858 }; |
| 859 | 859 |
| 860 | 860 |
| 861 class EndNode: public RegExpNode { | 861 class EndNode: public RegExpNode { |
| 862 public: | 862 public: |
| 863 enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; | 863 enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; |
| 864 EndNode(Action action, Zone* zone) : RegExpNode(zone), action_(action) {} | 864 EndNode(Action action, Zone* zone) : RegExpNode(zone), action_(action) {} |
| 865 virtual void Accept(NodeVisitor* visitor); | 865 virtual void Accept(NodeVisitor* visitor); |
| 866 virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 866 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
| 867 virtual int EatsAtLeast(int still_to_find, | 867 virtual int EatsAtLeast(int still_to_find, |
| 868 int recursion_depth, | 868 int recursion_depth, |
| 869 bool not_at_start) { return 0; } | 869 bool not_at_start) { return 0; } |
| 870 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 870 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 871 RegExpCompiler* compiler, | 871 RegExpCompiler* compiler, |
| 872 int characters_filled_in, | 872 int characters_filled_in, |
| 873 bool not_at_start) { | 873 bool not_at_start) { |
| 874 // Returning 0 from EatsAtLeast should ensure we never get here. | 874 // Returning 0 from EatsAtLeast should ensure we never get here. |
| 875 UNREACHABLE(); | 875 UNREACHABLE(); |
| 876 } | 876 } |
| 877 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 877 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 878 BoyerMooreLookahead* bm, bool not_at_start) { | 878 BoyerMooreLookahead* bm, bool not_at_start) { |
| 879 // Returning 0 from EatsAtLeast should ensure we never get here. | 879 // Returning 0 from EatsAtLeast should ensure we never get here. |
| 880 UNREACHABLE(); | 880 UNREACHABLE(); |
| 881 } | 881 } |
| 882 | 882 |
| 883 private: | 883 private: |
| 884 Action action_; | 884 Action action_; |
| 885 }; | 885 }; |
| 886 | 886 |
| 887 | 887 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 960 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
| 961 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 961 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); |
| 962 int EatsAtLeastHelper(int still_to_find, | 962 int EatsAtLeastHelper(int still_to_find, |
| 963 int budget, | 963 int budget, |
| 964 RegExpNode* ignore_this_node, | 964 RegExpNode* ignore_this_node, |
| 965 bool not_at_start); | 965 bool not_at_start); |
| 966 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 966 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 967 RegExpCompiler* compiler, | 967 RegExpCompiler* compiler, |
| 968 int characters_filled_in, | 968 int characters_filled_in, |
| 969 bool not_at_start); | 969 bool not_at_start); |
| 970 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 970 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 971 BoyerMooreLookahead* bm, bool not_at_start); | 971 BoyerMooreLookahead* bm, bool not_at_start); |
| 972 | 972 |
| 973 bool being_calculated() { return being_calculated_; } | 973 bool being_calculated() { return being_calculated_; } |
| 974 bool not_at_start() { return not_at_start_; } | 974 bool not_at_start() { return not_at_start_; } |
| 975 void set_not_at_start() { not_at_start_ = true; } | 975 void set_not_at_start() { not_at_start_ = true; } |
| 976 void set_being_calculated(bool b) { being_calculated_ = b; } | 976 void set_being_calculated(bool b) { being_calculated_ = b; } |
| 977 virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { | 977 virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { |
| 978 return true; | 978 return true; |
| 979 } | 979 } |
| 980 virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 980 virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); |
| 981 virtual bool read_backward() { return false; } | 981 virtual bool read_backward() { return false; } |
| 982 | 982 |
| 983 protected: | 983 protected: |
| 984 int GreedyLoopTextLengthForAlternative(GuardedAlternative* alternative); | 984 int GreedyLoopTextLengthForAlternative(GuardedAlternative* alternative); |
| 985 ZoneList<GuardedAlternative>* alternatives_; | 985 ZoneList<GuardedAlternative>* alternatives_; |
| 986 | 986 |
| 987 private: | 987 private: |
| 988 friend class DispatchTableConstructor; | 988 friend class DispatchTableConstructor; |
| 989 friend class Analysis; | 989 friend class Analysis; |
| 990 void GenerateGuard(RegExpMacroAssembler* macro_assembler, | 990 void GenerateGuard(RegExpMacroAssembler* macro_assembler, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 Zone* zone) | 1028 Zone* zone) |
| 1029 : ChoiceNode(2, zone) { | 1029 : ChoiceNode(2, zone) { |
| 1030 AddAlternative(this_must_fail); | 1030 AddAlternative(this_must_fail); |
| 1031 AddAlternative(then_do_this); | 1031 AddAlternative(then_do_this); |
| 1032 } | 1032 } |
| 1033 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 1033 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); |
| 1034 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 1034 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 1035 RegExpCompiler* compiler, | 1035 RegExpCompiler* compiler, |
| 1036 int characters_filled_in, | 1036 int characters_filled_in, |
| 1037 bool not_at_start); | 1037 bool not_at_start); |
| 1038 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 1038 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 1039 BoyerMooreLookahead* bm, bool not_at_start) { | 1039 BoyerMooreLookahead* bm, bool not_at_start) { |
| 1040 alternatives_->at(1).node()->FillInBMInfo(isolate, offset, budget - 1, bm, | 1040 alternatives_->at(1).node()->FillInBMInfo(compiler, offset, budget - 1, bm, |
| 1041 not_at_start); | 1041 not_at_start); |
| 1042 if (offset == 0) set_bm_info(not_at_start, bm); | 1042 if (offset == 0) set_bm_info(not_at_start, bm); |
| 1043 } | 1043 } |
| 1044 // For a negative lookahead we don't emit the quick check for the | 1044 // For a negative lookahead we don't emit the quick check for the |
| 1045 // alternative that is expected to fail. This is because quick check code | 1045 // alternative that is expected to fail. This is because quick check code |
| 1046 // starts by loading enough characters for the alternative that takes fewest | 1046 // starts by loading enough characters for the alternative that takes fewest |
| 1047 // characters, but on a negative lookahead the negative branch did not take | 1047 // characters, but on a negative lookahead the negative branch did not take |
| 1048 // part in that calculation (EatsAtLeast) so the assumptions don't hold. | 1048 // part in that calculation (EatsAtLeast) so the assumptions don't hold. |
| 1049 virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { | 1049 virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { |
| 1050 return !is_first; | 1050 return !is_first; |
| 1051 } | 1051 } |
| 1052 virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 1052 virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); |
| 1053 }; | 1053 }; |
| 1054 | 1054 |
| 1055 | 1055 |
| 1056 class LoopChoiceNode: public ChoiceNode { | 1056 class LoopChoiceNode: public ChoiceNode { |
| 1057 public: | 1057 public: |
| 1058 LoopChoiceNode(bool body_can_be_zero_length, bool read_backward, Zone* zone) | 1058 LoopChoiceNode(bool body_can_be_zero_length, bool read_backward, Zone* zone) |
| 1059 : ChoiceNode(2, zone), | 1059 : ChoiceNode(2, zone), |
| 1060 loop_node_(NULL), | 1060 loop_node_(NULL), |
| 1061 continue_node_(NULL), | 1061 continue_node_(NULL), |
| 1062 body_can_be_zero_length_(body_can_be_zero_length), | 1062 body_can_be_zero_length_(body_can_be_zero_length), |
| 1063 read_backward_(read_backward) {} | 1063 read_backward_(read_backward) {} |
| 1064 void AddLoopAlternative(GuardedAlternative alt); | 1064 void AddLoopAlternative(GuardedAlternative alt); |
| 1065 void AddContinueAlternative(GuardedAlternative alt); | 1065 void AddContinueAlternative(GuardedAlternative alt); |
| 1066 virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 1066 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
| 1067 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 1067 virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); |
| 1068 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 1068 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
| 1069 RegExpCompiler* compiler, | 1069 RegExpCompiler* compiler, |
| 1070 int characters_filled_in, | 1070 int characters_filled_in, |
| 1071 bool not_at_start); | 1071 bool not_at_start); |
| 1072 virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 1072 virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, |
| 1073 BoyerMooreLookahead* bm, bool not_at_start); | 1073 BoyerMooreLookahead* bm, bool not_at_start); |
| 1074 RegExpNode* loop_node() { return loop_node_; } | 1074 RegExpNode* loop_node() { return loop_node_; } |
| 1075 RegExpNode* continue_node() { return continue_node_; } | 1075 RegExpNode* continue_node() { return continue_node_; } |
| 1076 bool body_can_be_zero_length() { return body_can_be_zero_length_; } | 1076 bool body_can_be_zero_length() { return body_can_be_zero_length_; } |
| 1077 virtual bool read_backward() { return read_backward_; } | 1077 virtual bool read_backward() { return read_backward_; } |
| 1078 virtual void Accept(NodeVisitor* visitor); | 1078 virtual void Accept(NodeVisitor* visitor); |
| 1079 virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 1079 virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); |
| 1080 | 1080 |
| 1081 private: | 1081 private: |
| 1082 // AddAlternative is made private for loop nodes because alternatives | 1082 // AddAlternative is made private for loop nodes because alternatives |
| 1083 // should not be added freely, we need to keep track of which node | 1083 // should not be added freely, we need to keep track of which node |
| 1084 // goes back to the node itself. | 1084 // goes back to the node itself. |
| 1085 void AddAlternative(GuardedAlternative node) { | 1085 void AddAlternative(GuardedAlternative node) { |
| 1086 ChoiceNode::AddAlternative(node); | 1086 ChoiceNode::AddAlternative(node); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 RegExpNode* loop_node_; | 1089 RegExpNode* loop_node_; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 static const int kStringOffset = 0; | 1588 static const int kStringOffset = 0; |
| 1589 static const int kPatternOffset = 1; | 1589 static const int kPatternOffset = 1; |
| 1590 static const int kArrayOffset = 2; | 1590 static const int kArrayOffset = 2; |
| 1591 static const int kLastMatchOffset = 3; | 1591 static const int kLastMatchOffset = 3; |
| 1592 }; | 1592 }; |
| 1593 | 1593 |
| 1594 } // namespace internal | 1594 } // namespace internal |
| 1595 } // namespace v8 | 1595 } // namespace v8 |
| 1596 | 1596 |
| 1597 #endif // V8_REGEXP_JSREGEXP_H_ | 1597 #endif // V8_REGEXP_JSREGEXP_H_ |
| OLD | NEW |