| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 | 33 |
| 34 struct DisjunctDecisionRow { | 34 struct DisjunctDecisionRow { |
| 35 RegExpCharacterClass cc; | 35 RegExpCharacterClass cc; |
| 36 Label* on_match; | 36 Label* on_match; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 | 39 |
| 40 class RegExpMacroAssembler { | 40 class RegExpMacroAssembler { |
| 41 public: | 41 public: |
| 42 RegExpMacroAssembler() { } | 42 RegExpMacroAssembler(); |
| 43 virtual ~RegExpMacroAssembler(); | 43 virtual ~RegExpMacroAssembler(); |
| 44 virtual void Bind(Label* label) = 0; | 44 virtual void Bind(Label* label) = 0; |
| 45 virtual void EmitOrLink(Label* label) = 0; | 45 virtual void EmitOrLink(Label* label) = 0; |
| 46 virtual void AdvanceCurrentPosition(int by) = 0; // Signed cp change. | 46 virtual void AdvanceCurrentPosition(int by) = 0; // Signed cp change. |
| 47 virtual void PopCurrentPosition() = 0; | 47 virtual void PopCurrentPosition() = 0; |
| 48 virtual void PushCurrentPosition() = 0; | 48 virtual void PushCurrentPosition() = 0; |
| 49 virtual void Backtrack() = 0; | 49 virtual void Backtrack() = 0; |
| 50 virtual void GoTo(Label* label) = 0; | 50 virtual void GoTo(Label* label) = 0; |
| 51 virtual void PushBacktrack(Label* label) = 0; | 51 virtual void PushBacktrack(Label* label) = 0; |
| 52 virtual void Succeed() = 0; | 52 virtual void Succeed() = 0; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // is. Backtracks instead if the label is NULL. | 109 // is. Backtracks instead if the label is NULL. |
| 110 virtual void IfRegisterGE(int reg, int comparand, Label* if_ge) = 0; | 110 virtual void IfRegisterGE(int reg, int comparand, Label* if_ge) = 0; |
| 111 | 111 |
| 112 enum Re2kImplementation { | 112 enum Re2kImplementation { |
| 113 kIA32Implementation, | 113 kIA32Implementation, |
| 114 kARMImplementation, | 114 kARMImplementation, |
| 115 kBytecodeImplementation}; | 115 kBytecodeImplementation}; |
| 116 | 116 |
| 117 virtual Re2kImplementation Implementation() = 0; | 117 virtual Re2kImplementation Implementation() = 0; |
| 118 virtual Handle<Object> GetCode() = 0; | 118 virtual Handle<Object> GetCode() = 0; |
| 119 |
| 119 private: | 120 private: |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 | 123 |
| 124 template <typename T> |
| 125 struct ArraySlice { |
| 126 public: |
| 127 ArraySlice(Handle<ByteArray> array, size_t offset) |
| 128 : array_(array), offset_(offset) {} |
| 129 Handle<ByteArray> array() { return array_; } |
| 130 // Offset in the byte array data. |
| 131 size_t offset() { return offset_; } |
| 132 // Offset from the ByteArray pointer. |
| 133 size_t base_offset() { |
| 134 return kHeaderSize - kHeapObjectTag + offset; |
| 135 } |
| 136 T* operator*() { |
| 137 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset); |
| 138 } |
| 139 T& operator[](int idx) { |
| 140 return reinterpret_cast<T*>(array_->getDataStartAddress() + offset)[idx]; |
| 141 } |
| 142 private: |
| 143 const Handle<ByteArray> array_; |
| 144 const size_t offset_; |
| 145 }; |
| 146 |
| 147 |
| 148 class ByteArrayProvider { |
| 149 public: |
| 150 ByteArrayProvider(int initial_size); |
| 151 // Provides a place to put "size" elements of type T. The information |
| 152 // can be stored in the provided ByteArray at the "offset". The offset is |
| 153 // aligned to an "align"-boundary |
| 154 template <typename T> |
| 155 ArraySlice<T> GetBuffer(int size, int align); |
| 156 private: |
| 157 const int byte_array_size_; |
| 158 Handle<ByteArray> current_byte_array_; |
| 159 int current_byte_array_free_offset_; |
| 160 }; |
| 161 |
| 123 } } // namespace v8::internal | 162 } } // namespace v8::internal |
| 124 | 163 |
| 125 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ | 164 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ |
| OLD | NEW |