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

Side by Side Diff: src/jsregexp.h

Issue 389001: Merge r3236 and r3243 from bleeding_edge to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | no next file with comments »
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return CharacterRange(0, 0xFFFF); 193 return CharacterRange(0, 0xFFFF);
194 } 194 }
195 bool Contains(uc16 i) { return from_ <= i && i <= to_; } 195 bool Contains(uc16 i) { return from_ <= i && i <= to_; }
196 uc16 from() const { return from_; } 196 uc16 from() const { return from_; }
197 void set_from(uc16 value) { from_ = value; } 197 void set_from(uc16 value) { from_ = value; }
198 uc16 to() const { return to_; } 198 uc16 to() const { return to_; }
199 void set_to(uc16 value) { to_ = value; } 199 void set_to(uc16 value) { to_ = value; }
200 bool is_valid() { return from_ <= to_; } 200 bool is_valid() { return from_ <= to_; }
201 bool IsEverything(uc16 max) { return from_ == 0 && to_ >= max; } 201 bool IsEverything(uc16 max) { return from_ == 0 && to_ >= max; }
202 bool IsSingleton() { return (from_ == to_); } 202 bool IsSingleton() { return (from_ == to_); }
203 void AddCaseEquivalents(ZoneList<CharacterRange>* ranges); 203 void AddCaseEquivalents(ZoneList<CharacterRange>* ranges, bool is_ascii);
204 static void Split(ZoneList<CharacterRange>* base, 204 static void Split(ZoneList<CharacterRange>* base,
205 Vector<const uc16> overlay, 205 Vector<const uc16> overlay,
206 ZoneList<CharacterRange>** included, 206 ZoneList<CharacterRange>** included,
207 ZoneList<CharacterRange>** excluded); 207 ZoneList<CharacterRange>** excluded);
208 208
209 static const int kRangeCanonicalizeMax = 0x346; 209 static const int kRangeCanonicalizeMax = 0x346;
210 static const int kStartMarker = (1 << 24); 210 static const int kStartMarker = (1 << 24);
211 static const int kPayloadMask = (1 << 24) - 1; 211 static const int kPayloadMask = (1 << 24) - 1;
212 212
213 private: 213 private:
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 elms_->Add(TextElement::CharClass(that)); 696 elms_->Add(TextElement::CharClass(that));
697 } 697 }
698 virtual void Accept(NodeVisitor* visitor); 698 virtual void Accept(NodeVisitor* visitor);
699 virtual void Emit(RegExpCompiler* compiler, Trace* trace); 699 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
700 virtual int EatsAtLeast(int still_to_find, int recursion_depth); 700 virtual int EatsAtLeast(int still_to_find, int recursion_depth);
701 virtual void GetQuickCheckDetails(QuickCheckDetails* details, 701 virtual void GetQuickCheckDetails(QuickCheckDetails* details,
702 RegExpCompiler* compiler, 702 RegExpCompiler* compiler,
703 int characters_filled_in, 703 int characters_filled_in,
704 bool not_at_start); 704 bool not_at_start);
705 ZoneList<TextElement>* elements() { return elms_; } 705 ZoneList<TextElement>* elements() { return elms_; }
706 void MakeCaseIndependent(); 706 void MakeCaseIndependent(bool is_ascii);
707 virtual int GreedyLoopTextLength(); 707 virtual int GreedyLoopTextLength();
708 virtual TextNode* Clone() { 708 virtual TextNode* Clone() {
709 TextNode* result = new TextNode(*this); 709 TextNode* result = new TextNode(*this);
710 result->CalculateOffsets(); 710 result->CalculateOffsets();
711 return result; 711 return result;
712 } 712 }
713 void CalculateOffsets(); 713 void CalculateOffsets();
714 714
715 private: 715 private:
716 enum TextEmitPassType { 716 enum TextEmitPassType {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 // has to check if it succeeds a word or non-word. In this case the 1205 // has to check if it succeeds a word or non-word. In this case the
1206 // result will be something like: 1206 // result will be something like:
1207 // 1207 //
1208 // +-------+ +------------+ 1208 // +-------+ +------------+
1209 // | . | | . | 1209 // | . | | . |
1210 // +-------+ ---> +------------+ 1210 // +-------+ ---> +------------+
1211 // | word? | | check word | 1211 // | word? | | check word |
1212 // +-------+ +------------+ 1212 // +-------+ +------------+
1213 class Analysis: public NodeVisitor { 1213 class Analysis: public NodeVisitor {
1214 public: 1214 public:
1215 explicit Analysis(bool ignore_case) 1215 Analysis(bool ignore_case, bool is_ascii)
1216 : ignore_case_(ignore_case), error_message_(NULL) { } 1216 : ignore_case_(ignore_case),
1217 is_ascii_(is_ascii),
1218 error_message_(NULL) { }
1217 void EnsureAnalyzed(RegExpNode* node); 1219 void EnsureAnalyzed(RegExpNode* node);
1218 1220
1219 #define DECLARE_VISIT(Type) \ 1221 #define DECLARE_VISIT(Type) \
1220 virtual void Visit##Type(Type##Node* that); 1222 virtual void Visit##Type(Type##Node* that);
1221 FOR_EACH_NODE_TYPE(DECLARE_VISIT) 1223 FOR_EACH_NODE_TYPE(DECLARE_VISIT)
1222 #undef DECLARE_VISIT 1224 #undef DECLARE_VISIT
1223 virtual void VisitLoopChoice(LoopChoiceNode* that); 1225 virtual void VisitLoopChoice(LoopChoiceNode* that);
1224 1226
1225 bool has_failed() { return error_message_ != NULL; } 1227 bool has_failed() { return error_message_ != NULL; }
1226 const char* error_message() { 1228 const char* error_message() {
1227 ASSERT(error_message_ != NULL); 1229 ASSERT(error_message_ != NULL);
1228 return error_message_; 1230 return error_message_;
1229 } 1231 }
1230 void fail(const char* error_message) { 1232 void fail(const char* error_message) {
1231 error_message_ = error_message; 1233 error_message_ = error_message;
1232 } 1234 }
1233 private: 1235 private:
1234 bool ignore_case_; 1236 bool ignore_case_;
1237 bool is_ascii_;
1235 const char* error_message_; 1238 const char* error_message_;
1236 1239
1237 DISALLOW_IMPLICIT_CONSTRUCTORS(Analysis); 1240 DISALLOW_IMPLICIT_CONSTRUCTORS(Analysis);
1238 }; 1241 };
1239 1242
1240 1243
1241 struct RegExpCompileData { 1244 struct RegExpCompileData {
1242 RegExpCompileData() 1245 RegExpCompileData()
1243 : tree(NULL), 1246 : tree(NULL),
1244 node(NULL), 1247 node(NULL),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 Handle<String> pattern, 1279 Handle<String> pattern,
1277 bool is_ascii); 1280 bool is_ascii);
1278 1281
1279 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); 1282 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case);
1280 }; 1283 };
1281 1284
1282 1285
1283 } } // namespace v8::internal 1286 } } // namespace v8::internal
1284 1287
1285 #endif // V8_JSREGEXP_H_ 1288 #endif // V8_JSREGEXP_H_
OLDNEW
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698