OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // w2: size_t byte_length - length of capture in bytes(!) | 401 // w2: size_t byte_length - length of capture in bytes(!) |
402 // x3: Isolate* isolate | 402 // x3: Isolate* isolate |
403 | 403 |
404 // Address of start of capture. | 404 // Address of start of capture. |
405 __ Add(x0, input_end(), Operand(capture_start_offset, SXTW)); | 405 __ Add(x0, input_end(), Operand(capture_start_offset, SXTW)); |
406 // Length of capture. | 406 // Length of capture. |
407 __ Mov(w2, capture_length); | 407 __ Mov(w2, capture_length); |
408 // Address of current input position. | 408 // Address of current input position. |
409 __ Add(x1, input_end(), Operand(current_input_offset(), SXTW)); | 409 __ Add(x1, input_end(), Operand(current_input_offset(), SXTW)); |
410 // Isolate. | 410 // Isolate. |
411 __ Mov(x3, Operand(ExternalReference::isolate_address(isolate()))); | 411 __ Mov(x3, ExternalReference::isolate_address(isolate())); |
412 | 412 |
413 { | 413 { |
414 AllowExternalCallThatCantCauseGC scope(masm_); | 414 AllowExternalCallThatCantCauseGC scope(masm_); |
415 ExternalReference function = | 415 ExternalReference function = |
416 ExternalReference::re_case_insensitive_compare_uc16(isolate()); | 416 ExternalReference::re_case_insensitive_compare_uc16(isolate()); |
417 __ CallCFunction(function, argument_count); | 417 __ CallCFunction(function, argument_count); |
418 } | 418 } |
419 | 419 |
420 // Check if function returned non-zero for success or zero for failure. | 420 // Check if function returned non-zero for success or zero for failure. |
421 CompareAndBranchOrBacktrack(x0, 0, eq, on_no_match); | 421 CompareAndBranchOrBacktrack(x0, 0, eq, on_no_match); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 BranchOrBacktrack(ne, on_no_match); | 627 BranchOrBacktrack(ne, on_no_match); |
628 } | 628 } |
629 return true; | 629 return true; |
630 } | 630 } |
631 case 'w': { | 631 case 'w': { |
632 if (mode_ != ASCII) { | 632 if (mode_ != ASCII) { |
633 // Table is 128 entries, so all ASCII characters can be tested. | 633 // Table is 128 entries, so all ASCII characters can be tested. |
634 CompareAndBranchOrBacktrack(current_character(), 'z', hi, on_no_match); | 634 CompareAndBranchOrBacktrack(current_character(), 'z', hi, on_no_match); |
635 } | 635 } |
636 ExternalReference map = ExternalReference::re_word_character_map(); | 636 ExternalReference map = ExternalReference::re_word_character_map(); |
637 __ Mov(x10, Operand(map)); | 637 __ Mov(x10, map); |
638 __ Ldrb(w10, MemOperand(x10, current_character(), UXTW)); | 638 __ Ldrb(w10, MemOperand(x10, current_character(), UXTW)); |
639 CompareAndBranchOrBacktrack(w10, 0, eq, on_no_match); | 639 CompareAndBranchOrBacktrack(w10, 0, eq, on_no_match); |
640 return true; | 640 return true; |
641 } | 641 } |
642 case 'W': { | 642 case 'W': { |
643 Label done; | 643 Label done; |
644 if (mode_ != ASCII) { | 644 if (mode_ != ASCII) { |
645 // Table is 128 entries, so all ASCII characters can be tested. | 645 // Table is 128 entries, so all ASCII characters can be tested. |
646 __ Cmp(current_character(), 'z'); | 646 __ Cmp(current_character(), 'z'); |
647 __ B(hi, &done); | 647 __ B(hi, &done); |
648 } | 648 } |
649 ExternalReference map = ExternalReference::re_word_character_map(); | 649 ExternalReference map = ExternalReference::re_word_character_map(); |
650 __ Mov(x10, Operand(map)); | 650 __ Mov(x10, map); |
651 __ Ldrb(w10, MemOperand(x10, current_character(), UXTW)); | 651 __ Ldrb(w10, MemOperand(x10, current_character(), UXTW)); |
652 CompareAndBranchOrBacktrack(w10, 0, ne, on_no_match); | 652 CompareAndBranchOrBacktrack(w10, 0, ne, on_no_match); |
653 __ Bind(&done); | 653 __ Bind(&done); |
654 return true; | 654 return true; |
655 } | 655 } |
656 case '*': | 656 case '*': |
657 // Match any character. | 657 // Match any character. |
658 return true; | 658 return true; |
659 // No custom implementation (yet): s(UC16), S(UC16). | 659 // No custom implementation (yet): s(UC16), S(UC16). |
660 default: | 660 default: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 ASSERT_EQ(alignment % 16, 0); | 729 ASSERT_EQ(alignment % 16, 0); |
730 int align_mask = (alignment / kWRegSize) - 1; | 730 int align_mask = (alignment / kWRegSize) - 1; |
731 num_wreg_to_allocate = (num_wreg_to_allocate + align_mask) & ~align_mask; | 731 num_wreg_to_allocate = (num_wreg_to_allocate + align_mask) & ~align_mask; |
732 | 732 |
733 // Check if we have space on the stack. | 733 // Check if we have space on the stack. |
734 Label stack_limit_hit; | 734 Label stack_limit_hit; |
735 Label stack_ok; | 735 Label stack_ok; |
736 | 736 |
737 ExternalReference stack_limit = | 737 ExternalReference stack_limit = |
738 ExternalReference::address_of_stack_limit(isolate()); | 738 ExternalReference::address_of_stack_limit(isolate()); |
739 __ Mov(x10, Operand(stack_limit)); | 739 __ Mov(x10, stack_limit); |
740 __ Ldr(x10, MemOperand(x10)); | 740 __ Ldr(x10, MemOperand(x10)); |
741 __ Subs(x10, csp, x10); | 741 __ Subs(x10, csp, x10); |
742 | 742 |
743 // Handle it if the stack pointer is already below the stack limit. | 743 // Handle it if the stack pointer is already below the stack limit. |
744 __ B(ls, &stack_limit_hit); | 744 __ B(ls, &stack_limit_hit); |
745 | 745 |
746 // Check if there is room for the variable number of registers above | 746 // Check if there is room for the variable number of registers above |
747 // the stack limit. | 747 // the stack limit. |
748 __ Cmp(x10, num_wreg_to_allocate * kWRegSize); | 748 __ Cmp(x10, num_wreg_to_allocate * kWRegSize); |
749 __ B(hs, &stack_ok); | 749 __ B(hs, &stack_ok); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 RestoreLinkRegister(); | 1024 RestoreLinkRegister(); |
1025 __ Ret(); | 1025 __ Ret(); |
1026 } | 1026 } |
1027 | 1027 |
1028 if (stack_overflow_label_.is_linked()) { | 1028 if (stack_overflow_label_.is_linked()) { |
1029 __ Bind(&stack_overflow_label_); | 1029 __ Bind(&stack_overflow_label_); |
1030 SaveLinkRegister(); | 1030 SaveLinkRegister(); |
1031 // The cached registers need to be retained. | 1031 // The cached registers need to be retained. |
1032 __ PushCPURegList(cached_registers); | 1032 __ PushCPURegList(cached_registers); |
1033 // Call GrowStack(backtrack_stackpointer(), &stack_base) | 1033 // Call GrowStack(backtrack_stackpointer(), &stack_base) |
1034 __ Mov(x2, Operand(ExternalReference::isolate_address(isolate()))); | 1034 __ Mov(x2, ExternalReference::isolate_address(isolate())); |
1035 __ Add(x1, frame_pointer(), kStackBase); | 1035 __ Add(x1, frame_pointer(), kStackBase); |
1036 __ Mov(x0, backtrack_stackpointer()); | 1036 __ Mov(x0, backtrack_stackpointer()); |
1037 ExternalReference grow_stack = | 1037 ExternalReference grow_stack = |
1038 ExternalReference::re_grow_stack(isolate()); | 1038 ExternalReference::re_grow_stack(isolate()); |
1039 __ CallCFunction(grow_stack, 3); | 1039 __ CallCFunction(grow_stack, 3); |
1040 // If return NULL, we have failed to grow the stack, and | 1040 // If return NULL, we have failed to grow the stack, and |
1041 // must exit with a stack-overflow exception. | 1041 // must exit with a stack-overflow exception. |
1042 // Returning from the regexp code restores the stack (csp <- fp) | 1042 // Returning from the regexp code restores the stack (csp <- fp) |
1043 // so we don't need to drop the link register from it before exiting. | 1043 // so we don't need to drop the link register from it before exiting. |
1044 __ Cbz(w0, &exit_with_exception); | 1044 __ Cbz(w0, &exit_with_exception); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 // Code* of self. | 1448 // Code* of self. |
1449 __ Mov(x1, Operand(masm_->CodeObject())); | 1449 __ Mov(x1, Operand(masm_->CodeObject())); |
1450 | 1450 |
1451 // We need to pass a pointer to the return address as first argument. | 1451 // We need to pass a pointer to the return address as first argument. |
1452 // The DirectCEntry stub will place the return address on the stack before | 1452 // The DirectCEntry stub will place the return address on the stack before |
1453 // calling so the stack pointer will point to it. | 1453 // calling so the stack pointer will point to it. |
1454 __ Mov(x0, csp); | 1454 __ Mov(x0, csp); |
1455 | 1455 |
1456 ExternalReference check_stack_guard_state = | 1456 ExternalReference check_stack_guard_state = |
1457 ExternalReference::re_check_stack_guard_state(isolate()); | 1457 ExternalReference::re_check_stack_guard_state(isolate()); |
1458 __ Mov(scratch, Operand(check_stack_guard_state)); | 1458 __ Mov(scratch, check_stack_guard_state); |
1459 DirectCEntryStub stub; | 1459 DirectCEntryStub stub; |
1460 stub.GenerateCall(masm_, scratch); | 1460 stub.GenerateCall(masm_, scratch); |
1461 | 1461 |
1462 // The input string may have been moved in memory, we need to reload it. | 1462 // The input string may have been moved in memory, we need to reload it. |
1463 __ Peek(input_start(), kPointerSize); | 1463 __ Peek(input_start(), kPointerSize); |
1464 __ Peek(input_end(), 2 * kPointerSize); | 1464 __ Peek(input_end(), 2 * kPointerSize); |
1465 | 1465 |
1466 ASSERT(csp.Is(__ StackPointer())); | 1466 ASSERT(csp.Is(__ StackPointer())); |
1467 __ Drop(xreg_to_claim); | 1467 __ Drop(xreg_to_claim); |
1468 | 1468 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 __ Cmp(reg, immediate); | 1512 __ Cmp(reg, immediate); |
1513 BranchOrBacktrack(condition, to); | 1513 BranchOrBacktrack(condition, to); |
1514 } | 1514 } |
1515 } | 1515 } |
1516 | 1516 |
1517 | 1517 |
1518 void RegExpMacroAssemblerA64::CheckPreemption() { | 1518 void RegExpMacroAssemblerA64::CheckPreemption() { |
1519 // Check for preemption. | 1519 // Check for preemption. |
1520 ExternalReference stack_limit = | 1520 ExternalReference stack_limit = |
1521 ExternalReference::address_of_stack_limit(isolate()); | 1521 ExternalReference::address_of_stack_limit(isolate()); |
1522 __ Mov(x10, Operand(stack_limit)); | 1522 __ Mov(x10, stack_limit); |
1523 __ Ldr(x10, MemOperand(x10)); | 1523 __ Ldr(x10, MemOperand(x10)); |
1524 ASSERT(csp.Is(__ StackPointer())); | 1524 ASSERT(csp.Is(__ StackPointer())); |
1525 __ Cmp(csp, x10); | 1525 __ Cmp(csp, x10); |
1526 CallIf(&check_preempt_label_, ls); | 1526 CallIf(&check_preempt_label_, ls); |
1527 } | 1527 } |
1528 | 1528 |
1529 | 1529 |
1530 void RegExpMacroAssemblerA64::CheckStackLimit() { | 1530 void RegExpMacroAssemblerA64::CheckStackLimit() { |
1531 ExternalReference stack_limit = | 1531 ExternalReference stack_limit = |
1532 ExternalReference::address_of_regexp_stack_limit(isolate()); | 1532 ExternalReference::address_of_regexp_stack_limit(isolate()); |
1533 __ Mov(x10, Operand(stack_limit)); | 1533 __ Mov(x10, stack_limit); |
1534 __ Ldr(x10, MemOperand(x10)); | 1534 __ Ldr(x10, MemOperand(x10)); |
1535 __ Cmp(backtrack_stackpointer(), x10); | 1535 __ Cmp(backtrack_stackpointer(), x10); |
1536 CallIf(&stack_overflow_label_, ls); | 1536 CallIf(&stack_overflow_label_, ls); |
1537 } | 1537 } |
1538 | 1538 |
1539 | 1539 |
1540 void RegExpMacroAssemblerA64::Push(Register source) { | 1540 void RegExpMacroAssemblerA64::Push(Register source) { |
1541 ASSERT(source.Is32Bits()); | 1541 ASSERT(source.Is32Bits()); |
1542 ASSERT(!source.is(backtrack_stackpointer())); | 1542 ASSERT(!source.is(backtrack_stackpointer())); |
1543 __ Str(source, | 1543 __ Str(source, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 __ Ldrh(current_character(), MemOperand(input_end(), offset, SXTW)); | 1721 __ Ldrh(current_character(), MemOperand(input_end(), offset, SXTW)); |
1722 } | 1722 } |
1723 } | 1723 } |
1724 } | 1724 } |
1725 | 1725 |
1726 #endif // V8_INTERPRETED_REGEXP | 1726 #endif // V8_INTERPRETED_REGEXP |
1727 | 1727 |
1728 }} // namespace v8::internal | 1728 }} // namespace v8::internal |
1729 | 1729 |
1730 #endif // V8_TARGET_ARCH_A64 | 1730 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |