Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1528913003: [Interpreter] Add basic deoptimization support from TurboFan to Ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_deopt_1
Patch Set: Add MIPS port and fix comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 Generate_InterpreterPushArgs(masm, false); 777 Generate_InterpreterPushArgs(masm, false);
778 778
779 // Push return address in preparation for the tail-call. 779 // Push return address in preparation for the tail-call.
780 __ PushReturnAddressFrom(kScratchRegister); 780 __ PushReturnAddressFrom(kScratchRegister);
781 781
782 // Call the constructor (rax, rdx, rdi passed on). 782 // Call the constructor (rax, rdx, rdi passed on).
783 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 783 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
784 } 784 }
785 785
786 786
787 static void Generate_InterpreterNotifyDeoptimizedHelper(
788 MacroAssembler* masm, Deoptimizer::BailoutType type) {
789 // Enter an internal frame.
790 {
791 FrameScope scope(masm, StackFrame::INTERNAL);
792 __ Push(kInterpreterAccumulatorRegister); // Save accumulator register.
793
794 // Pass the deoptimization type to the runtime system.
795 __ Push(Smi::FromInt(static_cast<int>(type)));
796
797 __ CallRuntime(Runtime::kNotifyDeoptimized, 1);
798
799 __ Pop(kInterpreterAccumulatorRegister); // Restore accumulator register.
800 // Tear down internal frame.
801 }
802
803 // Drop state (we don't use these for interpreter deopts) and push PC at top
804 // of stack (to simulate initial call to bytecode handler in interpreter entry
805 // trampoline).
806 __ Pop(rbx);
807 __ Drop(1);
808 __ Push(rbx);
809
810 // Initialize register file register and dispatch table register.
811 __ movp(kInterpreterRegisterFileRegister, rbp);
812 __ addp(kInterpreterRegisterFileRegister,
813 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
814 __ LoadRoot(kInterpreterDispatchTableRegister,
815 Heap::kInterpreterTableRootIndex);
816 __ addp(kInterpreterDispatchTableRegister,
817 Immediate(FixedArray::kHeaderSize - kHeapObjectTag));
818
819 // Get the context from the frame.
820 // TODO(rmcilroy): Update interpreter frame to expect current context at the
821 // context slot instead of the function context.
822 __ movp(kContextRegister,
823 Operand(kInterpreterRegisterFileRegister,
824 InterpreterFrameConstants::kContextFromRegisterPointer));
825
826 // Get the bytecode array pointer from the frame.
827 __ movp(rbx,
828 Operand(kInterpreterRegisterFileRegister,
829 InterpreterFrameConstants::kFunctionFromRegisterPointer));
830 __ movp(rbx, FieldOperand(rbx, JSFunction::kSharedFunctionInfoOffset));
831 __ movp(kInterpreterBytecodeArrayRegister,
832 FieldOperand(rbx, SharedFunctionInfo::kFunctionDataOffset));
833
834 if (FLAG_debug_code) {
835 // Check function data field is actually a BytecodeArray object.
836 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
837 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
838 rbx);
839 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
840 }
841
842 // Get the target bytecode offset from the frame.
843 __ movp(
844 kInterpreterBytecodeOffsetRegister,
845 Operand(kInterpreterRegisterFileRegister,
846 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
847 __ SmiToInteger32(kInterpreterBytecodeOffsetRegister,
848 kInterpreterBytecodeOffsetRegister);
849
850 // Dispatch to the target bytecode.
851 __ movzxbp(rbx, Operand(kInterpreterBytecodeArrayRegister,
852 kInterpreterBytecodeOffsetRegister, times_1, 0));
853 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx,
854 times_pointer_size, 0));
855 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag));
856 __ jmp(rbx);
857 }
858
859
860 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) {
861 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER);
862 }
863
864
865 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) {
866 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT);
867 }
868
869
870 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
871 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
872 }
873
874
787 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 875 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
788 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 876 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
789 GenerateTailCallToReturnedCode(masm); 877 GenerateTailCallToReturnedCode(masm);
790 } 878 }
791 879
792 880
793 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 881 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
794 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); 882 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent);
795 GenerateTailCallToReturnedCode(masm); 883 GenerateTailCallToReturnedCode(masm);
796 } 884 }
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 __ ret(0); 2296 __ ret(0);
2209 } 2297 }
2210 2298
2211 2299
2212 #undef __ 2300 #undef __
2213 2301
2214 } // namespace internal 2302 } // namespace internal
2215 } // namespace v8 2303 } // namespace v8
2216 2304
2217 #endif // V8_TARGET_ARCH_X64 2305 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698