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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 output_frame->SetDoubleRegister(i, double_value); | 709 output_frame->SetDoubleRegister(i, double_value); |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 | 713 |
714 #define __ masm()-> | 714 #define __ masm()-> |
715 | 715 |
716 void Deoptimizer::EntryGenerator::Generate() { | 716 void Deoptimizer::EntryGenerator::Generate() { |
717 GeneratePrologue(); | 717 GeneratePrologue(); |
718 | 718 |
719 Isolate* isolate = masm()->isolate(); | |
720 | |
721 // Save all general purpose registers before messing with them. | 719 // Save all general purpose registers before messing with them. |
722 const int kNumberOfRegisters = Register::kNumRegisters; | 720 const int kNumberOfRegisters = Register::kNumRegisters; |
723 | 721 |
724 const int kDoubleRegsSize = kDoubleSize * | 722 const int kDoubleRegsSize = kDoubleSize * |
725 XMMRegister::kNumAllocatableRegisters; | 723 XMMRegister::kNumAllocatableRegisters; |
726 __ sub(esp, Immediate(kDoubleRegsSize)); | 724 __ sub(esp, Immediate(kDoubleRegsSize)); |
727 if (CpuFeatures::IsSupported(SSE2)) { | 725 if (CpuFeatures::IsSupported(SSE2)) { |
728 CpuFeatureScope scope(masm(), SSE2); | 726 CpuFeatureScope scope(masm(), SSE2); |
729 for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) { | 727 for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) { |
730 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i); | 728 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i); |
(...skipping 24 matching lines...) Expand all Loading... |
755 | 753 |
756 // Allocate a new deoptimizer object. | 754 // Allocate a new deoptimizer object. |
757 __ PrepareCallCFunction(6, eax); | 755 __ PrepareCallCFunction(6, eax); |
758 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 756 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
759 __ mov(Operand(esp, 0 * kPointerSize), eax); // Function. | 757 __ mov(Operand(esp, 0 * kPointerSize), eax); // Function. |
760 __ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type. | 758 __ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type. |
761 __ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id. | 759 __ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id. |
762 __ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. | 760 __ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. |
763 __ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. | 761 __ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. |
764 __ mov(Operand(esp, 5 * kPointerSize), | 762 __ mov(Operand(esp, 5 * kPointerSize), |
765 Immediate(ExternalReference::isolate_address())); | 763 Immediate(ExternalReference::isolate_address(isolate()))); |
766 { | 764 { |
767 AllowExternalCallThatCantCauseGC scope(masm()); | 765 AllowExternalCallThatCantCauseGC scope(masm()); |
768 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6); | 766 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6); |
769 } | 767 } |
770 | 768 |
771 // Preserve deoptimizer object in register eax and get the input | 769 // Preserve deoptimizer object in register eax and get the input |
772 // frame descriptor pointer. | 770 // frame descriptor pointer. |
773 __ mov(ebx, Operand(eax, Deoptimizer::input_offset())); | 771 __ mov(ebx, Operand(eax, Deoptimizer::input_offset())); |
774 | 772 |
775 // Fill in the input registers. | 773 // Fill in the input registers. |
776 for (int i = kNumberOfRegisters - 1; i >= 0; i--) { | 774 for (int i = kNumberOfRegisters - 1; i >= 0; i--) { |
777 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 775 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
778 __ pop(Operand(ebx, offset)); | 776 __ pop(Operand(ebx, offset)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 __ cmp(ecx, esp); | 819 __ cmp(ecx, esp); |
822 __ j(not_equal, &pop_loop); | 820 __ j(not_equal, &pop_loop); |
823 | 821 |
824 // Compute the output frame in the deoptimizer. | 822 // Compute the output frame in the deoptimizer. |
825 __ push(eax); | 823 __ push(eax); |
826 __ PrepareCallCFunction(1, ebx); | 824 __ PrepareCallCFunction(1, ebx); |
827 __ mov(Operand(esp, 0 * kPointerSize), eax); | 825 __ mov(Operand(esp, 0 * kPointerSize), eax); |
828 { | 826 { |
829 AllowExternalCallThatCantCauseGC scope(masm()); | 827 AllowExternalCallThatCantCauseGC scope(masm()); |
830 __ CallCFunction( | 828 __ CallCFunction( |
831 ExternalReference::compute_output_frames_function(isolate), 1); | 829 ExternalReference::compute_output_frames_function(isolate()), 1); |
832 } | 830 } |
833 __ pop(eax); | 831 __ pop(eax); |
834 | 832 |
835 if (type() != OSR) { | 833 if (type() != OSR) { |
836 // If frame was dynamically aligned, pop padding. | 834 // If frame was dynamically aligned, pop padding. |
837 Label no_padding; | 835 Label no_padding; |
838 __ cmp(Operand(eax, Deoptimizer::has_alignment_padding_offset()), | 836 __ cmp(Operand(eax, Deoptimizer::has_alignment_padding_offset()), |
839 Immediate(0)); | 837 Immediate(0)); |
840 __ j(equal, &no_padding); | 838 __ j(equal, &no_padding); |
841 __ pop(ecx); | 839 __ pop(ecx); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 } | 921 } |
924 __ bind(&done); | 922 __ bind(&done); |
925 } | 923 } |
926 | 924 |
927 #undef __ | 925 #undef __ |
928 | 926 |
929 | 927 |
930 } } // namespace v8::internal | 928 } } // namespace v8::internal |
931 | 929 |
932 #endif // V8_TARGET_ARCH_IA32 | 930 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |