OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/regexp/arm64/regexp-macro-assembler-arm64.h" | 7 #include "src/regexp/arm64/regexp-macro-assembler-arm64.h" |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/log.h" | 10 #include "src/log.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 __ Ldr(w10, MemOperand(backtrack_stackpointer())); | 267 __ Ldr(w10, MemOperand(backtrack_stackpointer())); |
268 __ Cmp(current_input_offset(), w10); | 268 __ Cmp(current_input_offset(), w10); |
269 __ Cset(x11, eq); | 269 __ Cset(x11, eq); |
270 __ Add(backtrack_stackpointer(), | 270 __ Add(backtrack_stackpointer(), |
271 backtrack_stackpointer(), Operand(x11, LSL, kWRegSizeLog2)); | 271 backtrack_stackpointer(), Operand(x11, LSL, kWRegSizeLog2)); |
272 BranchOrBacktrack(eq, on_equal); | 272 BranchOrBacktrack(eq, on_equal); |
273 } | 273 } |
274 | 274 |
275 | 275 |
276 void RegExpMacroAssemblerARM64::CheckNotBackReferenceIgnoreCase( | 276 void RegExpMacroAssemblerARM64::CheckNotBackReferenceIgnoreCase( |
277 int start_reg, bool read_backward, Label* on_no_match) { | 277 int start_reg, bool read_backward, bool unicode, Label* on_no_match) { |
278 Label fallthrough; | 278 Label fallthrough; |
279 | 279 |
280 Register capture_start_offset = w10; | 280 Register capture_start_offset = w10; |
281 // Save the capture length in a callee-saved register so it will | 281 // Save the capture length in a callee-saved register so it will |
282 // be preserved if we call a C helper. | 282 // be preserved if we call a C helper. |
283 Register capture_length = w19; | 283 Register capture_length = w19; |
284 DCHECK(kCalleeSaved.IncludesAliasOf(capture_length)); | 284 DCHECK(kCalleeSaved.IncludesAliasOf(capture_length)); |
285 | 285 |
286 // Find length of back-referenced capture. | 286 // Find length of back-referenced capture. |
287 DCHECK((start_reg % 2) == 0); | 287 DCHECK((start_reg % 2) == 0); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // The cached registers need to be retained. | 381 // The cached registers need to be retained. |
382 CPURegList cached_registers(CPURegister::kRegister, kXRegSizeInBits, 0, 7); | 382 CPURegList cached_registers(CPURegister::kRegister, kXRegSizeInBits, 0, 7); |
383 DCHECK((cached_registers.Count() * 2) == kNumCachedRegisters); | 383 DCHECK((cached_registers.Count() * 2) == kNumCachedRegisters); |
384 __ PushCPURegList(cached_registers); | 384 __ PushCPURegList(cached_registers); |
385 | 385 |
386 // Put arguments into arguments registers. | 386 // Put arguments into arguments registers. |
387 // Parameters are | 387 // Parameters are |
388 // x0: Address byte_offset1 - Address captured substring's start. | 388 // x0: Address byte_offset1 - Address captured substring's start. |
389 // x1: Address byte_offset2 - Address of current character position. | 389 // x1: Address byte_offset2 - Address of current character position. |
390 // w2: size_t byte_length - length of capture in bytes(!) | 390 // w2: size_t byte_length - length of capture in bytes(!) |
391 // x3: Isolate* isolate | 391 // x3: Isolate* isolate or 0 if unicode flag |
392 | 392 |
393 // Address of start of capture. | 393 // Address of start of capture. |
394 __ Add(x0, input_end(), Operand(capture_start_offset, SXTW)); | 394 __ Add(x0, input_end(), Operand(capture_start_offset, SXTW)); |
395 // Length of capture. | 395 // Length of capture. |
396 __ Mov(w2, capture_length); | 396 __ Mov(w2, capture_length); |
397 // Address of current input position. | 397 // Address of current input position. |
398 __ Add(x1, input_end(), Operand(current_input_offset(), SXTW)); | 398 __ Add(x1, input_end(), Operand(current_input_offset(), SXTW)); |
399 if (read_backward) { | 399 if (read_backward) { |
400 __ Sub(x1, x1, Operand(capture_length, SXTW)); | 400 __ Sub(x1, x1, Operand(capture_length, SXTW)); |
401 } | 401 } |
402 // Isolate. | 402 // Isolate. |
403 __ Mov(x3, ExternalReference::isolate_address(isolate())); | 403 #ifdef V8_I18N_SUPPORT |
| 404 if (unicode) { |
| 405 __ Mov(x3, Operand(0)); |
| 406 } else // NOLINT |
| 407 #endif // V8_I18N_SUPPORT |
| 408 { |
| 409 __ Mov(x3, ExternalReference::isolate_address(isolate())); |
| 410 } |
404 | 411 |
405 { | 412 { |
406 AllowExternalCallThatCantCauseGC scope(masm_); | 413 AllowExternalCallThatCantCauseGC scope(masm_); |
407 ExternalReference function = | 414 ExternalReference function = |
408 ExternalReference::re_case_insensitive_compare_uc16(isolate()); | 415 ExternalReference::re_case_insensitive_compare_uc16(isolate()); |
409 __ CallCFunction(function, argument_count); | 416 __ CallCFunction(function, argument_count); |
410 } | 417 } |
411 | 418 |
412 // Check if function returned non-zero for success or zero for failure. | 419 // Check if function returned non-zero for success or zero for failure. |
413 // x0 is one of the registers used as a cache so it must be tested before | 420 // x0 is one of the registers used as a cache so it must be tested before |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 } | 1658 } |
1652 } | 1659 } |
1653 } | 1660 } |
1654 | 1661 |
1655 #endif // V8_INTERPRETED_REGEXP | 1662 #endif // V8_INTERPRETED_REGEXP |
1656 | 1663 |
1657 } // namespace internal | 1664 } // namespace internal |
1658 } // namespace v8 | 1665 } // namespace v8 |
1659 | 1666 |
1660 #endif // V8_TARGET_ARCH_ARM64 | 1667 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |