Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: src/jsregexp.h

Issue 14508: Interest propagation bugfix. (Closed)
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 void GenerateGuard(RegExpMacroAssembler* macro_assembler, 905 void GenerateGuard(RegExpMacroAssembler* macro_assembler,
906 Guard *guard, 906 Guard *guard,
907 GenerationVariant* variant); 907 GenerationVariant* variant);
908 DispatchTable* table_; 908 DispatchTable* table_;
909 bool being_calculated_; 909 bool being_calculated_;
910 }; 910 };
911 911
912 912
913 class LoopChoiceNode: public ChoiceNode { 913 class LoopChoiceNode: public ChoiceNode {
914 public: 914 public:
915 explicit LoopChoiceNode(int expected_size) : ChoiceNode(expected_size) { } 915 explicit LoopChoiceNode()
916 : ChoiceNode(2),
917 loop_node_(NULL),
918 continue_node_(NULL) { }
919 void AddLoopAlternative(GuardedAlternative alt);
920 void AddContinueAlternative(GuardedAlternative alt);
916 virtual bool Emit(RegExpCompiler* compiler, GenerationVariant* variant); 921 virtual bool Emit(RegExpCompiler* compiler, GenerationVariant* variant);
917 virtual LoopChoiceNode* Clone() { return new LoopChoiceNode(*this); } 922 virtual LoopChoiceNode* Clone() { return new LoopChoiceNode(*this); }
923 RegExpNode* loop_node() { return loop_node_; }
924 RegExpNode* continue_node() { return continue_node_; }
925 virtual void Accept(NodeVisitor* visitor);
926
927 private:
928 // AddAlternative is made private for loop nodes because alternatives
929 // should not be added freely, we need to keep track of which node
930 // goes back to the node itself.
931 void AddAlternative(GuardedAlternative node) { ChoiceNode::AddAlternative(node ); }
932
933 RegExpNode* loop_node_;
934 RegExpNode* continue_node_;
918 }; 935 };
919 936
920 937
921 // There are many ways to generate code for a node. This class encapsulates 938 // There are many ways to generate code for a node. This class encapsulates
922 // the current way we should be generating. In other words it encapsulates 939 // the current way we should be generating. In other words it encapsulates
923 // the current state of the code generator. 940 // the current state of the code generator.
924 class GenerationVariant { 941 class GenerationVariant {
925 public: 942 public:
926 class DeferredAction { 943 class DeferredAction {
927 public: 944 public:
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 RegExpNode* stop_node_; 1034 RegExpNode* stop_node_;
1018 Label* loop_label_; 1035 Label* loop_label_;
1019 }; 1036 };
1020 class NodeVisitor { 1037 class NodeVisitor {
1021 public: 1038 public:
1022 virtual ~NodeVisitor() { } 1039 virtual ~NodeVisitor() { }
1023 #define DECLARE_VISIT(Type) \ 1040 #define DECLARE_VISIT(Type) \
1024 virtual void Visit##Type(Type##Node* that) = 0; 1041 virtual void Visit##Type(Type##Node* that) = 0;
1025 FOR_EACH_NODE_TYPE(DECLARE_VISIT) 1042 FOR_EACH_NODE_TYPE(DECLARE_VISIT)
1026 #undef DECLARE_VISIT 1043 #undef DECLARE_VISIT
1044 virtual void VisitLoopChoice(LoopChoiceNode* that) { VisitChoice(that); }
1027 }; 1045 };
1028 1046
1029 1047
1030 // Node visitor used to add the start set of the alternatives to the 1048 // Node visitor used to add the start set of the alternatives to the
1031 // dispatch table of a choice node. 1049 // dispatch table of a choice node.
1032 class DispatchTableConstructor: public NodeVisitor { 1050 class DispatchTableConstructor: public NodeVisitor {
1033 public: 1051 public:
1034 DispatchTableConstructor(DispatchTable* table, bool ignore_case) 1052 DispatchTableConstructor(DispatchTable* table, bool ignore_case)
1035 : table_(table), 1053 : table_(table),
1036 choice_index_(-1), 1054 choice_index_(-1),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 class AssertionPropagation: public NodeVisitor { 1116 class AssertionPropagation: public NodeVisitor {
1099 public: 1117 public:
1100 explicit AssertionPropagation(bool ignore_case) 1118 explicit AssertionPropagation(bool ignore_case)
1101 : ignore_case_(ignore_case) { } 1119 : ignore_case_(ignore_case) { }
1102 void EnsureAnalyzed(RegExpNode* node); 1120 void EnsureAnalyzed(RegExpNode* node);
1103 1121
1104 #define DECLARE_VISIT(Type) \ 1122 #define DECLARE_VISIT(Type) \
1105 virtual void Visit##Type(Type##Node* that); 1123 virtual void Visit##Type(Type##Node* that);
1106 FOR_EACH_NODE_TYPE(DECLARE_VISIT) 1124 FOR_EACH_NODE_TYPE(DECLARE_VISIT)
1107 #undef DECLARE_VISIT 1125 #undef DECLARE_VISIT
1126 virtual void VisitLoopChoice(LoopChoiceNode* that);
1108 1127
1109 private: 1128 private:
1110 bool ignore_case_; 1129 bool ignore_case_;
1111 1130
1112 DISALLOW_IMPLICIT_CONSTRUCTORS(AssertionPropagation); 1131 DISALLOW_IMPLICIT_CONSTRUCTORS(AssertionPropagation);
1113 }; 1132 };
1114 1133
1115 1134
1116 struct RegExpCompileData { 1135 struct RegExpCompileData {
1117 RegExpCompileData() 1136 RegExpCompileData()
(...skipping 19 matching lines...) Expand all
1137 Handle<String> pattern, 1156 Handle<String> pattern,
1138 bool is_ascii); 1157 bool is_ascii);
1139 1158
1140 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); 1159 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case);
1141 }; 1160 };
1142 1161
1143 1162
1144 } } // namespace v8::internal 1163 } } // namespace v8::internal
1145 1164
1146 #endif // V8_JSREGEXP_H_ 1165 #endif // V8_JSREGEXP_H_
OLDNEW
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698