OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/regexp/x87/regexp-macro-assembler-x87.h" | 7 #include "src/regexp/x87/regexp-macro-assembler-x87.h" |
8 | 8 |
9 #include "src/log.h" | 9 #include "src/log.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 void RegExpMacroAssemblerX87::CheckGreedyLoop(Label* on_equal) { | 181 void RegExpMacroAssemblerX87::CheckGreedyLoop(Label* on_equal) { |
182 Label fallthrough; | 182 Label fallthrough; |
183 __ cmp(edi, Operand(backtrack_stackpointer(), 0)); | 183 __ cmp(edi, Operand(backtrack_stackpointer(), 0)); |
184 __ j(not_equal, &fallthrough); | 184 __ j(not_equal, &fallthrough); |
185 __ add(backtrack_stackpointer(), Immediate(kPointerSize)); // Pop. | 185 __ add(backtrack_stackpointer(), Immediate(kPointerSize)); // Pop. |
186 BranchOrBacktrack(no_condition, on_equal); | 186 BranchOrBacktrack(no_condition, on_equal); |
187 __ bind(&fallthrough); | 187 __ bind(&fallthrough); |
188 } | 188 } |
189 | 189 |
190 | |
191 void RegExpMacroAssemblerX87::CheckNotBackReferenceIgnoreCase( | 190 void RegExpMacroAssemblerX87::CheckNotBackReferenceIgnoreCase( |
192 int start_reg, bool read_backward, Label* on_no_match) { | 191 int start_reg, bool read_backward, bool unicode, Label* on_no_match) { |
193 Label fallthrough; | 192 Label fallthrough; |
194 __ mov(edx, register_location(start_reg)); // Index of start of capture | 193 __ mov(edx, register_location(start_reg)); // Index of start of capture |
195 __ mov(ebx, register_location(start_reg + 1)); // Index of end of capture | 194 __ mov(ebx, register_location(start_reg + 1)); // Index of end of capture |
196 __ sub(ebx, edx); // Length of capture. | 195 __ sub(ebx, edx); // Length of capture. |
197 | 196 |
198 // At this point, the capture registers are either both set or both cleared. | 197 // At this point, the capture registers are either both set or both cleared. |
199 // If the capture length is zero, then the capture is either empty or cleared. | 198 // If the capture length is zero, then the capture is either empty or cleared. |
200 // Fall through in both cases. | 199 // Fall through in both cases. |
201 __ j(equal, &fallthrough); | 200 __ j(equal, &fallthrough); |
202 | 201 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 __ push(backtrack_stackpointer()); | 288 __ push(backtrack_stackpointer()); |
290 __ push(ebx); | 289 __ push(ebx); |
291 | 290 |
292 static const int argument_count = 4; | 291 static const int argument_count = 4; |
293 __ PrepareCallCFunction(argument_count, ecx); | 292 __ PrepareCallCFunction(argument_count, ecx); |
294 // Put arguments into allocated stack area, last argument highest on stack. | 293 // Put arguments into allocated stack area, last argument highest on stack. |
295 // Parameters are | 294 // Parameters are |
296 // Address byte_offset1 - Address captured substring's start. | 295 // Address byte_offset1 - Address captured substring's start. |
297 // Address byte_offset2 - Address of current character position. | 296 // Address byte_offset2 - Address of current character position. |
298 // size_t byte_length - length of capture in bytes(!) | 297 // size_t byte_length - length of capture in bytes(!) |
299 // Isolate* isolate | 298 // Isolate* isolate or 0 if unicode flag. |
300 | 299 |
301 // Set isolate. | 300 // Set isolate. |
302 __ mov(Operand(esp, 3 * kPointerSize), | 301 #ifdef V8_I18N_SUPPORT |
303 Immediate(ExternalReference::isolate_address(isolate()))); | 302 if (unicode) { |
| 303 __ mov(Operand(esp, 3 * kPointerSize), Immediate(0)); |
| 304 } else // NOLINT |
| 305 #endif // V8_I18N_SUPPORT |
| 306 { |
| 307 __ mov(Operand(esp, 3 * kPointerSize), |
| 308 Immediate(ExternalReference::isolate_address(isolate()))); |
| 309 } |
304 // Set byte_length. | 310 // Set byte_length. |
305 __ mov(Operand(esp, 2 * kPointerSize), ebx); | 311 __ mov(Operand(esp, 2 * kPointerSize), ebx); |
306 // Set byte_offset2. | 312 // Set byte_offset2. |
307 // Found by adding negative string-end offset of current position (edi) | 313 // Found by adding negative string-end offset of current position (edi) |
308 // to end of string. | 314 // to end of string. |
309 __ add(edi, esi); | 315 __ add(edi, esi); |
310 if (read_backward) { | 316 if (read_backward) { |
311 __ sub(edi, ebx); // Offset by length when matching backwards. | 317 __ sub(edi, ebx); // Offset by length when matching backwards. |
312 } | 318 } |
313 __ mov(Operand(esp, 1 * kPointerSize), edi); | 319 __ mov(Operand(esp, 1 * kPointerSize), edi); |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 | 1260 |
1255 | 1261 |
1256 #undef __ | 1262 #undef __ |
1257 | 1263 |
1258 #endif // V8_INTERPRETED_REGEXP | 1264 #endif // V8_INTERPRETED_REGEXP |
1259 | 1265 |
1260 } // namespace internal | 1266 } // namespace internal |
1261 } // namespace v8 | 1267 } // namespace v8 |
1262 | 1268 |
1263 #endif // V8_TARGET_ARCH_X87 | 1269 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |