Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | |
| 2 // Redistribution and use in source and binary forms, with or without | |
| 3 // modification, are permitted provided that the following conditions are | |
| 4 // met: | |
| 5 // | |
| 6 // * Redistributions of source code must retain the above copyright | |
| 7 // notice, this list of conditions and the following disclaimer. | |
| 8 // * Redistributions in binary form must reproduce the above | |
| 9 // copyright notice, this list of conditions and the following | |
| 10 // disclaimer in the documentation and/or other materials provided | |
| 11 // with the distribution. | |
| 12 // * Neither the name of Google Inc. nor the names of its | |
| 13 // contributors may be used to endorse or promote products derived | |
| 14 // from this software without specific prior written permission. | |
| 15 // | |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | |
| 28 #ifndef REGEXP_MACRO_ASSEMBLER_TRACER_H_ | |
| 29 #define REGEXP_MACRO_ASSEMBLER_TRACER_H_ | |
| 30 | |
| 31 namespace v8 { namespace internal { | |
| 32 | |
| 33 // Decorator on a RegExpMacroAssembler that write all calls. | |
| 34 class RegExpMacroAssemblerTracer: public RegExpMacroAssembler { | |
| 35 public: | |
| 36 explicit RegExpMacroAssemblerTracer(RegExpMacroAssembler* assembler); | |
| 37 virtual ~RegExpMacroAssemblerTracer(); | |
| 38 | |
| 39 virtual void AdvanceCurrentPosition(int by); // Signed cp change. | |
| 40 virtual void AdvanceRegister(int reg, int by); // r[reg] += by. | |
| 41 virtual void Backtrack(); | |
| 42 virtual void Bind(Label* label); | |
| 43 // Check the current character against a bitmap. The range of the current | |
| 44 // character must be from start to start + length_of_bitmap_in_bits. | |
|
Erik Corry
2008/11/27 13:04:36
I think the indivdual method comments should be re
| |
| 45 virtual void CheckBitmap( | |
| 46 uc16 start, // The bitmap is indexed from this character. | |
| 47 Label* bitmap, // Where the bitmap is emitted. | |
| 48 Label* on_zero); // Where to go if the bit is 0. Fall through on 1. | |
| 49 // Dispatch after looking the current character up in a 2-bits-per-entry | |
| 50 // map. The destinations vector has up to 4 labels. | |
| 51 virtual void CheckCharacter(uc16 c, Label* on_equal); | |
| 52 virtual void CheckCharacterGT(uc16 limit, Label* on_greater); | |
| 53 virtual void CheckCharacterLT(uc16 limit, Label* on_less); | |
| 54 // Check the current character for a match with a literal string. If we | |
| 55 // fail to match then goto the on_failure label. End of input always | |
| 56 // matches. If the label is NULL then we should pop a backtrack address off | |
| 57 // the stack abnd go to that. | |
| 58 virtual void CheckCharacters( | |
| 59 Vector<const uc16> str, | |
| 60 int cp_offset, | |
| 61 Label* on_failure); | |
| 62 // Check the current input position against a register. If the register is | |
| 63 // equal to the current position then go to the label. If the label is NULL | |
| 64 // then backtrack instead. | |
| 65 virtual void CheckCurrentPosition( | |
| 66 int register_index, | |
| 67 Label* on_equal); | |
| 68 virtual void CheckNotBackReference(int start_reg, Label* on_no_match); | |
| 69 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, | |
| 70 Label* on_no_match); | |
| 71 // Check the current character for a match with a literal character. If we | |
| 72 // fail to match then goto the on_failure label. End of input always | |
| 73 // matches. If the label is NULL then we should pop a backtrack address off | |
| 74 // the stack and go to that. | |
| 75 virtual void CheckNotCharacter(uc16 c, Label* on_not_equal); | |
| 76 // Bitwise or the current character with the given constant and then | |
| 77 // check for a match with c. | |
| 78 virtual void CheckNotCharacterAfterOr(uc16 c, | |
| 79 uc16 or_with, | |
| 80 Label* on_not_equal); | |
| 81 // Subtract a constant from the current character, then or with the given | |
| 82 // constant and then check for a match with c. | |
| 83 virtual void CheckNotCharacterAfterMinusOr(uc16 c, | |
| 84 uc16 minus_then_or_with, | |
| 85 Label* on_not_equal); | |
| 86 // Dispatch after looking the current character up in a byte map. The | |
| 87 // destinations vector has up to 256 labels. | |
| 88 virtual void DispatchByteMap( | |
| 89 uc16 start, | |
| 90 Label* byte_map, | |
| 91 const Vector<Label*>& destinations); | |
| 92 virtual void DispatchHalfNibbleMap( | |
| 93 uc16 start, | |
| 94 Label* half_nibble_map, | |
| 95 const Vector<Label*>& destinations); | |
| 96 // Dispatch after looking the high byte of the current character up in a byte | |
| 97 // map. The destinations vector has up to 256 labels. | |
| 98 virtual void DispatchHighByteMap( | |
| 99 byte start, | |
| 100 Label* byte_map, | |
| 101 const Vector<Label*>& destinations); | |
| 102 virtual void EmitOrLink(Label* label); | |
| 103 virtual void Fail(); | |
| 104 virtual Handle<Object> GetCode(); | |
| 105 virtual void GoTo(Label* label); | |
| 106 // Check whether a register is >= a given constant and go to a label if it | |
| 107 // is. Backtracks instead if the label is NULL. | |
| 108 virtual void IfRegisterGE(int reg, int comparand, Label* if_ge); | |
| 109 // Check whether a register is < a given constant and go to a label if it is. | |
| 110 // Backtracks instead if the label is NULL. | |
| 111 virtual void IfRegisterLT(int reg, int comparand, Label* if_lt); | |
| 112 virtual IrregexpImplementation Implementation(); | |
| 113 virtual void LoadCurrentCharacter(int cp_offset, Label* on_end_of_input); | |
| 114 virtual void PopCurrentPosition(); | |
| 115 virtual void PopRegister(int register_index); | |
| 116 virtual void PushBacktrack(Label* label); | |
| 117 virtual void PushCurrentPosition(); | |
| 118 virtual void PushRegister(int register_index); | |
| 119 virtual void ReadCurrentPositionFromRegister(int reg); | |
| 120 virtual void ReadStackPointerFromRegister(int reg); | |
| 121 virtual void SetRegister(int register_index, int to); | |
| 122 virtual void Succeed(); | |
| 123 virtual void WriteCurrentPositionToRegister(int reg); | |
| 124 virtual void WriteStackPointerToRegister(int reg); | |
| 125 private: | |
| 126 RegExpMacroAssembler* assembler_; | |
| 127 }; | |
| 128 | |
| 129 } } // namespace v8::internal | |
| 130 | |
| 131 #endif // REGEXP_MACRO_ASSEMBLER_TRACER_H_ | |
| OLD | NEW |