OLD | NEW |
---|---|
1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 11 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_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ | 28 #ifndef V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ |
29 #define V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ | 29 #define V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ |
30 | 30 |
31 #include "ia32/assembler-ia32.h" | 31 #include "ia32/assembler-ia32.h" |
32 #include "ia32/assembler-ia32-inl.h" | 32 #include "ia32/assembler-ia32-inl.h" |
33 #include "globals.h" | |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 #ifdef V8_INTERPRETED_REGEXP | 38 #ifdef V8_INTERPRETED_REGEXP |
38 class RegExpMacroAssemblerIA32: public RegExpMacroAssembler { | 39 class RegExpMacroAssemblerIA32: public RegExpMacroAssembler { |
39 public: | 40 public: |
40 RegExpMacroAssemblerIA32() { } | 41 RegExpMacroAssemblerIA32() { } |
41 virtual ~RegExpMacroAssemblerIA32() { } | 42 virtual ~RegExpMacroAssemblerIA32() { } |
42 }; | 43 }; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 static const int kFramePointer = 0; | 129 static const int kFramePointer = 0; |
129 // Above the frame pointer - function parameters and return address. | 130 // Above the frame pointer - function parameters and return address. |
130 static const int kReturn_eip = kFramePointer + kPointerSize; | 131 static const int kReturn_eip = kFramePointer + kPointerSize; |
131 static const int kFrameAlign = kReturn_eip + kPointerSize; | 132 static const int kFrameAlign = kReturn_eip + kPointerSize; |
132 // Parameters. | 133 // Parameters. |
133 static const int kInputString = kFrameAlign; | 134 static const int kInputString = kFrameAlign; |
134 static const int kStartIndex = kInputString + kPointerSize; | 135 static const int kStartIndex = kInputString + kPointerSize; |
135 static const int kInputStart = kStartIndex + kPointerSize; | 136 static const int kInputStart = kStartIndex + kPointerSize; |
136 static const int kInputEnd = kInputStart + kPointerSize; | 137 static const int kInputEnd = kInputStart + kPointerSize; |
137 static const int kRegisterOutput = kInputEnd + kPointerSize; | 138 static const int kRegisterOutput = kInputEnd + kPointerSize; |
138 static const int kStackHighEnd = kRegisterOutput + kPointerSize; | 139 // For the case of global regular expression, we have room to store more |
Erik Corry
2012/05/11 11:01:00
more than one -> at least one
?
Yang
2012/05/16 14:58:47
Done.
| |
140 // than one set of capture results. For the case of non-global regexp, we | |
141 // ignore this value. | |
142 static const int kNumOutputRegisters = kRegisterOutput + kPointerSize; | |
143 static const int kStackHighEnd = kNumOutputRegisters + kPointerSize; | |
139 static const int kDirectCall = kStackHighEnd + kPointerSize; | 144 static const int kDirectCall = kStackHighEnd + kPointerSize; |
140 static const int kIsolate = kDirectCall + kPointerSize; | 145 static const int kIsolate = kDirectCall + kPointerSize; |
141 // Below the frame pointer - local stack variables. | 146 // Below the frame pointer - local stack variables. |
142 // When adding local variables remember to push space for them in | 147 // When adding local variables remember to push space for them in |
143 // the frame in GetCode. | 148 // the frame in GetCode. |
144 static const int kBackup_esi = kFramePointer - kPointerSize; | 149 static const int kBackup_esi = kFramePointer - kPointerSize; |
145 static const int kBackup_edi = kBackup_esi - kPointerSize; | 150 static const int kBackup_edi = kBackup_esi - kPointerSize; |
146 static const int kBackup_ebx = kBackup_edi - kPointerSize; | 151 static const int kBackup_ebx = kBackup_edi - kPointerSize; |
147 static const int kInputStartMinusOne = kBackup_ebx - kPointerSize; | 152 static const int kSuccessfulCaptures = kBackup_ebx - kPointerSize; |
153 static const int kInputStartMinusOne = kSuccessfulCaptures - kPointerSize; | |
148 // First register address. Following registers are below it on the stack. | 154 // First register address. Following registers are below it on the stack. |
149 static const int kRegisterZero = kInputStartMinusOne - kPointerSize; | 155 static const int kRegisterZero = kInputStartMinusOne - kPointerSize; |
150 | 156 |
151 // Initial size of code buffer. | 157 // Initial size of code buffer. |
152 static const size_t kRegExpCodeSize = 1024; | 158 static const size_t kRegExpCodeSize = 1024; |
153 | 159 |
160 // The highest bit on the output registers count signals success. This | |
Erik Corry
2012/05/11 11:01:00
lowest bit?
Yang
2012/05/16 14:58:47
Not even necessary anymore. Removed.
| |
161 // is only relevant for global regular expressions. | |
162 static const int kGlobalSuccessFlag = 1; | |
163 | |
154 // Load a number of characters at the given offset from the | 164 // Load a number of characters at the given offset from the |
155 // current position, into the current-character register. | 165 // current position, into the current-character register. |
156 void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); | 166 void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); |
157 | 167 |
158 // Check whether preemption has been requested. | 168 // Check whether preemption has been requested. |
159 void CheckPreemption(); | 169 void CheckPreemption(); |
160 | 170 |
161 // Check whether we are exceeding the stack limit on the backtrack stack. | 171 // Check whether we are exceeding the stack limit on the backtrack stack. |
162 void CheckStackLimit(); | 172 void CheckStackLimit(); |
163 | 173 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 Label backtrack_label_; | 228 Label backtrack_label_; |
219 Label exit_label_; | 229 Label exit_label_; |
220 Label check_preempt_label_; | 230 Label check_preempt_label_; |
221 Label stack_overflow_label_; | 231 Label stack_overflow_label_; |
222 }; | 232 }; |
223 #endif // V8_INTERPRETED_REGEXP | 233 #endif // V8_INTERPRETED_REGEXP |
224 | 234 |
225 }} // namespace v8::internal | 235 }} // namespace v8::internal |
226 | 236 |
227 #endif // V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ | 237 #endif // V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |