Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_REGEXP_MACRO_ASSEMBLER_H_ | 28 #ifndef V8_REGEXP_MACRO_ASSEMBLER_H_ |
| 29 #define V8_REGEXP_MACRO_ASSEMBLER_H_ | 29 #define V8_REGEXP_MACRO_ASSEMBLER_H_ |
| 30 | 30 |
| 31 namespace v8 { namespace internal { | 31 namespace v8 { namespace internal { |
| 32 | 32 |
| 33 | |
| 34 struct DisjunctDecisionRow { | 33 struct DisjunctDecisionRow { |
| 35 RegExpCharacterClass cc; | 34 RegExpCharacterClass cc; |
| 36 Label* on_match; | 35 Label* on_match; |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 | 38 |
| 40 class RegExpMacroAssembler { | 39 class RegExpMacroAssembler { |
| 41 public: | 40 public: |
| 42 enum IrregexpImplementation { | 41 enum IrregexpImplementation { |
| 43 kIA32Implementation, | 42 kIA32Implementation, |
| 44 kARMImplementation, | 43 kARMImplementation, |
| 45 kBytecodeImplementation}; | 44 kBytecodeImplementation |
| 45 }; | |
| 46 | |
| 47 enum StackCheckFlag { | |
| 48 kNoStackLimitCheck = false, | |
| 49 kCheckStackLimit = true | |
| 50 }; | |
| 46 | 51 |
| 47 RegExpMacroAssembler(); | 52 RegExpMacroAssembler(); |
| 48 virtual ~RegExpMacroAssembler(); | 53 virtual ~RegExpMacroAssembler(); |
| 54 // The maximal number of pushes between stack checks. Users must supply | |
| 55 // kCheckStackLimit flag to push operations (instead of kNoStackLimitCheck) | |
| 56 // at least once for every stack_limit() pushes that are executed. More | |
| 57 // often is allowed (and encouraged) | |
|
Erik Corry
2009/01/12 11:50:13
Missing full stop, and I see no need to encourage
Lasse Reichstein
2009/01/12 13:03:59
Done.
| |
| 58 virtual int stack_limit() = 0; | |
| 49 virtual void AdvanceCurrentPosition(int by) = 0; // Signed cp change. | 59 virtual void AdvanceCurrentPosition(int by) = 0; // Signed cp change. |
| 50 virtual void AdvanceRegister(int reg, int by) = 0; // r[reg] += by. | 60 virtual void AdvanceRegister(int reg, int by) = 0; // r[reg] += by. |
| 51 virtual void Backtrack() = 0; | 61 virtual void Backtrack() = 0; |
| 52 virtual void Bind(Label* label) = 0; | 62 virtual void Bind(Label* label) = 0; |
| 53 // Check the current character against a bitmap. The range of the current | 63 // Check the current character against a bitmap. The range of the current |
| 54 // character must be from start to start + length_of_bitmap_in_bits. | 64 // character must be from start to start + length_of_bitmap_in_bits. |
| 55 virtual void CheckBitmap( | 65 virtual void CheckBitmap( |
| 56 uc16 start, // The bitmap is indexed from this character. | 66 uc16 start, // The bitmap is indexed from this character. |
| 57 Label* bitmap, // Where the bitmap is emitted. | 67 Label* bitmap, // Where the bitmap is emitted. |
| 58 Label* on_zero) = 0; // Where to go if the bit is 0. Fall through on 1. | 68 Label* on_zero) = 0; // Where to go if the bit is 0. Fall through on 1. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 // Check whether a register is == to the current position and go to a | 148 // Check whether a register is == to the current position and go to a |
| 139 // label if it is. | 149 // label if it is. |
| 140 virtual void IfRegisterEqPos(int reg, Label* if_eq) = 0; | 150 virtual void IfRegisterEqPos(int reg, Label* if_eq) = 0; |
| 141 virtual IrregexpImplementation Implementation() = 0; | 151 virtual IrregexpImplementation Implementation() = 0; |
| 142 virtual void LoadCurrentCharacter(int cp_offset, | 152 virtual void LoadCurrentCharacter(int cp_offset, |
| 143 Label* on_end_of_input, | 153 Label* on_end_of_input, |
| 144 bool check_bounds = true, | 154 bool check_bounds = true, |
| 145 int characters = 1) = 0; | 155 int characters = 1) = 0; |
| 146 virtual void PopCurrentPosition() = 0; | 156 virtual void PopCurrentPosition() = 0; |
| 147 virtual void PopRegister(int register_index) = 0; | 157 virtual void PopRegister(int register_index) = 0; |
| 148 virtual void PushBacktrack(Label* label) = 0; | 158 virtual void PushBacktrack(Label* label, |
| 149 virtual void PushCurrentPosition() = 0; | 159 StackCheckFlag check_stack_limit) = 0; |
| 150 virtual void PushRegister(int register_index) = 0; | 160 virtual void PushCurrentPosition(StackCheckFlag check_stack_limit) = 0; |
| 161 virtual void PushRegister(int register_index, | |
| 162 StackCheckFlag check_stack_limit) = 0; | |
| 151 virtual void ReadCurrentPositionFromRegister(int reg) = 0; | 163 virtual void ReadCurrentPositionFromRegister(int reg) = 0; |
| 152 virtual void ReadStackPointerFromRegister(int reg) = 0; | 164 virtual void ReadStackPointerFromRegister(int reg) = 0; |
| 153 virtual void SetRegister(int register_index, int to) = 0; | 165 virtual void SetRegister(int register_index, int to) = 0; |
| 154 virtual void Succeed() = 0; | 166 virtual void Succeed() = 0; |
| 155 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0; | 167 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0; |
| 156 virtual void WriteStackPointerToRegister(int reg) = 0; | 168 virtual void WriteStackPointerToRegister(int reg) = 0; |
| 157 | 169 |
| 158 private: | 170 private: |
| 159 }; | 171 }; |
| 160 | 172 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 ArraySlice GetBuffer(Vector<T> values); | 207 ArraySlice GetBuffer(Vector<T> values); |
| 196 private: | 208 private: |
| 197 size_t byte_array_size_; | 209 size_t byte_array_size_; |
| 198 Handle<ByteArray> current_byte_array_; | 210 Handle<ByteArray> current_byte_array_; |
| 199 int current_byte_array_free_offset_; | 211 int current_byte_array_free_offset_; |
| 200 }; | 212 }; |
| 201 | 213 |
| 202 } } // namespace v8::internal | 214 } } // namespace v8::internal |
| 203 | 215 |
| 204 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ | 216 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ |
| OLD | NEW |