OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 // Args 3 and 4 are already in the right registers. | 647 // Args 3 and 4 are already in the right registers. |
648 | 648 |
649 // On windows put the argument on the stack (PrepareCallCFunction have | 649 // On windows put the argument on the stack (PrepareCallCFunction have |
650 // created space for this). On linux pass the argument in r8. | 650 // created space for this). On linux pass the argument in r8. |
651 #ifdef _WIN64 | 651 #ifdef _WIN64 |
652 __ movq(Operand(rsp, 4 * kPointerSize), arg5); | 652 __ movq(Operand(rsp, 4 * kPointerSize), arg5); |
653 #else | 653 #else |
654 __ movq(r8, arg5); | 654 __ movq(r8, arg5); |
655 #endif | 655 #endif |
656 | 656 |
657 __ CallCFunction(ExternalReference::new_deoptimizer_function(), 5); | 657 Isolate* isolate = masm()->isolate(); |
| 658 |
| 659 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 5); |
658 // Preserve deoptimizer object in register rax and get the input | 660 // Preserve deoptimizer object in register rax and get the input |
659 // frame descriptor pointer. | 661 // frame descriptor pointer. |
660 __ movq(rbx, Operand(rax, Deoptimizer::input_offset())); | 662 __ movq(rbx, Operand(rax, Deoptimizer::input_offset())); |
661 | 663 |
662 // Fill in the input registers. | 664 // Fill in the input registers. |
663 for (int i = kNumberOfRegisters -1; i >= 0; i--) { | 665 for (int i = kNumberOfRegisters -1; i >= 0; i--) { |
664 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 666 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
665 __ pop(Operand(rbx, offset)); | 667 __ pop(Operand(rbx, offset)); |
666 } | 668 } |
667 | 669 |
(...skipping 24 matching lines...) Expand all Loading... |
692 __ bind(&pop_loop); | 694 __ bind(&pop_loop); |
693 __ pop(Operand(rdx, 0)); | 695 __ pop(Operand(rdx, 0)); |
694 __ addq(rdx, Immediate(sizeof(intptr_t))); | 696 __ addq(rdx, Immediate(sizeof(intptr_t))); |
695 __ cmpq(rcx, rsp); | 697 __ cmpq(rcx, rsp); |
696 __ j(not_equal, &pop_loop); | 698 __ j(not_equal, &pop_loop); |
697 | 699 |
698 // Compute the output frame in the deoptimizer. | 700 // Compute the output frame in the deoptimizer. |
699 __ push(rax); | 701 __ push(rax); |
700 __ PrepareCallCFunction(1); | 702 __ PrepareCallCFunction(1); |
701 __ movq(arg1, rax); | 703 __ movq(arg1, rax); |
702 __ CallCFunction(ExternalReference::compute_output_frames_function(), 1); | 704 __ CallCFunction( |
| 705 ExternalReference::compute_output_frames_function(isolate), 1); |
703 __ pop(rax); | 706 __ pop(rax); |
704 | 707 |
705 // Replace the current frame with the output frames. | 708 // Replace the current frame with the output frames. |
706 Label outer_push_loop, inner_push_loop; | 709 Label outer_push_loop, inner_push_loop; |
707 // Outer loop state: rax = current FrameDescription**, rdx = one past the | 710 // Outer loop state: rax = current FrameDescription**, rdx = one past the |
708 // last FrameDescription**. | 711 // last FrameDescription**. |
709 __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset())); | 712 __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset())); |
710 __ movq(rax, Operand(rax, Deoptimizer::output_offset())); | 713 __ movq(rax, Operand(rax, Deoptimizer::output_offset())); |
711 __ lea(rdx, Operand(rax, rdx, times_8, 0)); | 714 __ lea(rdx, Operand(rax, rdx, times_8, 0)); |
712 __ bind(&outer_push_loop); | 715 __ bind(&outer_push_loop); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 // Do not restore rsp, simply pop the value into the next register | 753 // Do not restore rsp, simply pop the value into the next register |
751 // and overwrite this afterwards. | 754 // and overwrite this afterwards. |
752 if (r.is(rsp)) { | 755 if (r.is(rsp)) { |
753 ASSERT(i > 0); | 756 ASSERT(i > 0); |
754 r = Register::toRegister(i - 1); | 757 r = Register::toRegister(i - 1); |
755 } | 758 } |
756 __ pop(r); | 759 __ pop(r); |
757 } | 760 } |
758 | 761 |
759 // Set up the roots register. | 762 // Set up the roots register. |
760 ExternalReference roots_address = ExternalReference::roots_address(); | 763 ExternalReference roots_address = ExternalReference::roots_address(isolate); |
761 __ InitializeRootRegister(); | 764 __ InitializeRootRegister(); |
762 __ InitializeSmiConstantRegister(); | 765 __ InitializeSmiConstantRegister(); |
763 | 766 |
764 // Return to the continuation point. | 767 // Return to the continuation point. |
765 __ ret(0); | 768 __ ret(0); |
766 } | 769 } |
767 | 770 |
768 | 771 |
769 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | 772 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { |
770 // Create a sequence of deoptimization entries. | 773 // Create a sequence of deoptimization entries. |
771 Label done; | 774 Label done; |
772 for (int i = 0; i < count(); i++) { | 775 for (int i = 0; i < count(); i++) { |
773 int start = masm()->pc_offset(); | 776 int start = masm()->pc_offset(); |
774 USE(start); | 777 USE(start); |
775 __ push_imm32(i); | 778 __ push_imm32(i); |
776 __ jmp(&done); | 779 __ jmp(&done); |
777 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 780 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
778 } | 781 } |
779 __ bind(&done); | 782 __ bind(&done); |
780 } | 783 } |
781 | 784 |
782 #undef __ | 785 #undef __ |
783 | 786 |
784 | 787 |
785 } } // namespace v8::internal | 788 } } // namespace v8::internal |
786 | 789 |
787 #endif // V8_TARGET_ARCH_X64 | 790 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |