OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 Generate_InterpreterPushArgs(masm, false); | 803 Generate_InterpreterPushArgs(masm, false); |
804 | 804 |
805 // Push return address in preparation for the tail-call. | 805 // Push return address in preparation for the tail-call. |
806 __ PushReturnAddressFrom(kScratchRegister); | 806 __ PushReturnAddressFrom(kScratchRegister); |
807 | 807 |
808 // Call the constructor (rax, rdx, rdi passed on). | 808 // Call the constructor (rax, rdx, rdi passed on). |
809 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 809 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
810 } | 810 } |
811 | 811 |
812 | 812 |
813 static void Generate_InterpreterNotifyDeoptimizedHelper( | 813 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
814 MacroAssembler* masm, Deoptimizer::BailoutType type) { | |
815 // Enter an internal frame. | |
816 { | |
817 FrameScope scope(masm, StackFrame::INTERNAL); | |
818 __ Push(kInterpreterAccumulatorRegister); // Save accumulator register. | |
819 | |
820 // Pass the deoptimization type to the runtime system. | |
821 __ Push(Smi::FromInt(static_cast<int>(type))); | |
822 | |
823 __ CallRuntime(Runtime::kNotifyDeoptimized); | |
824 | |
825 __ Pop(kInterpreterAccumulatorRegister); // Restore accumulator register. | |
826 // Tear down internal frame. | |
827 } | |
828 | |
829 // Drop state (we don't use these for interpreter deopts) and push PC at top | |
830 // of stack (to simulate initial call to bytecode handler in interpreter entry | |
831 // trampoline). | |
832 __ Pop(rbx); | |
833 __ Drop(1); | |
834 __ Push(rbx); | |
835 | |
836 // Initialize register file register and dispatch table register. | 814 // Initialize register file register and dispatch table register. |
837 __ movp(kInterpreterRegisterFileRegister, rbp); | 815 __ movp(kInterpreterRegisterFileRegister, rbp); |
838 __ addp(kInterpreterRegisterFileRegister, | 816 __ addp(kInterpreterRegisterFileRegister, |
839 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 817 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
840 __ LoadRoot(kInterpreterDispatchTableRegister, | 818 __ LoadRoot(kInterpreterDispatchTableRegister, |
841 Heap::kInterpreterTableRootIndex); | 819 Heap::kInterpreterTableRootIndex); |
842 __ addp(kInterpreterDispatchTableRegister, | 820 __ addp(kInterpreterDispatchTableRegister, |
843 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); | 821 Immediate(FixedArray::kHeaderSize - kHeapObjectTag)); |
844 | 822 |
845 // Get the context from the frame. | 823 // Get the context from the frame. |
(...skipping 30 matching lines...) Expand all Loading... |
876 // Dispatch to the target bytecode. | 854 // Dispatch to the target bytecode. |
877 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, | 855 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister, |
878 kInterpreterBytecodeOffsetRegister, times_1, 0)); | 856 kInterpreterBytecodeOffsetRegister, times_1, 0)); |
879 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, | 857 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, |
880 times_pointer_size, 0)); | 858 times_pointer_size, 0)); |
881 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 859 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
882 __ jmp(rbx); | 860 __ jmp(rbx); |
883 } | 861 } |
884 | 862 |
885 | 863 |
| 864 static void Generate_InterpreterNotifyDeoptimizedHelper( |
| 865 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
| 866 // Enter an internal frame. |
| 867 { |
| 868 FrameScope scope(masm, StackFrame::INTERNAL); |
| 869 __ Push(kInterpreterAccumulatorRegister); // Save accumulator register. |
| 870 |
| 871 // Pass the deoptimization type to the runtime system. |
| 872 __ Push(Smi::FromInt(static_cast<int>(type))); |
| 873 |
| 874 __ CallRuntime(Runtime::kNotifyDeoptimized); |
| 875 |
| 876 __ Pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
| 877 // Tear down internal frame. |
| 878 } |
| 879 |
| 880 // Drop state (we don't use these for interpreter deopts) and push PC at top |
| 881 // of stack (to simulate initial call to bytecode handler in interpreter entry |
| 882 // trampoline). |
| 883 __ Pop(rbx); |
| 884 __ Drop(1); |
| 885 __ Push(rbx); |
| 886 |
| 887 // Enter the bytecode dispatch. |
| 888 Generate_EnterBytecodeDispatch(masm); |
| 889 } |
| 890 |
| 891 |
886 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { | 892 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
887 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 893 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
888 } | 894 } |
889 | 895 |
890 | 896 |
891 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { | 897 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
892 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 898 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
893 } | 899 } |
894 | 900 |
895 | 901 |
896 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { | 902 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
897 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 903 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
898 } | 904 } |
899 | 905 |
900 | 906 |
| 907 void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) { |
| 908 Generate_EnterBytecodeDispatch(masm); |
| 909 } |
| 910 |
| 911 |
901 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 912 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
902 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 913 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
903 GenerateTailCallToReturnedCode(masm); | 914 GenerateTailCallToReturnedCode(masm); |
904 } | 915 } |
905 | 916 |
906 | 917 |
907 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 918 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
908 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 919 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
909 GenerateTailCallToReturnedCode(masm); | 920 GenerateTailCallToReturnedCode(masm); |
910 } | 921 } |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 __ ret(0); | 2615 __ ret(0); |
2605 } | 2616 } |
2606 | 2617 |
2607 | 2618 |
2608 #undef __ | 2619 #undef __ |
2609 | 2620 |
2610 } // namespace internal | 2621 } // namespace internal |
2611 } // namespace v8 | 2622 } // namespace v8 |
2612 | 2623 |
2613 #endif // V8_TARGET_ARCH_X64 | 2624 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |