| OLD | NEW |
| 1 // Copyright 2012 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 |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 __ push(rsi); | 796 __ push(rsi); |
| 797 __ push(rdx); | 797 __ push(rdx); |
| 798 __ push(rcx); | 798 __ push(rcx); |
| 799 __ push(r8); | 799 __ push(r8); |
| 800 __ push(r9); | 800 __ push(r9); |
| 801 | 801 |
| 802 __ push(rbx); // Callee-save | 802 __ push(rbx); // Callee-save |
| 803 #endif | 803 #endif |
| 804 | 804 |
| 805 __ push(Immediate(0)); // Number of successful matches in a global regexp. | 805 __ push(Immediate(0)); // Number of successful matches in a global regexp. |
| 806 __ push(Immediate(0)); // Make room for "at start" constant. | 806 __ push(Immediate(0)); // Make room for "input start - 1" constant. |
| 807 | 807 |
| 808 // Check if we have space on the stack for registers. | 808 // Check if we have space on the stack for registers. |
| 809 Label stack_limit_hit; | 809 Label stack_limit_hit; |
| 810 Label stack_ok; | 810 Label stack_ok; |
| 811 | 811 |
| 812 ExternalReference stack_limit = | 812 ExternalReference stack_limit = |
| 813 ExternalReference::address_of_stack_limit(masm_.isolate()); | 813 ExternalReference::address_of_stack_limit(masm_.isolate()); |
| 814 __ movq(rcx, rsp); | 814 __ movq(rcx, rsp); |
| 815 __ movq(kScratchRegister, stack_limit); | 815 __ movq(kScratchRegister, stack_limit); |
| 816 __ subq(rcx, Operand(kScratchRegister, 0)); | 816 __ subq(rcx, Operand(kScratchRegister, 0)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 i += kRegistersPerPage) { | 865 i += kRegistersPerPage) { |
| 866 __ movq(register_location(i), rax); // One write every page. | 866 __ movq(register_location(i), rax); // One write every page. |
| 867 } | 867 } |
| 868 #endif // WIN32 | 868 #endif // WIN32 |
| 869 | 869 |
| 870 // Initialize code object pointer. | 870 // Initialize code object pointer. |
| 871 __ Move(code_object_pointer(), masm_.CodeObject()); | 871 __ Move(code_object_pointer(), masm_.CodeObject()); |
| 872 | 872 |
| 873 Label load_char_start_regexp, start_regexp; | 873 Label load_char_start_regexp, start_regexp; |
| 874 // Load newline if index is at start, previous character otherwise. | 874 // Load newline if index is at start, previous character otherwise. |
| 875 __ cmpb(Operand(rbp, kStartIndex), Immediate(0)); | 875 __ cmpl(Operand(rbp, kStartIndex), Immediate(0)); |
| 876 __ j(not_equal, &load_char_start_regexp, Label::kNear); | 876 __ j(not_equal, &load_char_start_regexp, Label::kNear); |
| 877 __ Set(current_character(), '\n'); | 877 __ Set(current_character(), '\n'); |
| 878 __ jmp(&start_regexp, Label::kNear); | 878 __ jmp(&start_regexp, Label::kNear); |
| 879 | 879 |
| 880 // Global regexp restarts matching here. | 880 // Global regexp restarts matching here. |
| 881 __ bind(&load_char_start_regexp); | 881 __ bind(&load_char_start_regexp); |
| 882 // Load previous char as initial value of current character register. | 882 // Load previous char as initial value of current character register. |
| 883 LoadCurrentCharacterUnchecked(-1, 1); | 883 LoadCurrentCharacterUnchecked(-1, 1); |
| 884 __ bind(&start_regexp); | 884 __ bind(&start_regexp); |
| 885 | 885 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 __ movl(Operand(rbx, i * kIntSize), rax); | 937 __ movl(Operand(rbx, i * kIntSize), rax); |
| 938 } | 938 } |
| 939 } | 939 } |
| 940 | 940 |
| 941 if (global()) { | 941 if (global()) { |
| 942 // Restart matching if the regular expression is flagged as global. | 942 // Restart matching if the regular expression is flagged as global. |
| 943 // Increment success counter. | 943 // Increment success counter. |
| 944 __ incq(Operand(rbp, kSuccessfulCaptures)); | 944 __ incq(Operand(rbp, kSuccessfulCaptures)); |
| 945 // Capture results have been stored, so the number of remaining global | 945 // Capture results have been stored, so the number of remaining global |
| 946 // output registers is reduced by the number of stored captures. | 946 // output registers is reduced by the number of stored captures. |
| 947 __ movq(rcx, Operand(rbp, kNumOutputRegisters)); | 947 __ movsxlq(rcx, Operand(rbp, kNumOutputRegisters)); |
| 948 __ subq(rcx, Immediate(num_saved_registers_)); | 948 __ subq(rcx, Immediate(num_saved_registers_)); |
| 949 // Check whether we have enough room for another set of capture results. | 949 // Check whether we have enough room for another set of capture results. |
| 950 __ cmpq(rcx, Immediate(num_saved_registers_)); | 950 __ cmpq(rcx, Immediate(num_saved_registers_)); |
| 951 __ j(less, &exit_label_); | 951 __ j(less, &exit_label_); |
| 952 | 952 |
| 953 __ movq(Operand(rbp, kNumOutputRegisters), rcx); | 953 __ movq(Operand(rbp, kNumOutputRegisters), rcx); |
| 954 // Advance the location for output. | 954 // Advance the location for output. |
| 955 __ addq(Operand(rbp, kRegisterOutput), | 955 __ addq(Operand(rbp, kRegisterOutput), |
| 956 Immediate(num_saved_registers_ * kIntSize)); | 956 Immediate(num_saved_registers_ * kIntSize)); |
| 957 | 957 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 } | 1531 } |
| 1532 } | 1532 } |
| 1533 | 1533 |
| 1534 #undef __ | 1534 #undef __ |
| 1535 | 1535 |
| 1536 #endif // V8_INTERPRETED_REGEXP | 1536 #endif // V8_INTERPRETED_REGEXP |
| 1537 | 1537 |
| 1538 }} // namespace v8::internal | 1538 }} // namespace v8::internal |
| 1539 | 1539 |
| 1540 #endif // V8_TARGET_ARCH_X64 | 1540 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |