| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // We push all registers onto the stack, even though we do not need | 602 // We push all registers onto the stack, even though we do not need |
| 603 // to restore all later. | 603 // to restore all later. |
| 604 for (int i = 0; i < kNumberOfRegisters; i++) { | 604 for (int i = 0; i < kNumberOfRegisters; i++) { |
| 605 Register r = Register::from_code(i); | 605 Register r = Register::from_code(i); |
| 606 __ push(r); | 606 __ push(r); |
| 607 } | 607 } |
| 608 | 608 |
| 609 const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize + | 609 const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize + |
| 610 kDoubleRegsSize; | 610 kDoubleRegsSize; |
| 611 | 611 |
| 612 // When calling new_deoptimizer_function we need to pass the last argument | |
| 613 // on the stack on windows and in r8 on linux. The remaining arguments are | |
| 614 // all passed in registers (different ones on linux and windows though). | |
| 615 | |
| 616 #ifdef _WIN64 | |
| 617 Register arg4 = r9; | |
| 618 Register arg3 = r8; | |
| 619 Register arg2 = rdx; | |
| 620 Register arg1 = rcx; | |
| 621 #else | |
| 622 Register arg4 = rcx; | |
| 623 Register arg3 = rdx; | |
| 624 Register arg2 = rsi; | |
| 625 Register arg1 = rdi; | |
| 626 #endif | |
| 627 | |
| 628 // We use this to keep the value of the fifth argument temporarily. | 612 // We use this to keep the value of the fifth argument temporarily. |
| 629 // Unfortunately we can't store it directly in r8 (used for passing | 613 // Unfortunately we can't store it directly in r8 (used for passing |
| 630 // this on linux), since it is another parameter passing register on windows. | 614 // this on linux), since it is another parameter passing register on windows. |
| 631 Register arg5 = r11; | 615 Register arg5 = r11; |
| 632 | 616 |
| 633 // Get the bailout id from the stack. | 617 // Get the bailout id from the stack. |
| 634 __ movq(arg3, Operand(rsp, kSavedRegistersAreaSize)); | 618 __ movq(arg_reg_3, Operand(rsp, kSavedRegistersAreaSize)); |
| 635 | 619 |
| 636 // Get the address of the location in the code object if possible | 620 // Get the address of the location in the code object if possible |
| 637 // and compute the fp-to-sp delta in register arg5. | 621 // and compute the fp-to-sp delta in register arg5. |
| 638 if (type() == EAGER) { | 622 if (type() == EAGER) { |
| 639 __ Set(arg4, 0); | 623 __ Set(arg_reg_4, 0); |
| 640 __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize)); | 624 __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize)); |
| 641 } else { | 625 } else { |
| 642 __ movq(arg4, Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize)); | 626 __ movq(arg_reg_4, |
| 627 Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize)); |
| 643 __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 2 * kPointerSize)); | 628 __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 2 * kPointerSize)); |
| 644 } | 629 } |
| 645 | 630 |
| 646 __ subq(arg5, rbp); | 631 __ subq(arg5, rbp); |
| 647 __ neg(arg5); | 632 __ neg(arg5); |
| 648 | 633 |
| 649 // Allocate a new deoptimizer object. | 634 // Allocate a new deoptimizer object. |
| 650 __ PrepareCallCFunction(6); | 635 __ PrepareCallCFunction(6); |
| 651 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 636 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 652 __ movq(arg1, rax); | 637 __ movq(arg_reg_1, rax); |
| 653 __ Set(arg2, type()); | 638 __ Set(arg_reg_2, type()); |
| 654 // Args 3 and 4 are already in the right registers. | 639 // Args 3 and 4 are already in the right registers. |
| 655 | 640 |
| 656 // On windows put the arguments on the stack (PrepareCallCFunction | 641 // On windows put the arguments on the stack (PrepareCallCFunction |
| 657 // has created space for this). On linux pass the arguments in r8 and r9. | 642 // has created space for this). On linux pass the arguments in r8 and r9. |
| 658 #ifdef _WIN64 | 643 #ifdef _WIN64 |
| 659 __ movq(Operand(rsp, 4 * kPointerSize), arg5); | 644 __ movq(Operand(rsp, 4 * kPointerSize), arg5); |
| 660 __ LoadAddress(arg5, ExternalReference::isolate_address(isolate())); | 645 __ LoadAddress(arg5, ExternalReference::isolate_address(isolate())); |
| 661 __ movq(Operand(rsp, 5 * kPointerSize), arg5); | 646 __ movq(Operand(rsp, 5 * kPointerSize), arg5); |
| 662 #else | 647 #else |
| 663 __ movq(r8, arg5); | 648 __ movq(r8, arg5); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 __ bind(&pop_loop); | 691 __ bind(&pop_loop); |
| 707 __ pop(Operand(rdx, 0)); | 692 __ pop(Operand(rdx, 0)); |
| 708 __ addq(rdx, Immediate(sizeof(intptr_t))); | 693 __ addq(rdx, Immediate(sizeof(intptr_t))); |
| 709 __ bind(&pop_loop_header); | 694 __ bind(&pop_loop_header); |
| 710 __ cmpq(rcx, rsp); | 695 __ cmpq(rcx, rsp); |
| 711 __ j(not_equal, &pop_loop); | 696 __ j(not_equal, &pop_loop); |
| 712 | 697 |
| 713 // Compute the output frame in the deoptimizer. | 698 // Compute the output frame in the deoptimizer. |
| 714 __ push(rax); | 699 __ push(rax); |
| 715 __ PrepareCallCFunction(2); | 700 __ PrepareCallCFunction(2); |
| 716 __ movq(arg1, rax); | 701 __ movq(arg_reg_1, rax); |
| 717 __ LoadAddress(arg2, ExternalReference::isolate_address(isolate())); | 702 __ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate())); |
| 718 { | 703 { |
| 719 AllowExternalCallThatCantCauseGC scope(masm()); | 704 AllowExternalCallThatCantCauseGC scope(masm()); |
| 720 __ CallCFunction( | 705 __ CallCFunction( |
| 721 ExternalReference::compute_output_frames_function(isolate()), 2); | 706 ExternalReference::compute_output_frames_function(isolate()), 2); |
| 722 } | 707 } |
| 723 __ pop(rax); | 708 __ pop(rax); |
| 724 | 709 |
| 725 // Replace the current frame with the output frames. | 710 // Replace the current frame with the output frames. |
| 726 Label outer_push_loop, inner_push_loop, | 711 Label outer_push_loop, inner_push_loop, |
| 727 outer_loop_header, inner_loop_header; | 712 outer_loop_header, inner_loop_header; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 784 } |
| 800 __ bind(&done); | 785 __ bind(&done); |
| 801 } | 786 } |
| 802 | 787 |
| 803 #undef __ | 788 #undef __ |
| 804 | 789 |
| 805 | 790 |
| 806 } } // namespace v8::internal | 791 } } // namespace v8::internal |
| 807 | 792 |
| 808 #endif // V8_TARGET_ARCH_X64 | 793 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |