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 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 | 2757 |
2758 // Isolates: note we add an additional parameter here (isolate pointer). | 2758 // Isolates: note we add an additional parameter here (isolate pointer). |
2759 static const int kRegExpExecuteArguments = 9; | 2759 static const int kRegExpExecuteArguments = 9; |
2760 int argument_slots_on_stack = | 2760 int argument_slots_on_stack = |
2761 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments); | 2761 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments); |
2762 __ EnterApiExitFrame(argument_slots_on_stack); | 2762 __ EnterApiExitFrame(argument_slots_on_stack); |
2763 | 2763 |
2764 // Argument 9: Pass current isolate address. | 2764 // Argument 9: Pass current isolate address. |
2765 __ LoadAddress(kScratchRegister, | 2765 __ LoadAddress(kScratchRegister, |
2766 ExternalReference::isolate_address(masm->isolate())); | 2766 ExternalReference::isolate_address(masm->isolate())); |
2767 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize), | 2767 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kRegisterSize), |
2768 kScratchRegister); | 2768 kScratchRegister); |
2769 | 2769 |
2770 // Argument 8: Indicate that this is a direct call from JavaScript. | 2770 // Argument 8: Indicate that this is a direct call from JavaScript. |
2771 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kPointerSize), | 2771 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kRegisterSize), |
2772 Immediate(1)); | 2772 Immediate(1)); |
2773 | 2773 |
2774 // Argument 7: Start (high end) of backtracking stack memory area. | 2774 // Argument 7: Start (high end) of backtracking stack memory area. |
2775 __ movq(kScratchRegister, address_of_regexp_stack_memory_address); | 2775 __ movq(kScratchRegister, address_of_regexp_stack_memory_address); |
2776 __ movq(r9, Operand(kScratchRegister, 0)); | 2776 __ movq(r9, Operand(kScratchRegister, 0)); |
2777 __ movq(kScratchRegister, address_of_regexp_stack_memory_size); | 2777 __ movq(kScratchRegister, address_of_regexp_stack_memory_size); |
2778 __ addq(r9, Operand(kScratchRegister, 0)); | 2778 __ addq(r9, Operand(kScratchRegister, 0)); |
2779 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kPointerSize), r9); | 2779 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kRegisterSize), r9); |
2780 | 2780 |
2781 // Argument 6: Set the number of capture registers to zero to force global | 2781 // Argument 6: Set the number of capture registers to zero to force global |
2782 // regexps to behave as non-global. This does not affect non-global regexps. | 2782 // regexps to behave as non-global. This does not affect non-global regexps. |
2783 // Argument 6 is passed in r9 on Linux and on the stack on Windows. | 2783 // Argument 6 is passed in r9 on Linux and on the stack on Windows. |
2784 #ifdef _WIN64 | 2784 #ifdef _WIN64 |
2785 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize), | 2785 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kRegisterSize), |
2786 Immediate(0)); | 2786 Immediate(0)); |
2787 #else | 2787 #else |
2788 __ Set(r9, 0); | 2788 __ Set(r9, 0); |
2789 #endif | 2789 #endif |
2790 | 2790 |
2791 // Argument 5: static offsets vector buffer. | 2791 // Argument 5: static offsets vector buffer. |
2792 __ LoadAddress(r8, | 2792 __ LoadAddress(r8, |
2793 ExternalReference::address_of_static_offsets_vector(isolate)); | 2793 ExternalReference::address_of_static_offsets_vector(isolate)); |
2794 // Argument 5 passed in r8 on Linux and on the stack on Windows. | 2794 // Argument 5 passed in r8 on Linux and on the stack on Windows. |
2795 #ifdef _WIN64 | 2795 #ifdef _WIN64 |
2796 __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kPointerSize), r8); | 2796 __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kRegisterSize), r8); |
2797 #endif | 2797 #endif |
2798 | 2798 |
2799 // rdi: subject string | 2799 // rdi: subject string |
2800 // rbx: previous index | 2800 // rbx: previous index |
2801 // rcx: encoding of subject string (1 if ASCII 0 if two_byte); | 2801 // rcx: encoding of subject string (1 if ASCII 0 if two_byte); |
2802 // r11: code | 2802 // r11: code |
2803 // r14: slice offset | 2803 // r14: slice offset |
2804 // r15: original subject string | 2804 // r15: original subject string |
2805 | 2805 |
2806 // Argument 2: Previous index. | 2806 // Argument 2: Previous index. |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3871 // Check for failure result. | 3871 // Check for failure result. |
3872 Label failure_returned; | 3872 Label failure_returned; |
3873 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 3873 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
3874 #ifdef _WIN64 | 3874 #ifdef _WIN64 |
3875 // If return value is on the stack, pop it to registers. | 3875 // If return value is on the stack, pop it to registers. |
3876 if (result_size_ > 1) { | 3876 if (result_size_ > 1) { |
3877 ASSERT_EQ(2, result_size_); | 3877 ASSERT_EQ(2, result_size_); |
3878 // Read result values stored on stack. Result is stored | 3878 // Read result values stored on stack. Result is stored |
3879 // above the four argument mirror slots and the two | 3879 // above the four argument mirror slots and the two |
3880 // Arguments object slots. | 3880 // Arguments object slots. |
3881 __ movq(rax, Operand(rsp, 6 * kPointerSize)); | 3881 __ movq(rax, Operand(rsp, 6 * kRegisterSize)); |
3882 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); | 3882 __ movq(rdx, Operand(rsp, 7 * kRegisterSize)); |
3883 } | 3883 } |
3884 #endif | 3884 #endif |
3885 __ lea(rcx, Operand(rax, 1)); | 3885 __ lea(rcx, Operand(rax, 1)); |
3886 // Lower 2 bits of rcx are 0 iff rax has failure tag. | 3886 // Lower 2 bits of rcx are 0 iff rax has failure tag. |
3887 __ testl(rcx, Immediate(kFailureTagMask)); | 3887 __ testl(rcx, Immediate(kFailureTagMask)); |
3888 __ j(zero, &failure_returned); | 3888 __ j(zero, &failure_returned); |
3889 | 3889 |
3890 // Exit the JavaScript to C++ exit frame. | 3890 // Exit the JavaScript to C++ exit frame. |
3891 __ LeaveExitFrame(save_doubles_); | 3891 __ LeaveExitFrame(save_doubles_); |
3892 __ ret(0); | 3892 __ ret(0); |
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6489 | 6489 |
6490 | 6490 |
6491 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 6491 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
6492 // This stub can be called from essentially anywhere, so it needs to save | 6492 // This stub can be called from essentially anywhere, so it needs to save |
6493 // all volatile and callee-save registers. | 6493 // all volatile and callee-save registers. |
6494 const size_t kNumSavedRegisters = 2; | 6494 const size_t kNumSavedRegisters = 2; |
6495 __ push(arg_reg_1); | 6495 __ push(arg_reg_1); |
6496 __ push(arg_reg_2); | 6496 __ push(arg_reg_2); |
6497 | 6497 |
6498 // Calculate the original stack pointer and store it in the second arg. | 6498 // Calculate the original stack pointer and store it in the second arg. |
6499 __ lea(arg_reg_2, Operand(rsp, (kNumSavedRegisters + 1) * kPointerSize)); | 6499 __ lea(arg_reg_2, Operand(rsp, (kNumSavedRegisters + 1) * kRegisterSize)); |
6500 | 6500 |
6501 // Calculate the function address to the first arg. | 6501 // Calculate the function address to the first arg. |
6502 __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kPointerSize)); | 6502 __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kRegisterSize)); |
6503 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength)); | 6503 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength)); |
6504 | 6504 |
6505 // Save the remainder of the volatile registers. | 6505 // Save the remainder of the volatile registers. |
6506 masm->PushCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2); | 6506 masm->PushCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2); |
6507 | 6507 |
6508 // Call the entry hook function. | 6508 // Call the entry hook function. |
6509 __ movq(rax, FUNCTION_ADDR(masm->isolate()->function_entry_hook()), | 6509 __ movq(rax, FUNCTION_ADDR(masm->isolate()->function_entry_hook()), |
6510 RelocInfo::NONE64); | 6510 RelocInfo::NONE64); |
6511 | 6511 |
6512 AllowExternalCallThatCantCauseGC scope(masm); | 6512 AllowExternalCallThatCantCauseGC scope(masm); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6816 __ bind(&fast_elements_case); | 6816 __ bind(&fast_elements_case); |
6817 GenerateCase(masm, FAST_ELEMENTS); | 6817 GenerateCase(masm, FAST_ELEMENTS); |
6818 } | 6818 } |
6819 | 6819 |
6820 | 6820 |
6821 #undef __ | 6821 #undef __ |
6822 | 6822 |
6823 } } // namespace v8::internal | 6823 } } // namespace v8::internal |
6824 | 6824 |
6825 #endif // V8_TARGET_ARCH_X64 | 6825 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |