OLD | NEW |
1 // Copyright 2010 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Parameters (first four passed as registers, but with room on stack). | 147 // Parameters (first four passed as registers, but with room on stack). |
148 // In Microsoft 64-bit Calling Convention, there is room on the callers | 148 // In Microsoft 64-bit Calling Convention, there is room on the callers |
149 // stack (before the return address) to spill parameter registers. We | 149 // stack (before the return address) to spill parameter registers. We |
150 // use this space to store the register passed parameters. | 150 // use this space to store the register passed parameters. |
151 static const int kInputString = kFrameAlign; | 151 static const int kInputString = kFrameAlign; |
152 // StartIndex is passed as 32 bit int. | 152 // StartIndex is passed as 32 bit int. |
153 static const int kStartIndex = kInputString + kPointerSize; | 153 static const int kStartIndex = kInputString + kPointerSize; |
154 static const int kInputStart = kStartIndex + kPointerSize; | 154 static const int kInputStart = kStartIndex + kPointerSize; |
155 static const int kInputEnd = kInputStart + kPointerSize; | 155 static const int kInputEnd = kInputStart + kPointerSize; |
156 static const int kRegisterOutput = kInputEnd + kPointerSize; | 156 static const int kRegisterOutput = kInputEnd + kPointerSize; |
157 static const int kStackHighEnd = kRegisterOutput + kPointerSize; | 157 // For the case of global regular expression, we have room to store at least |
| 158 // one set of capture results. For the case of non-global regexp, we ignore |
| 159 // this value. |
| 160 static const int kNumOutputRegisters = kRegisterOutput + kPointerSize; |
| 161 static const int kStackHighEnd = kNumOutputRegisters + kPointerSize; |
158 // DirectCall is passed as 32 bit int (values 0 or 1). | 162 // DirectCall is passed as 32 bit int (values 0 or 1). |
159 static const int kDirectCall = kStackHighEnd + kPointerSize; | 163 static const int kDirectCall = kStackHighEnd + kPointerSize; |
160 static const int kIsolate = kDirectCall + kPointerSize; | 164 static const int kIsolate = kDirectCall + kPointerSize; |
161 #else | 165 #else |
162 // In AMD64 ABI Calling Convention, the first six integer parameters | 166 // In AMD64 ABI Calling Convention, the first six integer parameters |
163 // are passed as registers, and caller must allocate space on the stack | 167 // are passed as registers, and caller must allocate space on the stack |
164 // if it wants them stored. We push the parameters after the frame pointer. | 168 // if it wants them stored. We push the parameters after the frame pointer. |
165 static const int kInputString = kFramePointer - kPointerSize; | 169 static const int kInputString = kFramePointer - kPointerSize; |
166 static const int kStartIndex = kInputString - kPointerSize; | 170 static const int kStartIndex = kInputString - kPointerSize; |
167 static const int kInputStart = kStartIndex - kPointerSize; | 171 static const int kInputStart = kStartIndex - kPointerSize; |
168 static const int kInputEnd = kInputStart - kPointerSize; | 172 static const int kInputEnd = kInputStart - kPointerSize; |
169 static const int kRegisterOutput = kInputEnd - kPointerSize; | 173 static const int kRegisterOutput = kInputEnd - kPointerSize; |
170 static const int kStackHighEnd = kRegisterOutput - kPointerSize; | 174 // For the case of global regular expression, we have room to store at least |
171 static const int kDirectCall = kFrameAlign; | 175 // one set of capture results. For the case of non-global regexp, we ignore |
| 176 // this value. |
| 177 static const int kNumOutputRegisters = kRegisterOutput - kPointerSize; |
| 178 static const int kStackHighEnd = kFrameAlign; |
| 179 static const int kDirectCall = kStackHighEnd + kPointerSize; |
172 static const int kIsolate = kDirectCall + kPointerSize; | 180 static const int kIsolate = kDirectCall + kPointerSize; |
173 #endif | 181 #endif |
174 | 182 |
175 #ifdef _WIN64 | 183 #ifdef _WIN64 |
176 // Microsoft calling convention has three callee-saved registers | 184 // Microsoft calling convention has three callee-saved registers |
177 // (that we are using). We push these after the frame pointer. | 185 // (that we are using). We push these after the frame pointer. |
178 static const int kBackup_rsi = kFramePointer - kPointerSize; | 186 static const int kBackup_rsi = kFramePointer - kPointerSize; |
179 static const int kBackup_rdi = kBackup_rsi - kPointerSize; | 187 static const int kBackup_rdi = kBackup_rsi - kPointerSize; |
180 static const int kBackup_rbx = kBackup_rdi - kPointerSize; | 188 static const int kBackup_rbx = kBackup_rdi - kPointerSize; |
181 static const int kLastCalleeSaveRegister = kBackup_rbx; | 189 static const int kLastCalleeSaveRegister = kBackup_rbx; |
182 #else | 190 #else |
183 // AMD64 Calling Convention has only one callee-save register that | 191 // AMD64 Calling Convention has only one callee-save register that |
184 // we use. We push this after the frame pointer (and after the | 192 // we use. We push this after the frame pointer (and after the |
185 // parameters). | 193 // parameters). |
186 static const int kBackup_rbx = kStackHighEnd - kPointerSize; | 194 static const int kBackup_rbx = kNumOutputRegisters - kPointerSize; |
187 static const int kLastCalleeSaveRegister = kBackup_rbx; | 195 static const int kLastCalleeSaveRegister = kBackup_rbx; |
188 #endif | 196 #endif |
189 | 197 |
| 198 static const int kSuccessfulCaptures = kBackup_rbx - kPointerSize; |
190 // When adding local variables remember to push space for them in | 199 // When adding local variables remember to push space for them in |
191 // the frame in GetCode. | 200 // the frame in GetCode. |
192 static const int kInputStartMinusOne = | 201 static const int kInputStartMinusOne = kSuccessfulCaptures - kPointerSize; |
193 kLastCalleeSaveRegister - kPointerSize; | |
194 | 202 |
195 // First register address. Following registers are below it on the stack. | 203 // First register address. Following registers are below it on the stack. |
196 static const int kRegisterZero = kInputStartMinusOne - kPointerSize; | 204 static const int kRegisterZero = kInputStartMinusOne - kPointerSize; |
197 | 205 |
198 // Initial size of code buffer. | 206 // Initial size of code buffer. |
199 static const size_t kRegExpCodeSize = 1024; | 207 static const size_t kRegExpCodeSize = 1024; |
200 | 208 |
201 // Load a number of characters at the given offset from the | 209 // Load a number of characters at the given offset from the |
202 // current position, into the current-character register. | 210 // current position, into the current-character register. |
203 void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); | 211 void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 Label exit_label_; | 295 Label exit_label_; |
288 Label check_preempt_label_; | 296 Label check_preempt_label_; |
289 Label stack_overflow_label_; | 297 Label stack_overflow_label_; |
290 }; | 298 }; |
291 | 299 |
292 #endif // V8_INTERPRETED_REGEXP | 300 #endif // V8_INTERPRETED_REGEXP |
293 | 301 |
294 }} // namespace v8::internal | 302 }} // namespace v8::internal |
295 | 303 |
296 #endif // V8_X64_REGEXP_MACRO_ASSEMBLER_X64_H_ | 304 #endif // V8_X64_REGEXP_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |