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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 RegExpNode* on_success_; | 569 RegExpNode* on_success_; |
570 }; | 570 }; |
571 | 571 |
572 | 572 |
573 class ActionNode: public SeqRegExpNode { | 573 class ActionNode: public SeqRegExpNode { |
574 public: | 574 public: |
575 enum Type { | 575 enum Type { |
576 STORE_REGISTER, | 576 STORE_REGISTER, |
577 INCREMENT_REGISTER, | 577 INCREMENT_REGISTER, |
578 STORE_POSITION, | 578 STORE_POSITION, |
579 SAVE_POSITION, | |
580 RESTORE_POSITION, | 579 RESTORE_POSITION, |
581 BEGIN_SUBMATCH, | 580 BEGIN_SUBMATCH, |
582 ESCAPE_SUBMATCH | 581 ESCAPE_SUBMATCH |
583 }; | 582 }; |
584 static ActionNode* StoreRegister(int reg, int val, RegExpNode* on_success); | 583 static ActionNode* StoreRegister(int reg, int val, RegExpNode* on_success); |
585 static ActionNode* IncrementRegister(int reg, RegExpNode* on_success); | 584 static ActionNode* IncrementRegister(int reg, RegExpNode* on_success); |
586 static ActionNode* StorePosition(int reg, RegExpNode* on_success); | 585 static ActionNode* StorePosition(int reg, RegExpNode* on_success); |
587 static ActionNode* SavePosition(int reg, RegExpNode* on_success); | |
588 static ActionNode* RestorePosition(int reg, RegExpNode* on_success); | 586 static ActionNode* RestorePosition(int reg, RegExpNode* on_success); |
589 static ActionNode* BeginSubmatch(int reg, RegExpNode* on_success); | 587 static ActionNode* BeginSubmatch(int stack_pointer_reg, |
590 static ActionNode* EscapeSubmatch(int reg, RegExpNode* on_success); | 588 int position_reg, |
| 589 RegExpNode* on_success); |
| 590 static ActionNode* EscapeSubmatch(int stack_pointer_reg, |
| 591 bool and_restore_position, |
| 592 int restore_reg, |
| 593 RegExpNode* on_success); |
591 virtual void Accept(NodeVisitor* visitor); | 594 virtual void Accept(NodeVisitor* visitor); |
592 virtual bool Emit(RegExpCompiler* compiler); | 595 virtual bool Emit(RegExpCompiler* compiler); |
593 virtual RegExpNode* PropagateForward(NodeInfo* info); | 596 virtual RegExpNode* PropagateForward(NodeInfo* info); |
594 private: | 597 private: |
595 union { | 598 union { |
596 struct { | 599 struct { |
597 int reg; | 600 int reg; |
598 int value; | 601 int value; |
599 } u_store_register; | 602 } u_store_register; |
600 struct { | 603 struct { |
601 int reg; | 604 int reg; |
602 } u_increment_register; | 605 } u_increment_register; |
603 struct { | 606 struct { |
604 int reg; | 607 int reg; |
605 } u_position_register; | 608 } u_position_register; |
606 struct { | 609 struct { |
607 int reg; | 610 int stack_pointer_register; |
608 } u_submatch_stack_pointer_register; | 611 int current_position_register; |
| 612 } u_submatch; |
609 } data_; | 613 } data_; |
610 ActionNode(Type type, RegExpNode* on_success) | 614 ActionNode(Type type, RegExpNode* on_success) |
611 : SeqRegExpNode(on_success), | 615 : SeqRegExpNode(on_success), |
612 type_(type) { } | 616 type_(type) { } |
613 Type type_; | 617 Type type_; |
614 friend class DotPrinter; | 618 friend class DotPrinter; |
615 }; | 619 }; |
616 | 620 |
617 | 621 |
618 class TextNode: public SeqRegExpNode { | 622 class TextNode: public SeqRegExpNode { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 RegExpNode** node_return, | 808 RegExpNode** node_return, |
805 bool ignore_case, | 809 bool ignore_case, |
806 bool multiline); | 810 bool multiline); |
807 static void DotPrint(const char* label, RegExpNode* node); | 811 static void DotPrint(const char* label, RegExpNode* node); |
808 }; | 812 }; |
809 | 813 |
810 | 814 |
811 } } // namespace v8::internal | 815 } } // namespace v8::internal |
812 | 816 |
813 #endif // V8_JSREGEXP_H_ | 817 #endif // V8_JSREGEXP_H_ |
OLD | NEW |