OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 virtual void CheckBitmap( | 55 virtual void CheckBitmap( |
56 uc16 start, // The bitmap is indexed from this character. | 56 uc16 start, // The bitmap is indexed from this character. |
57 Label* bitmap, // Where the bitmap is emitted. | 57 Label* bitmap, // Where the bitmap is emitted. |
58 Label* on_zero) = 0; // Where to go if the bit is 0. Fall through on 1. | 58 Label* on_zero) = 0; // Where to go if the bit is 0. Fall through on 1. |
59 // Dispatch after looking the current character up in a 2-bits-per-entry | 59 // Dispatch after looking the current character up in a 2-bits-per-entry |
60 // map. The destinations vector has up to 4 labels. | 60 // map. The destinations vector has up to 4 labels. |
61 virtual void CheckCharacter(uc16 c, Label* on_equal) = 0; | 61 virtual void CheckCharacter(uc16 c, Label* on_equal) = 0; |
62 virtual void CheckCharacterGT(uc16 limit, Label* on_greater) = 0; | 62 virtual void CheckCharacterGT(uc16 limit, Label* on_greater) = 0; |
63 virtual void CheckCharacterLT(uc16 limit, Label* on_less) = 0; | 63 virtual void CheckCharacterLT(uc16 limit, Label* on_less) = 0; |
64 // Check the current character for a match with a literal string. If we | 64 // Check the current character for a match with a literal string. If we |
65 // fail to match then goto the on_failure label. End of input always | 65 // fail to match then goto the on_failure label. If check_eos is set then |
66 // matches. If the label is NULL then we should pop a backtrack address off | 66 // the end of input always fails. If check_eos is clear then it is the |
67 // the stack abnd go to that. | 67 // caller's responsibility to ensure that the end of string is not hit. |
| 68 // If the label is NULL then we should pop a backtrack address off |
| 69 // the stack and go to that. |
68 virtual void CheckCharacters( | 70 virtual void CheckCharacters( |
69 Vector<const uc16> str, | 71 Vector<const uc16> str, |
70 int cp_offset, | 72 int cp_offset, |
71 Label* on_failure) = 0; | 73 Label* on_failure, |
72 // Check the current input position against a register. If the register is | 74 bool check_eos) = 0; |
73 // equal to the current position then go to the label. If the label is NULL | 75 virtual void CheckGreedyLoop(Label* on_tos_equals_current_position) = 0; |
74 // then backtrack instead. | |
75 virtual void CheckCurrentPosition( | |
76 int register_index, | |
77 Label* on_equal) = 0; | |
78 virtual void CheckNotAtStart(Label* on_not_at_start) = 0; | 76 virtual void CheckNotAtStart(Label* on_not_at_start) = 0; |
79 virtual void CheckNotBackReference(int start_reg, Label* on_no_match) = 0; | 77 virtual void CheckNotBackReference(int start_reg, Label* on_no_match) = 0; |
80 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, | 78 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, |
81 Label* on_no_match) = 0; | 79 Label* on_no_match) = 0; |
82 // Check the current character for a match with a literal character. If we | 80 // Check the current character for a match with a literal character. If we |
83 // fail to match then goto the on_failure label. End of input always | 81 // fail to match then goto the on_failure label. End of input always |
84 // matches. If the label is NULL then we should pop a backtrack address off | 82 // matches. If the label is NULL then we should pop a backtrack address off |
85 // the stack and go to that. | 83 // the stack and go to that. |
86 virtual void CheckNotCharacter(uc16 c, Label* on_not_equal) = 0; | 84 virtual void CheckNotCharacter(uc16 c, Label* on_not_equal) = 0; |
87 // Bitwise or the current character with the given constant and then | 85 // Bitwise or the current character with the given constant and then |
(...skipping 20 matching lines...) Expand all Loading... |
108 Label* half_nibble_map, | 106 Label* half_nibble_map, |
109 const Vector<Label*>& destinations) = 0; | 107 const Vector<Label*>& destinations) = 0; |
110 // Dispatch after looking the high byte of the current character up in a byte | 108 // Dispatch after looking the high byte of the current character up in a byte |
111 // map. The destinations vector has up to 256 labels. | 109 // map. The destinations vector has up to 256 labels. |
112 virtual void DispatchHighByteMap( | 110 virtual void DispatchHighByteMap( |
113 byte start, | 111 byte start, |
114 Label* byte_map, | 112 Label* byte_map, |
115 const Vector<Label*>& destinations) = 0; | 113 const Vector<Label*>& destinations) = 0; |
116 virtual void EmitOrLink(Label* label) = 0; | 114 virtual void EmitOrLink(Label* label) = 0; |
117 virtual void Fail() = 0; | 115 virtual void Fail() = 0; |
118 virtual Handle<Object> GetCode() = 0; | 116 virtual Handle<Object> GetCode(Handle<String> source) = 0; |
119 virtual void GoTo(Label* label) = 0; | 117 virtual void GoTo(Label* label) = 0; |
120 // Check whether a register is >= a given constant and go to a label if it | 118 // Check whether a register is >= a given constant and go to a label if it |
121 // is. Backtracks instead if the label is NULL. | 119 // is. Backtracks instead if the label is NULL. |
122 virtual void IfRegisterGE(int reg, int comparand, Label* if_ge) = 0; | 120 virtual void IfRegisterGE(int reg, int comparand, Label* if_ge) = 0; |
123 // Check whether a register is < a given constant and go to a label if it is. | 121 // Check whether a register is < a given constant and go to a label if it is. |
124 // Backtracks instead if the label is NULL. | 122 // Backtracks instead if the label is NULL. |
125 virtual void IfRegisterLT(int reg, int comparand, Label* if_lt) = 0; | 123 virtual void IfRegisterLT(int reg, int comparand, Label* if_lt) = 0; |
126 virtual IrregexpImplementation Implementation() = 0; | 124 virtual IrregexpImplementation Implementation() = 0; |
127 virtual void LoadCurrentCharacter(int cp_offset, Label* on_end_of_input) = 0; | 125 virtual void LoadCurrentCharacter(int cp_offset, Label* on_end_of_input) = 0; |
| 126 virtual void LoadCurrentCharacterUnchecked(int cp_offset) = 0; |
128 virtual void PopCurrentPosition() = 0; | 127 virtual void PopCurrentPosition() = 0; |
129 virtual void PopRegister(int register_index) = 0; | 128 virtual void PopRegister(int register_index) = 0; |
130 virtual void PushBacktrack(Label* label) = 0; | 129 virtual void PushBacktrack(Label* label) = 0; |
131 virtual void PushCurrentPosition() = 0; | 130 virtual void PushCurrentPosition() = 0; |
132 virtual void PushRegister(int register_index) = 0; | 131 virtual void PushRegister(int register_index) = 0; |
133 virtual void ReadCurrentPositionFromRegister(int reg) = 0; | 132 virtual void ReadCurrentPositionFromRegister(int reg) = 0; |
134 virtual void ReadStackPointerFromRegister(int reg) = 0; | 133 virtual void ReadStackPointerFromRegister(int reg) = 0; |
135 virtual void SetRegister(int register_index, int to) = 0; | 134 virtual void SetRegister(int register_index, int to) = 0; |
136 virtual void Succeed() = 0; | 135 virtual void Succeed() = 0; |
137 virtual void WriteCurrentPositionToRegister(int reg) = 0; | 136 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0; |
138 virtual void WriteStackPointerToRegister(int reg) = 0; | 137 virtual void WriteStackPointerToRegister(int reg) = 0; |
139 | 138 |
140 private: | 139 private: |
141 }; | 140 }; |
142 | 141 |
143 | 142 |
144 struct ArraySlice { | 143 struct ArraySlice { |
145 public: | 144 public: |
146 ArraySlice(Handle<ByteArray> array, size_t offset) | 145 ArraySlice(Handle<ByteArray> array, size_t offset) |
147 : array_(array), offset_(offset) {} | 146 : array_(array), offset_(offset) {} |
(...skipping 29 matching lines...) Expand all Loading... |
177 ArraySlice GetBuffer(Vector<T> values); | 176 ArraySlice GetBuffer(Vector<T> values); |
178 private: | 177 private: |
179 size_t byte_array_size_; | 178 size_t byte_array_size_; |
180 Handle<ByteArray> current_byte_array_; | 179 Handle<ByteArray> current_byte_array_; |
181 int current_byte_array_free_offset_; | 180 int current_byte_array_free_offset_; |
182 }; | 181 }; |
183 | 182 |
184 } } // namespace v8::internal | 183 } } // namespace v8::internal |
185 | 184 |
186 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ | 185 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ |
OLD | NEW |