| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 584 |
| 585 extern int kUninitializedRegExpNodePlaceHolder; | 585 extern int kUninitializedRegExpNodePlaceHolder; |
| 586 | 586 |
| 587 | 587 |
| 588 class RegExpNode: public ZoneObject { | 588 class RegExpNode: public ZoneObject { |
| 589 public: | 589 public: |
| 590 explicit RegExpNode(Zone* zone) | 590 explicit RegExpNode(Zone* zone) |
| 591 : replacement_(NULL), trace_count_(0), zone_(zone) { | 591 : replacement_(NULL), trace_count_(0), zone_(zone) { |
| 592 bm_info_[0] = bm_info_[1] = NULL; | 592 bm_info_[0] = bm_info_[1] = NULL; |
| 593 } | 593 } |
| 594 virtual ~RegExpNode(); | |
| 595 virtual void Accept(NodeVisitor* visitor) = 0; | 594 virtual void Accept(NodeVisitor* visitor) = 0; |
| 596 // Generates a goto to this node or actually generates the code at this point. | 595 // Generates a goto to this node or actually generates the code at this point. |
| 597 virtual void Emit(RegExpCompiler* compiler, Trace* trace) = 0; | 596 virtual void Emit(RegExpCompiler* compiler, Trace* trace) = 0; |
| 598 // How many characters must this node consume at a minimum in order to | 597 // How many characters must this node consume at a minimum in order to |
| 599 // succeed. If we have found at least 'still_to_find' characters that | 598 // succeed. If we have found at least 'still_to_find' characters that |
| 600 // must be consumed there is no need to ask any following nodes whether | 599 // must be consumed there is no need to ask any following nodes whether |
| 601 // they are sure to eat any more characters. The not_at_start argument is | 600 // they are sure to eat any more characters. The not_at_start argument is |
| 602 // used to indicate that we know we are not at the start of the input. In | 601 // used to indicate that we know we are not at the start of the input. In |
| 603 // this case anchored branches will always fail and can be ignored when | 602 // this case anchored branches will always fail and can be ignored when |
| 604 // determining how many characters are consumed on success. | 603 // determining how many characters are consumed on success. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 BoyerMooreLookahead* bm_info(bool not_at_start) { | 677 BoyerMooreLookahead* bm_info(bool not_at_start) { |
| 679 return bm_info_[not_at_start ? 1 : 0]; | 678 return bm_info_[not_at_start ? 1 : 0]; |
| 680 } | 679 } |
| 681 | 680 |
| 682 Zone* zone() const { return zone_; } | 681 Zone* zone() const { return zone_; } |
| 683 | 682 |
| 684 protected: | 683 protected: |
| 685 enum LimitResult { DONE, CONTINUE }; | 684 enum LimitResult { DONE, CONTINUE }; |
| 686 RegExpNode* replacement_; | 685 RegExpNode* replacement_; |
| 687 | 686 |
| 687 virtual ~RegExpNode(); |
| 688 LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace); | 688 LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace); |
| 689 | 689 |
| 690 void set_bm_info(bool not_at_start, BoyerMooreLookahead* bm) { | 690 void set_bm_info(bool not_at_start, BoyerMooreLookahead* bm) { |
| 691 bm_info_[not_at_start ? 1 : 0] = bm; | 691 bm_info_[not_at_start ? 1 : 0] = bm; |
| 692 } | 692 } |
| 693 | 693 |
| 694 private: | 694 private: |
| 695 static const int kFirstCharBudget = 10; | 695 static const int kFirstCharBudget = 10; |
| 696 Label label_; | 696 Label label_; |
| 697 NodeInfo info_; | 697 NodeInfo info_; |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 Handle<String> sample_subject, | 1636 Handle<String> sample_subject, |
| 1637 bool is_ascii, Zone* zone); | 1637 bool is_ascii, Zone* zone); |
| 1638 | 1638 |
| 1639 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1639 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
| 1640 }; | 1640 }; |
| 1641 | 1641 |
| 1642 | 1642 |
| 1643 } } // namespace v8::internal | 1643 } } // namespace v8::internal |
| 1644 | 1644 |
| 1645 #endif // V8_JSREGEXP_H_ | 1645 #endif // V8_JSREGEXP_H_ |
| OLD | NEW |