| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 522     return NULL; | 522     return NULL; | 
| 523   } | 523   } | 
| 524 | 524 | 
| 525   // Collects information on the possible code units (mod 128) that can match if | 525   // Collects information on the possible code units (mod 128) that can match if | 
| 526   // we look forward.  This is used for a Boyer-Moore-like string searching | 526   // we look forward.  This is used for a Boyer-Moore-like string searching | 
| 527   // implementation.  TODO(erikcorry):  This should share more code with | 527   // implementation.  TODO(erikcorry):  This should share more code with | 
| 528   // EatsAtLeast, GetQuickCheckDetails.  The budget argument is used to limit | 528   // EatsAtLeast, GetQuickCheckDetails.  The budget argument is used to limit | 
| 529   // the number of nodes we are willing to look at in order to create this data. | 529   // the number of nodes we are willing to look at in order to create this data. | 
| 530   static const int kRecursionBudget = 200; | 530   static const int kRecursionBudget = 200; | 
| 531   bool KeepRecursing(RegExpCompiler* compiler); | 531   bool KeepRecursing(RegExpCompiler* compiler); | 
| 532   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 532   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 533                             BoyerMooreLookahead* bm, bool not_at_start) { | 533                             BoyerMooreLookahead* bm, bool not_at_start) { | 
| 534     UNREACHABLE(); | 534     UNREACHABLE(); | 
| 535   } | 535   } | 
| 536 | 536 | 
| 537   // If we know that the input is one-byte then there are some nodes that can | 537   // If we know that the input is one-byte then there are some nodes that can | 
| 538   // never match.  This method returns a node that can be substituted for | 538   // never match.  This method returns a node that can be substituted for | 
| 539   // itself, or NULL if the node can never match. | 539   // itself, or NULL if the node can never match. | 
| 540   virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler) { | 540   virtual RegExpNode* FilterOneByte(int depth, bool ignore_case) { | 
| 541     return this; | 541     return this; | 
| 542   } | 542   } | 
| 543   // Helper for FilterOneByte. | 543   // Helper for FilterOneByte. | 
| 544   RegExpNode* replacement() { | 544   RegExpNode* replacement() { | 
| 545     DCHECK(info()->replacement_calculated); | 545     DCHECK(info()->replacement_calculated); | 
| 546     return replacement_; | 546     return replacement_; | 
| 547   } | 547   } | 
| 548   RegExpNode* set_replacement(RegExpNode* replacement) { | 548   RegExpNode* set_replacement(RegExpNode* replacement) { | 
| 549     info()->replacement_calculated = true; | 549     info()->replacement_calculated = true; | 
| 550     replacement_ =  replacement; | 550     replacement_ =  replacement; | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 604   Zone* zone_; | 604   Zone* zone_; | 
| 605 }; | 605 }; | 
| 606 | 606 | 
| 607 | 607 | 
| 608 class SeqRegExpNode: public RegExpNode { | 608 class SeqRegExpNode: public RegExpNode { | 
| 609  public: | 609  public: | 
| 610   explicit SeqRegExpNode(RegExpNode* on_success) | 610   explicit SeqRegExpNode(RegExpNode* on_success) | 
| 611       : RegExpNode(on_success->zone()), on_success_(on_success) { } | 611       : RegExpNode(on_success->zone()), on_success_(on_success) { } | 
| 612   RegExpNode* on_success() { return on_success_; } | 612   RegExpNode* on_success() { return on_success_; } | 
| 613   void set_on_success(RegExpNode* node) { on_success_ = node; } | 613   void set_on_success(RegExpNode* node) { on_success_ = node; } | 
| 614   virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); | 614   virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 
| 615   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 615   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 616                             BoyerMooreLookahead* bm, bool not_at_start) { | 616                             BoyerMooreLookahead* bm, bool not_at_start) { | 
| 617     on_success_->FillInBMInfo(compiler, offset, budget - 1, bm, not_at_start); | 617     on_success_->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start); | 
| 618     if (offset == 0) set_bm_info(not_at_start, bm); | 618     if (offset == 0) set_bm_info(not_at_start, bm); | 
| 619   } | 619   } | 
| 620 | 620 | 
| 621  protected: | 621  protected: | 
| 622   RegExpNode* FilterSuccessor(int depth, RegExpCompiler* compiler); | 622   RegExpNode* FilterSuccessor(int depth, bool ignore_case); | 
| 623 | 623 | 
| 624  private: | 624  private: | 
| 625   RegExpNode* on_success_; | 625   RegExpNode* on_success_; | 
| 626 }; | 626 }; | 
| 627 | 627 | 
| 628 | 628 | 
| 629 class ActionNode: public SeqRegExpNode { | 629 class ActionNode: public SeqRegExpNode { | 
| 630  public: | 630  public: | 
| 631   enum ActionType { | 631   enum ActionType { | 
| 632     SET_REGISTER, | 632     SET_REGISTER, | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 658   virtual void Accept(NodeVisitor* visitor); | 658   virtual void Accept(NodeVisitor* visitor); | 
| 659   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 659   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 
| 660   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 660   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 
| 661   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 661   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 662                                     RegExpCompiler* compiler, | 662                                     RegExpCompiler* compiler, | 
| 663                                     int filled_in, | 663                                     int filled_in, | 
| 664                                     bool not_at_start) { | 664                                     bool not_at_start) { | 
| 665     return on_success()->GetQuickCheckDetails( | 665     return on_success()->GetQuickCheckDetails( | 
| 666         details, compiler, filled_in, not_at_start); | 666         details, compiler, filled_in, not_at_start); | 
| 667   } | 667   } | 
| 668   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 668   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 669                             BoyerMooreLookahead* bm, bool not_at_start); | 669                             BoyerMooreLookahead* bm, bool not_at_start); | 
| 670   ActionType action_type() { return action_type_; } | 670   ActionType action_type() { return action_type_; } | 
| 671   // TODO(erikcorry): We should allow some action nodes in greedy loops. | 671   // TODO(erikcorry): We should allow some action nodes in greedy loops. | 
| 672   virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; } | 672   virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; } | 
| 673 | 673 | 
| 674  private: | 674  private: | 
| 675   union { | 675   union { | 
| 676     struct { | 676     struct { | 
| 677       int reg; | 677       int reg; | 
| 678       int value; | 678       int value; | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 737   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 737   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 738                                     RegExpCompiler* compiler, | 738                                     RegExpCompiler* compiler, | 
| 739                                     int characters_filled_in, | 739                                     int characters_filled_in, | 
| 740                                     bool not_at_start); | 740                                     bool not_at_start); | 
| 741   ZoneList<TextElement>* elements() { return elms_; } | 741   ZoneList<TextElement>* elements() { return elms_; } | 
| 742   bool read_backward() { return read_backward_; } | 742   bool read_backward() { return read_backward_; } | 
| 743   void MakeCaseIndependent(Isolate* isolate, bool is_one_byte); | 743   void MakeCaseIndependent(Isolate* isolate, bool is_one_byte); | 
| 744   virtual int GreedyLoopTextLength(); | 744   virtual int GreedyLoopTextLength(); | 
| 745   virtual RegExpNode* GetSuccessorOfOmnivorousTextNode( | 745   virtual RegExpNode* GetSuccessorOfOmnivorousTextNode( | 
| 746       RegExpCompiler* compiler); | 746       RegExpCompiler* compiler); | 
| 747   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 747   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 748                             BoyerMooreLookahead* bm, bool not_at_start); | 748                             BoyerMooreLookahead* bm, bool not_at_start); | 
| 749   void CalculateOffsets(); | 749   void CalculateOffsets(); | 
| 750   virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); | 750   virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 
| 751 | 751 | 
| 752  private: | 752  private: | 
| 753   enum TextEmitPassType { | 753   enum TextEmitPassType { | 
| 754     NON_LATIN1_MATCH,            // Check for characters that can't match. | 754     NON_LATIN1_MATCH,            // Check for characters that can't match. | 
| 755     SIMPLE_CHARACTER_MATCH,      // Case-dependent single character check. | 755     SIMPLE_CHARACTER_MATCH,      // Case-dependent single character check. | 
| 756     NON_LETTER_CHARACTER_MATCH,  // Check characters that have no case equivs. | 756     NON_LETTER_CHARACTER_MATCH,  // Check characters that have no case equivs. | 
| 757     CASE_CHARACTER_MATCH,        // Case-independent single character check. | 757     CASE_CHARACTER_MATCH,        // Case-independent single character check. | 
| 758     CHARACTER_CLASS_MATCH        // Character class. | 758     CHARACTER_CLASS_MATCH        // Character class. | 
| 759   }; | 759   }; | 
| 760   static bool SkipPass(int pass, bool ignore_case); | 760   static bool SkipPass(int pass, bool ignore_case); | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 796   static AssertionNode* AfterNewline(RegExpNode* on_success) { | 796   static AssertionNode* AfterNewline(RegExpNode* on_success) { | 
| 797     return new(on_success->zone()) AssertionNode(AFTER_NEWLINE, on_success); | 797     return new(on_success->zone()) AssertionNode(AFTER_NEWLINE, on_success); | 
| 798   } | 798   } | 
| 799   virtual void Accept(NodeVisitor* visitor); | 799   virtual void Accept(NodeVisitor* visitor); | 
| 800   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 800   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 
| 801   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 801   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 
| 802   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 802   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 803                                     RegExpCompiler* compiler, | 803                                     RegExpCompiler* compiler, | 
| 804                                     int filled_in, | 804                                     int filled_in, | 
| 805                                     bool not_at_start); | 805                                     bool not_at_start); | 
| 806   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 806   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 807                             BoyerMooreLookahead* bm, bool not_at_start); | 807                             BoyerMooreLookahead* bm, bool not_at_start); | 
| 808   AssertionType assertion_type() { return assertion_type_; } | 808   AssertionType assertion_type() { return assertion_type_; } | 
| 809 | 809 | 
| 810  private: | 810  private: | 
| 811   void EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace); | 811   void EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace); | 
| 812   enum IfPrevious { kIsNonWord, kIsWord }; | 812   enum IfPrevious { kIsNonWord, kIsWord }; | 
| 813   void BacktrackIfPrevious(RegExpCompiler* compiler, | 813   void BacktrackIfPrevious(RegExpCompiler* compiler, | 
| 814                            Trace* trace, | 814                            Trace* trace, | 
| 815                            IfPrevious backtrack_if_previous); | 815                            IfPrevious backtrack_if_previous); | 
| 816   AssertionNode(AssertionType t, RegExpNode* on_success) | 816   AssertionNode(AssertionType t, RegExpNode* on_success) | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 834   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 834   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 
| 835   virtual int EatsAtLeast(int still_to_find, | 835   virtual int EatsAtLeast(int still_to_find, | 
| 836                           int recursion_depth, | 836                           int recursion_depth, | 
| 837                           bool not_at_start); | 837                           bool not_at_start); | 
| 838   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 838   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 839                                     RegExpCompiler* compiler, | 839                                     RegExpCompiler* compiler, | 
| 840                                     int characters_filled_in, | 840                                     int characters_filled_in, | 
| 841                                     bool not_at_start) { | 841                                     bool not_at_start) { | 
| 842     return; | 842     return; | 
| 843   } | 843   } | 
| 844   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 844   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 845                             BoyerMooreLookahead* bm, bool not_at_start); | 845                             BoyerMooreLookahead* bm, bool not_at_start); | 
| 846 | 846 | 
| 847  private: | 847  private: | 
| 848   int start_reg_; | 848   int start_reg_; | 
| 849   int end_reg_; | 849   int end_reg_; | 
| 850   bool read_backward_; | 850   bool read_backward_; | 
| 851 }; | 851 }; | 
| 852 | 852 | 
| 853 | 853 | 
| 854 class EndNode: public RegExpNode { | 854 class EndNode: public RegExpNode { | 
| 855  public: | 855  public: | 
| 856   enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; | 856   enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; | 
| 857   EndNode(Action action, Zone* zone) : RegExpNode(zone), action_(action) {} | 857   EndNode(Action action, Zone* zone) : RegExpNode(zone), action_(action) {} | 
| 858   virtual void Accept(NodeVisitor* visitor); | 858   virtual void Accept(NodeVisitor* visitor); | 
| 859   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 859   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 
| 860   virtual int EatsAtLeast(int still_to_find, | 860   virtual int EatsAtLeast(int still_to_find, | 
| 861                           int recursion_depth, | 861                           int recursion_depth, | 
| 862                           bool not_at_start) { return 0; } | 862                           bool not_at_start) { return 0; } | 
| 863   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 863   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 864                                     RegExpCompiler* compiler, | 864                                     RegExpCompiler* compiler, | 
| 865                                     int characters_filled_in, | 865                                     int characters_filled_in, | 
| 866                                     bool not_at_start) { | 866                                     bool not_at_start) { | 
| 867     // Returning 0 from EatsAtLeast should ensure we never get here. | 867     // Returning 0 from EatsAtLeast should ensure we never get here. | 
| 868     UNREACHABLE(); | 868     UNREACHABLE(); | 
| 869   } | 869   } | 
| 870   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 870   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 871                             BoyerMooreLookahead* bm, bool not_at_start) { | 871                             BoyerMooreLookahead* bm, bool not_at_start) { | 
| 872     // Returning 0 from EatsAtLeast should ensure we never get here. | 872     // Returning 0 from EatsAtLeast should ensure we never get here. | 
| 873     UNREACHABLE(); | 873     UNREACHABLE(); | 
| 874   } | 874   } | 
| 875 | 875 | 
| 876  private: | 876  private: | 
| 877   Action action_; | 877   Action action_; | 
| 878 }; | 878 }; | 
| 879 | 879 | 
| 880 | 880 | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 953   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 953   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 
| 954   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 954   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 
| 955   int EatsAtLeastHelper(int still_to_find, | 955   int EatsAtLeastHelper(int still_to_find, | 
| 956                         int budget, | 956                         int budget, | 
| 957                         RegExpNode* ignore_this_node, | 957                         RegExpNode* ignore_this_node, | 
| 958                         bool not_at_start); | 958                         bool not_at_start); | 
| 959   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 959   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 960                                     RegExpCompiler* compiler, | 960                                     RegExpCompiler* compiler, | 
| 961                                     int characters_filled_in, | 961                                     int characters_filled_in, | 
| 962                                     bool not_at_start); | 962                                     bool not_at_start); | 
| 963   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 963   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 964                             BoyerMooreLookahead* bm, bool not_at_start); | 964                             BoyerMooreLookahead* bm, bool not_at_start); | 
| 965 | 965 | 
| 966   bool being_calculated() { return being_calculated_; } | 966   bool being_calculated() { return being_calculated_; } | 
| 967   bool not_at_start() { return not_at_start_; } | 967   bool not_at_start() { return not_at_start_; } | 
| 968   void set_not_at_start() { not_at_start_ = true; } | 968   void set_not_at_start() { not_at_start_ = true; } | 
| 969   void set_being_calculated(bool b) { being_calculated_ = b; } | 969   void set_being_calculated(bool b) { being_calculated_ = b; } | 
| 970   virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { | 970   virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { | 
| 971     return true; | 971     return true; | 
| 972   } | 972   } | 
| 973   virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); | 973   virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 
| 974   virtual bool read_backward() { return false; } | 974   virtual bool read_backward() { return false; } | 
| 975 | 975 | 
| 976  protected: | 976  protected: | 
| 977   int GreedyLoopTextLengthForAlternative(GuardedAlternative* alternative); | 977   int GreedyLoopTextLengthForAlternative(GuardedAlternative* alternative); | 
| 978   ZoneList<GuardedAlternative>* alternatives_; | 978   ZoneList<GuardedAlternative>* alternatives_; | 
| 979 | 979 | 
| 980  private: | 980  private: | 
| 981   friend class DispatchTableConstructor; | 981   friend class DispatchTableConstructor; | 
| 982   friend class Analysis; | 982   friend class Analysis; | 
| 983   void GenerateGuard(RegExpMacroAssembler* macro_assembler, | 983   void GenerateGuard(RegExpMacroAssembler* macro_assembler, | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1021                                         Zone* zone) | 1021                                         Zone* zone) | 
| 1022       : ChoiceNode(2, zone) { | 1022       : ChoiceNode(2, zone) { | 
| 1023     AddAlternative(this_must_fail); | 1023     AddAlternative(this_must_fail); | 
| 1024     AddAlternative(then_do_this); | 1024     AddAlternative(then_do_this); | 
| 1025   } | 1025   } | 
| 1026   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 1026   virtual int EatsAtLeast(int still_to_find, int budget, bool not_at_start); | 
| 1027   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 1027   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 1028                                     RegExpCompiler* compiler, | 1028                                     RegExpCompiler* compiler, | 
| 1029                                     int characters_filled_in, | 1029                                     int characters_filled_in, | 
| 1030                                     bool not_at_start); | 1030                                     bool not_at_start); | 
| 1031   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 1031   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 1032                             BoyerMooreLookahead* bm, bool not_at_start) { | 1032                             BoyerMooreLookahead* bm, bool not_at_start) { | 
| 1033     alternatives_->at(1).node()->FillInBMInfo(compiler, offset, budget - 1, bm, | 1033     alternatives_->at(1).node()->FillInBMInfo(isolate, offset, budget - 1, bm, | 
| 1034                                               not_at_start); | 1034                                               not_at_start); | 
| 1035     if (offset == 0) set_bm_info(not_at_start, bm); | 1035     if (offset == 0) set_bm_info(not_at_start, bm); | 
| 1036   } | 1036   } | 
| 1037   // For a negative lookahead we don't emit the quick check for the | 1037   // For a negative lookahead we don't emit the quick check for the | 
| 1038   // alternative that is expected to fail.  This is because quick check code | 1038   // alternative that is expected to fail.  This is because quick check code | 
| 1039   // starts by loading enough characters for the alternative that takes fewest | 1039   // starts by loading enough characters for the alternative that takes fewest | 
| 1040   // characters, but on a negative lookahead the negative branch did not take | 1040   // characters, but on a negative lookahead the negative branch did not take | 
| 1041   // part in that calculation (EatsAtLeast) so the assumptions don't hold. | 1041   // part in that calculation (EatsAtLeast) so the assumptions don't hold. | 
| 1042   virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { | 1042   virtual bool try_to_emit_quick_check_for_alternative(bool is_first) { | 
| 1043     return !is_first; | 1043     return !is_first; | 
| 1044   } | 1044   } | 
| 1045   virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); | 1045   virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 
| 1046 }; | 1046 }; | 
| 1047 | 1047 | 
| 1048 | 1048 | 
| 1049 class LoopChoiceNode: public ChoiceNode { | 1049 class LoopChoiceNode: public ChoiceNode { | 
| 1050  public: | 1050  public: | 
| 1051   LoopChoiceNode(bool body_can_be_zero_length, bool read_backward, Zone* zone) | 1051   LoopChoiceNode(bool body_can_be_zero_length, bool read_backward, Zone* zone) | 
| 1052       : ChoiceNode(2, zone), | 1052       : ChoiceNode(2, zone), | 
| 1053         loop_node_(NULL), | 1053         loop_node_(NULL), | 
| 1054         continue_node_(NULL), | 1054         continue_node_(NULL), | 
| 1055         body_can_be_zero_length_(body_can_be_zero_length), | 1055         body_can_be_zero_length_(body_can_be_zero_length), | 
| 1056         read_backward_(read_backward) {} | 1056         read_backward_(read_backward) {} | 
| 1057   void AddLoopAlternative(GuardedAlternative alt); | 1057   void AddLoopAlternative(GuardedAlternative alt); | 
| 1058   void AddContinueAlternative(GuardedAlternative alt); | 1058   void AddContinueAlternative(GuardedAlternative alt); | 
| 1059   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 1059   virtual void Emit(RegExpCompiler* compiler, Trace* trace); | 
| 1060   virtual int EatsAtLeast(int still_to_find,  int budget, bool not_at_start); | 1060   virtual int EatsAtLeast(int still_to_find,  int budget, bool not_at_start); | 
| 1061   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 1061   virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 
| 1062                                     RegExpCompiler* compiler, | 1062                                     RegExpCompiler* compiler, | 
| 1063                                     int characters_filled_in, | 1063                                     int characters_filled_in, | 
| 1064                                     bool not_at_start); | 1064                                     bool not_at_start); | 
| 1065   virtual void FillInBMInfo(RegExpCompiler* compiler, int offset, int budget, | 1065   virtual void FillInBMInfo(Isolate* isolate, int offset, int budget, | 
| 1066                             BoyerMooreLookahead* bm, bool not_at_start); | 1066                             BoyerMooreLookahead* bm, bool not_at_start); | 
| 1067   RegExpNode* loop_node() { return loop_node_; } | 1067   RegExpNode* loop_node() { return loop_node_; } | 
| 1068   RegExpNode* continue_node() { return continue_node_; } | 1068   RegExpNode* continue_node() { return continue_node_; } | 
| 1069   bool body_can_be_zero_length() { return body_can_be_zero_length_; } | 1069   bool body_can_be_zero_length() { return body_can_be_zero_length_; } | 
| 1070   virtual bool read_backward() { return read_backward_; } | 1070   virtual bool read_backward() { return read_backward_; } | 
| 1071   virtual void Accept(NodeVisitor* visitor); | 1071   virtual void Accept(NodeVisitor* visitor); | 
| 1072   virtual RegExpNode* FilterOneByte(int depth, RegExpCompiler* compiler); | 1072   virtual RegExpNode* FilterOneByte(int depth, bool ignore_case); | 
| 1073 | 1073 | 
| 1074  private: | 1074  private: | 
| 1075   // AddAlternative is made private for loop nodes because alternatives | 1075   // AddAlternative is made private for loop nodes because alternatives | 
| 1076   // should not be added freely, we need to keep track of which node | 1076   // should not be added freely, we need to keep track of which node | 
| 1077   // goes back to the node itself. | 1077   // goes back to the node itself. | 
| 1078   void AddAlternative(GuardedAlternative node) { | 1078   void AddAlternative(GuardedAlternative node) { | 
| 1079     ChoiceNode::AddAlternative(node); | 1079     ChoiceNode::AddAlternative(node); | 
| 1080   } | 1080   } | 
| 1081 | 1081 | 
| 1082   RegExpNode* loop_node_; | 1082   RegExpNode* loop_node_; | 
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1581   static const int kStringOffset = 0; | 1581   static const int kStringOffset = 0; | 
| 1582   static const int kPatternOffset = 1; | 1582   static const int kPatternOffset = 1; | 
| 1583   static const int kArrayOffset = 2; | 1583   static const int kArrayOffset = 2; | 
| 1584   static const int kLastMatchOffset = 3; | 1584   static const int kLastMatchOffset = 3; | 
| 1585 }; | 1585 }; | 
| 1586 | 1586 | 
| 1587 }  // namespace internal | 1587 }  // namespace internal | 
| 1588 }  // namespace v8 | 1588 }  // namespace v8 | 
| 1589 | 1589 | 
| 1590 #endif  // V8_REGEXP_JSREGEXP_H_ | 1590 #endif  // V8_REGEXP_JSREGEXP_H_ | 
| OLD | NEW | 
|---|