OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 uint32_t value_; | 581 uint32_t value_; |
582 }; | 582 }; |
583 | 583 |
584 | 584 |
585 class RegExpNode: public ZoneObject { | 585 class RegExpNode: public ZoneObject { |
586 public: | 586 public: |
587 RegExpNode() : trace_count_(0) { } | 587 RegExpNode() : trace_count_(0) { } |
588 virtual ~RegExpNode(); | 588 virtual ~RegExpNode(); |
589 virtual void Accept(NodeVisitor* visitor) = 0; | 589 virtual void Accept(NodeVisitor* visitor) = 0; |
590 // Generates a goto to this node or actually generates the code at this point. | 590 // Generates a goto to this node or actually generates the code at this point. |
591 // Until the implementation is complete we will return true for success and | 591 virtual void Emit(RegExpCompiler* compiler, Trace* trace) = 0; |
592 // false for failure. | |
593 virtual bool Emit(RegExpCompiler* compiler, Trace* trace) = 0; | |
594 // How many characters must this node consume at a minimum in order to | 592 // How many characters must this node consume at a minimum in order to |
595 // succeed. | 593 // succeed. |
596 virtual int EatsAtLeast(int recursion_depth) = 0; | 594 virtual int EatsAtLeast(int recursion_depth) = 0; |
597 // Emits some quick code that checks whether the preloaded characters match. | 595 // Emits some quick code that checks whether the preloaded characters match. |
598 // Falls through on certain failure, jumps to the label on possible success. | 596 // Falls through on certain failure, jumps to the label on possible success. |
599 // If the node cannot make a quick check it does nothing and returns false. | 597 // If the node cannot make a quick check it does nothing and returns false. |
600 bool EmitQuickCheck(RegExpCompiler* compiler, | 598 bool EmitQuickCheck(RegExpCompiler* compiler, |
601 Trace* trace, | 599 Trace* trace, |
602 bool preload_has_checked_bounds, | 600 bool preload_has_checked_bounds, |
603 Label* on_possible_success, | 601 Label* on_possible_success, |
(...skipping 24 matching lines...) Expand all Loading... |
628 // result has the same type as the input. | 626 // result has the same type as the input. |
629 template <class C> | 627 template <class C> |
630 static C* EnsureSibling(C* node, NodeInfo* info, bool* cloned) { | 628 static C* EnsureSibling(C* node, NodeInfo* info, bool* cloned) { |
631 return static_cast<C*>(node->EnsureSibling(info, cloned)); | 629 return static_cast<C*>(node->EnsureSibling(info, cloned)); |
632 } | 630 } |
633 | 631 |
634 SiblingList* siblings() { return &siblings_; } | 632 SiblingList* siblings() { return &siblings_; } |
635 void set_siblings(SiblingList* other) { siblings_ = *other; } | 633 void set_siblings(SiblingList* other) { siblings_ = *other; } |
636 | 634 |
637 protected: | 635 protected: |
638 enum LimitResult { DONE, FAIL, CONTINUE }; | 636 enum LimitResult { DONE, CONTINUE }; |
639 LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace); | 637 LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace); |
640 | 638 |
641 // Returns a sibling of this node whose interests and assumptions | 639 // Returns a sibling of this node whose interests and assumptions |
642 // match the ones in the given node info. If no sibling exists NULL | 640 // match the ones in the given node info. If no sibling exists NULL |
643 // is returned. | 641 // is returned. |
644 RegExpNode* TryGetSibling(NodeInfo* info); | 642 RegExpNode* TryGetSibling(NodeInfo* info); |
645 | 643 |
646 // Returns a sibling of this node whose interests match the ones in | 644 // Returns a sibling of this node whose interests match the ones in |
647 // the given node info. The info must not contain any assertions. | 645 // the given node info. The info must not contain any assertions. |
648 // If no node exists a new one will be created by cloning the current | 646 // If no node exists a new one will be created by cloning the current |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 int position_reg, | 723 int position_reg, |
726 RegExpNode* on_success); | 724 RegExpNode* on_success); |
727 static ActionNode* PositiveSubmatchSuccess(int stack_pointer_reg, | 725 static ActionNode* PositiveSubmatchSuccess(int stack_pointer_reg, |
728 int restore_reg, | 726 int restore_reg, |
729 RegExpNode* on_success); | 727 RegExpNode* on_success); |
730 static ActionNode* EmptyMatchCheck(int start_register, | 728 static ActionNode* EmptyMatchCheck(int start_register, |
731 int repetition_register, | 729 int repetition_register, |
732 int repetition_limit, | 730 int repetition_limit, |
733 RegExpNode* on_success); | 731 RegExpNode* on_success); |
734 virtual void Accept(NodeVisitor* visitor); | 732 virtual void Accept(NodeVisitor* visitor); |
735 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 733 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
736 virtual int EatsAtLeast(int recursion_depth); | 734 virtual int EatsAtLeast(int recursion_depth); |
737 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 735 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
738 RegExpCompiler* compiler, | 736 RegExpCompiler* compiler, |
739 int filled_in) { | 737 int filled_in) { |
740 return on_success()->GetQuickCheckDetails(details, compiler, filled_in); | 738 return on_success()->GetQuickCheckDetails(details, compiler, filled_in); |
741 } | 739 } |
742 Type type() { return type_; } | 740 Type type() { return type_; } |
743 // TODO(erikcorry): We should allow some action nodes in greedy loops. | 741 // TODO(erikcorry): We should allow some action nodes in greedy loops. |
744 virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; } | 742 virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; } |
745 virtual ActionNode* Clone() { return new ActionNode(*this); } | 743 virtual ActionNode* Clone() { return new ActionNode(*this); } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 RegExpNode* on_success) | 782 RegExpNode* on_success) |
785 : SeqRegExpNode(on_success), | 783 : SeqRegExpNode(on_success), |
786 elms_(elms) { } | 784 elms_(elms) { } |
787 TextNode(RegExpCharacterClass* that, | 785 TextNode(RegExpCharacterClass* that, |
788 RegExpNode* on_success) | 786 RegExpNode* on_success) |
789 : SeqRegExpNode(on_success), | 787 : SeqRegExpNode(on_success), |
790 elms_(new ZoneList<TextElement>(1)) { | 788 elms_(new ZoneList<TextElement>(1)) { |
791 elms_->Add(TextElement::CharClass(that)); | 789 elms_->Add(TextElement::CharClass(that)); |
792 } | 790 } |
793 virtual void Accept(NodeVisitor* visitor); | 791 virtual void Accept(NodeVisitor* visitor); |
794 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 792 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
795 virtual int EatsAtLeast(int recursion_depth); | 793 virtual int EatsAtLeast(int recursion_depth); |
796 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 794 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
797 RegExpCompiler* compiler, | 795 RegExpCompiler* compiler, |
798 int characters_filled_in); | 796 int characters_filled_in); |
799 ZoneList<TextElement>* elements() { return elms_; } | 797 ZoneList<TextElement>* elements() { return elms_; } |
800 void MakeCaseIndependent(); | 798 void MakeCaseIndependent(); |
801 virtual int GreedyLoopTextLength(); | 799 virtual int GreedyLoopTextLength(); |
802 virtual TextNode* Clone() { | 800 virtual TextNode* Clone() { |
803 TextNode* result = new TextNode(*this); | 801 TextNode* result = new TextNode(*this); |
804 result->CalculateOffsets(); | 802 result->CalculateOffsets(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 static AssertionNode* AtBoundary(RegExpNode* on_success) { | 840 static AssertionNode* AtBoundary(RegExpNode* on_success) { |
843 return new AssertionNode(AT_BOUNDARY, on_success); | 841 return new AssertionNode(AT_BOUNDARY, on_success); |
844 } | 842 } |
845 static AssertionNode* AtNonBoundary(RegExpNode* on_success) { | 843 static AssertionNode* AtNonBoundary(RegExpNode* on_success) { |
846 return new AssertionNode(AT_NON_BOUNDARY, on_success); | 844 return new AssertionNode(AT_NON_BOUNDARY, on_success); |
847 } | 845 } |
848 static AssertionNode* AfterNewline(RegExpNode* on_success) { | 846 static AssertionNode* AfterNewline(RegExpNode* on_success) { |
849 return new AssertionNode(AFTER_NEWLINE, on_success); | 847 return new AssertionNode(AFTER_NEWLINE, on_success); |
850 } | 848 } |
851 virtual void Accept(NodeVisitor* visitor); | 849 virtual void Accept(NodeVisitor* visitor); |
852 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 850 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
853 virtual int EatsAtLeast(int recursion_depth); | 851 virtual int EatsAtLeast(int recursion_depth); |
854 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 852 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
855 RegExpCompiler* compiler, | 853 RegExpCompiler* compiler, |
856 int filled_in) { | 854 int filled_in) { |
857 return on_success()->GetQuickCheckDetails(details, compiler, filled_in); | 855 return on_success()->GetQuickCheckDetails(details, compiler, filled_in); |
858 } | 856 } |
859 virtual AssertionNode* Clone() { return new AssertionNode(*this); } | 857 virtual AssertionNode* Clone() { return new AssertionNode(*this); } |
860 AssertionNodeType type() { return type_; } | 858 AssertionNodeType type() { return type_; } |
861 private: | 859 private: |
862 AssertionNode(AssertionNodeType t, RegExpNode* on_success) | 860 AssertionNode(AssertionNodeType t, RegExpNode* on_success) |
863 : SeqRegExpNode(on_success), type_(t) { } | 861 : SeqRegExpNode(on_success), type_(t) { } |
864 AssertionNodeType type_; | 862 AssertionNodeType type_; |
865 }; | 863 }; |
866 | 864 |
867 | 865 |
868 class BackReferenceNode: public SeqRegExpNode { | 866 class BackReferenceNode: public SeqRegExpNode { |
869 public: | 867 public: |
870 BackReferenceNode(int start_reg, | 868 BackReferenceNode(int start_reg, |
871 int end_reg, | 869 int end_reg, |
872 RegExpNode* on_success) | 870 RegExpNode* on_success) |
873 : SeqRegExpNode(on_success), | 871 : SeqRegExpNode(on_success), |
874 start_reg_(start_reg), | 872 start_reg_(start_reg), |
875 end_reg_(end_reg) { } | 873 end_reg_(end_reg) { } |
876 virtual void Accept(NodeVisitor* visitor); | 874 virtual void Accept(NodeVisitor* visitor); |
877 int start_register() { return start_reg_; } | 875 int start_register() { return start_reg_; } |
878 int end_register() { return end_reg_; } | 876 int end_register() { return end_reg_; } |
879 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 877 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
880 virtual int EatsAtLeast(int recursion_depth); | 878 virtual int EatsAtLeast(int recursion_depth); |
881 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 879 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
882 RegExpCompiler* compiler, | 880 RegExpCompiler* compiler, |
883 int characters_filled_in) { | 881 int characters_filled_in) { |
884 return; | 882 return; |
885 } | 883 } |
886 virtual BackReferenceNode* Clone() { return new BackReferenceNode(*this); } | 884 virtual BackReferenceNode* Clone() { return new BackReferenceNode(*this); } |
887 | 885 |
888 private: | 886 private: |
889 int start_reg_; | 887 int start_reg_; |
890 int end_reg_; | 888 int end_reg_; |
891 }; | 889 }; |
892 | 890 |
893 | 891 |
894 class EndNode: public RegExpNode { | 892 class EndNode: public RegExpNode { |
895 public: | 893 public: |
896 enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; | 894 enum Action { ACCEPT, BACKTRACK, NEGATIVE_SUBMATCH_SUCCESS }; |
897 explicit EndNode(Action action) : action_(action) { } | 895 explicit EndNode(Action action) : action_(action) { } |
898 virtual void Accept(NodeVisitor* visitor); | 896 virtual void Accept(NodeVisitor* visitor); |
899 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 897 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
900 virtual int EatsAtLeast(int recursion_depth) { return 0; } | 898 virtual int EatsAtLeast(int recursion_depth) { return 0; } |
901 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 899 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
902 RegExpCompiler* compiler, | 900 RegExpCompiler* compiler, |
903 int characters_filled_in) { | 901 int characters_filled_in) { |
904 // Returning 0 from EatsAtLeast should ensure we never get here. | 902 // Returning 0 from EatsAtLeast should ensure we never get here. |
905 UNREACHABLE(); | 903 UNREACHABLE(); |
906 } | 904 } |
907 virtual EndNode* Clone() { return new EndNode(*this); } | 905 virtual EndNode* Clone() { return new EndNode(*this); } |
908 | 906 |
909 private: | 907 private: |
910 Action action_; | 908 Action action_; |
911 }; | 909 }; |
912 | 910 |
913 | 911 |
914 class NegativeSubmatchSuccess: public EndNode { | 912 class NegativeSubmatchSuccess: public EndNode { |
915 public: | 913 public: |
916 NegativeSubmatchSuccess(int stack_pointer_reg, int position_reg) | 914 NegativeSubmatchSuccess(int stack_pointer_reg, int position_reg) |
917 : EndNode(NEGATIVE_SUBMATCH_SUCCESS), | 915 : EndNode(NEGATIVE_SUBMATCH_SUCCESS), |
918 stack_pointer_register_(stack_pointer_reg), | 916 stack_pointer_register_(stack_pointer_reg), |
919 current_position_register_(position_reg) { } | 917 current_position_register_(position_reg) { } |
920 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 918 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
921 | 919 |
922 private: | 920 private: |
923 int stack_pointer_register_; | 921 int stack_pointer_register_; |
924 int current_position_register_; | 922 int current_position_register_; |
925 }; | 923 }; |
926 | 924 |
927 | 925 |
928 class Guard: public ZoneObject { | 926 class Guard: public ZoneObject { |
929 public: | 927 public: |
930 enum Relation { LT, GEQ }; | 928 enum Relation { LT, GEQ }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 class ChoiceNode: public RegExpNode { | 961 class ChoiceNode: public RegExpNode { |
964 public: | 962 public: |
965 explicit ChoiceNode(int expected_size) | 963 explicit ChoiceNode(int expected_size) |
966 : alternatives_(new ZoneList<GuardedAlternative>(expected_size)), | 964 : alternatives_(new ZoneList<GuardedAlternative>(expected_size)), |
967 table_(NULL), | 965 table_(NULL), |
968 being_calculated_(false) { } | 966 being_calculated_(false) { } |
969 virtual void Accept(NodeVisitor* visitor); | 967 virtual void Accept(NodeVisitor* visitor); |
970 void AddAlternative(GuardedAlternative node) { alternatives()->Add(node); } | 968 void AddAlternative(GuardedAlternative node) { alternatives()->Add(node); } |
971 ZoneList<GuardedAlternative>* alternatives() { return alternatives_; } | 969 ZoneList<GuardedAlternative>* alternatives() { return alternatives_; } |
972 DispatchTable* GetTable(bool ignore_case); | 970 DispatchTable* GetTable(bool ignore_case); |
973 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 971 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
974 virtual int EatsAtLeast(int recursion_depth); | 972 virtual int EatsAtLeast(int recursion_depth); |
975 int EatsAtLeastHelper(int recursion_depth, RegExpNode* ignore_this_node); | 973 int EatsAtLeastHelper(int recursion_depth, RegExpNode* ignore_this_node); |
976 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 974 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
977 RegExpCompiler* compiler, | 975 RegExpCompiler* compiler, |
978 int characters_filled_in); | 976 int characters_filled_in); |
979 virtual ChoiceNode* Clone() { return new ChoiceNode(*this); } | 977 virtual ChoiceNode* Clone() { return new ChoiceNode(*this); } |
980 | 978 |
981 bool being_calculated() { return being_calculated_; } | 979 bool being_calculated() { return being_calculated_; } |
982 void set_being_calculated(bool b) { being_calculated_ = b; } | 980 void set_being_calculated(bool b) { being_calculated_ = b; } |
983 virtual bool try_to_emit_quick_check_for_alternative(int i) { return true; } | 981 virtual bool try_to_emit_quick_check_for_alternative(int i) { return true; } |
984 | 982 |
985 protected: | 983 protected: |
986 int GreedyLoopTextLength(GuardedAlternative *alternative); | 984 int GreedyLoopTextLength(GuardedAlternative *alternative); |
987 ZoneList<GuardedAlternative>* alternatives_; | 985 ZoneList<GuardedAlternative>* alternatives_; |
988 | 986 |
989 private: | 987 private: |
990 friend class DispatchTableConstructor; | 988 friend class DispatchTableConstructor; |
991 friend class Analysis; | 989 friend class Analysis; |
992 void GenerateGuard(RegExpMacroAssembler* macro_assembler, | 990 void GenerateGuard(RegExpMacroAssembler* macro_assembler, |
993 Guard *guard, | 991 Guard *guard, |
994 Trace* trace); | 992 Trace* trace); |
995 int CalculatePreloadCharacters(RegExpCompiler* compiler); | 993 int CalculatePreloadCharacters(RegExpCompiler* compiler); |
996 bool EmitOutOfLineContinuation(RegExpCompiler* compiler, | 994 void EmitOutOfLineContinuation(RegExpCompiler* compiler, |
997 Trace* trace, | 995 Trace* trace, |
998 GuardedAlternative alternative, | 996 GuardedAlternative alternative, |
999 AlternativeGeneration* alt_gen, | 997 AlternativeGeneration* alt_gen, |
1000 int preload_characters, | 998 int preload_characters, |
1001 bool next_expects_preload); | 999 bool next_expects_preload); |
1002 DispatchTable* table_; | 1000 DispatchTable* table_; |
1003 bool being_calculated_; | 1001 bool being_calculated_; |
1004 }; | 1002 }; |
1005 | 1003 |
1006 | 1004 |
(...skipping 20 matching lines...) Expand all Loading... |
1027 | 1025 |
1028 class LoopChoiceNode: public ChoiceNode { | 1026 class LoopChoiceNode: public ChoiceNode { |
1029 public: | 1027 public: |
1030 explicit LoopChoiceNode(bool body_can_be_zero_length) | 1028 explicit LoopChoiceNode(bool body_can_be_zero_length) |
1031 : ChoiceNode(2), | 1029 : ChoiceNode(2), |
1032 loop_node_(NULL), | 1030 loop_node_(NULL), |
1033 continue_node_(NULL), | 1031 continue_node_(NULL), |
1034 body_can_be_zero_length_(body_can_be_zero_length) { } | 1032 body_can_be_zero_length_(body_can_be_zero_length) { } |
1035 void AddLoopAlternative(GuardedAlternative alt); | 1033 void AddLoopAlternative(GuardedAlternative alt); |
1036 void AddContinueAlternative(GuardedAlternative alt); | 1034 void AddContinueAlternative(GuardedAlternative alt); |
1037 virtual bool Emit(RegExpCompiler* compiler, Trace* trace); | 1035 virtual void Emit(RegExpCompiler* compiler, Trace* trace); |
1038 virtual int EatsAtLeast(int recursion_depth); // Returns 0. | 1036 virtual int EatsAtLeast(int recursion_depth); // Returns 0. |
1039 virtual void GetQuickCheckDetails(QuickCheckDetails* details, | 1037 virtual void GetQuickCheckDetails(QuickCheckDetails* details, |
1040 RegExpCompiler* compiler, | 1038 RegExpCompiler* compiler, |
1041 int characters_filled_in); | 1039 int characters_filled_in); |
1042 virtual LoopChoiceNode* Clone() { return new LoopChoiceNode(*this); } | 1040 virtual LoopChoiceNode* Clone() { return new LoopChoiceNode(*this); } |
1043 RegExpNode* loop_node() { return loop_node_; } | 1041 RegExpNode* loop_node() { return loop_node_; } |
1044 RegExpNode* continue_node() { return continue_node_; } | 1042 RegExpNode* continue_node() { return continue_node_; } |
1045 bool body_can_be_zero_length() { return body_can_be_zero_length_; } | 1043 bool body_can_be_zero_length() { return body_can_be_zero_length_; } |
1046 virtual void Accept(NodeVisitor* visitor); | 1044 virtual void Accept(NodeVisitor* visitor); |
1047 | 1045 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 actions_(NULL), | 1127 actions_(NULL), |
1130 backtrack_(NULL), | 1128 backtrack_(NULL), |
1131 stop_node_(NULL), | 1129 stop_node_(NULL), |
1132 loop_label_(NULL), | 1130 loop_label_(NULL), |
1133 characters_preloaded_(0), | 1131 characters_preloaded_(0), |
1134 bound_checked_up_to_(0) { } | 1132 bound_checked_up_to_(0) { } |
1135 // End the trace. This involves flushing the deferred actions in the trace | 1133 // End the trace. This involves flushing the deferred actions in the trace |
1136 // and pushing a backtrack location onto the backtrack stack. Once this is | 1134 // and pushing a backtrack location onto the backtrack stack. Once this is |
1137 // done we can start a new trace or go to one that has already been | 1135 // done we can start a new trace or go to one that has already been |
1138 // generated. | 1136 // generated. |
1139 bool Flush(RegExpCompiler* compiler, RegExpNode* successor); | 1137 void Flush(RegExpCompiler* compiler, RegExpNode* successor); |
1140 int cp_offset() { return cp_offset_; } | 1138 int cp_offset() { return cp_offset_; } |
1141 DeferredAction* actions() { return actions_; } | 1139 DeferredAction* actions() { return actions_; } |
1142 // A trivial trace is one that has no deferred actions or other state that | 1140 // A trivial trace is one that has no deferred actions or other state that |
1143 // affects the assumptions used when generating code. There is no recorded | 1141 // affects the assumptions used when generating code. There is no recorded |
1144 // backtrack location in a trivial trace, so with a trivial trace we will | 1142 // backtrack location in a trivial trace, so with a trivial trace we will |
1145 // generate code that, on a failure to match, gets the backtrack location | 1143 // generate code that, on a failure to match, gets the backtrack location |
1146 // from the backtrack stack rather than using a direct jump instruction. We | 1144 // from the backtrack stack rather than using a direct jump instruction. We |
1147 // always start code generation with a trivial trace and non-trivial traces | 1145 // always start code generation with a trivial trace and non-trivial traces |
1148 // are created as we emit code for nodes or add to the list of deferred | 1146 // are created as we emit code for nodes or add to the list of deferred |
1149 // actions in the trace. The location of the code generated for a node using | 1147 // actions in the trace. The location of the code generated for a node using |
(...skipping 27 matching lines...) Expand all Loading... |
1177 } | 1175 } |
1178 void set_backtrack(Label* backtrack) { backtrack_ = backtrack; } | 1176 void set_backtrack(Label* backtrack) { backtrack_ = backtrack; } |
1179 void set_stop_node(RegExpNode* node) { stop_node_ = node; } | 1177 void set_stop_node(RegExpNode* node) { stop_node_ = node; } |
1180 void set_loop_label(Label* label) { loop_label_ = label; } | 1178 void set_loop_label(Label* label) { loop_label_ = label; } |
1181 void set_characters_preloaded(int cpre) { characters_preloaded_ = cpre; } | 1179 void set_characters_preloaded(int cpre) { characters_preloaded_ = cpre; } |
1182 void set_bound_checked_up_to(int to) { bound_checked_up_to_ = to; } | 1180 void set_bound_checked_up_to(int to) { bound_checked_up_to_ = to; } |
1183 void set_quick_check_performed(QuickCheckDetails* d) { | 1181 void set_quick_check_performed(QuickCheckDetails* d) { |
1184 quick_check_performed_ = *d; | 1182 quick_check_performed_ = *d; |
1185 } | 1183 } |
1186 void InvalidateCurrentCharacter(); | 1184 void InvalidateCurrentCharacter(); |
1187 void AdvanceCurrentPositionInTrace(int by, bool ascii); | 1185 void AdvanceCurrentPositionInTrace(int by, RegExpCompiler* compiler); |
1188 private: | 1186 private: |
1189 int FindAffectedRegisters(OutSet* affected_registers); | 1187 int FindAffectedRegisters(OutSet* affected_registers); |
1190 void PerformDeferredActions(RegExpMacroAssembler* macro, | 1188 void PerformDeferredActions(RegExpMacroAssembler* macro, |
1191 int max_register, | 1189 int max_register, |
1192 OutSet& affected_registers); | 1190 OutSet& affected_registers); |
1193 void RestoreAffectedRegisters(RegExpMacroAssembler* macro, | 1191 void RestoreAffectedRegisters(RegExpMacroAssembler* macro, |
1194 int max_register, | 1192 int max_register, |
1195 OutSet& affected_registers); | 1193 OutSet& affected_registers); |
1196 void PushAffectedRegisters(RegExpMacroAssembler* macro, | 1194 void PushAffectedRegisters(RegExpMacroAssembler* macro, |
1197 int max_register, | 1195 int max_register, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 Handle<String> pattern, | 1301 Handle<String> pattern, |
1304 bool is_ascii); | 1302 bool is_ascii); |
1305 | 1303 |
1306 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1304 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1307 }; | 1305 }; |
1308 | 1306 |
1309 | 1307 |
1310 } } // namespace v8::internal | 1308 } } // namespace v8::internal |
1311 | 1309 |
1312 #endif // V8_JSREGEXP_H_ | 1310 #endif // V8_JSREGEXP_H_ |
OLD | NEW |