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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 __ Daddu(a2, a2, Operand(-kPointerSize)); | 926 __ Daddu(a2, a2, Operand(-kPointerSize)); |
927 __ push(t1); | 927 __ push(t1); |
928 __ bind(&loop_check); | 928 __ bind(&loop_check); |
929 __ Branch(&loop_header, gt, a2, Operand(t0)); | 929 __ Branch(&loop_header, gt, a2, Operand(t0)); |
930 | 930 |
931 // Call the constructor with a0, a1, and a3 unmodified. | 931 // Call the constructor with a0, a1, and a3 unmodified. |
932 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 932 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
933 } | 933 } |
934 | 934 |
935 | 935 |
| 936 static void Generate_InterpreterNotifyDeoptimizedHelper( |
| 937 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
| 938 // Enter an internal frame. |
| 939 { |
| 940 FrameScope scope(masm, StackFrame::INTERNAL); |
| 941 __ push(kInterpreterAccumulatorRegister); // Save accumulator register. |
| 942 |
| 943 // Pass the deoptimization type to the runtime system. |
| 944 __ li(a1, Operand(Smi::FromInt(static_cast<int>(type)))); |
| 945 __ push(a1); |
| 946 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 947 |
| 948 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
| 949 // Tear down internal frame. |
| 950 } |
| 951 |
| 952 // Drop state (we don't use these for interpreter deopts) and push PC at top |
| 953 // of stack (to simulate initial call to bytecode handler in interpreter entry |
| 954 // trampoline). |
| 955 __ ld(a1, MemOperand(sp)); |
| 956 __ Drop(1); |
| 957 __ sd(a1, MemOperand(sp)); |
| 958 |
| 959 // Initialize register file register and dispatch table register. |
| 960 __ Daddu(kInterpreterRegisterFileRegister, fp, |
| 961 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 962 __ LoadRoot(kInterpreterDispatchTableRegister, |
| 963 Heap::kInterpreterTableRootIndex); |
| 964 __ Daddu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
| 965 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 966 |
| 967 // Get the context from the frame. |
| 968 // TODO(rmcilroy): Update interpreter frame to expect current context at the |
| 969 // context slot instead of the function context. |
| 970 __ ld(kContextRegister, |
| 971 MemOperand(kInterpreterRegisterFileRegister, |
| 972 InterpreterFrameConstants::kContextFromRegisterPointer)); |
| 973 |
| 974 // Get the bytecode array pointer from the frame. |
| 975 __ ld(a1, |
| 976 MemOperand(kInterpreterRegisterFileRegister, |
| 977 InterpreterFrameConstants::kFunctionFromRegisterPointer)); |
| 978 __ ld(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 979 __ ld(kInterpreterBytecodeArrayRegister, |
| 980 FieldMemOperand(a1, SharedFunctionInfo::kFunctionDataOffset)); |
| 981 |
| 982 if (FLAG_debug_code) { |
| 983 // Check function data field is actually a BytecodeArray object. |
| 984 __ SmiTst(kInterpreterBytecodeArrayRegister, at); |
| 985 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, |
| 986 Operand(zero_reg)); |
| 987 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); |
| 988 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, |
| 989 Operand(BYTECODE_ARRAY_TYPE)); |
| 990 } |
| 991 |
| 992 // Get the target bytecode offset from the frame. |
| 993 __ ld(kInterpreterBytecodeOffsetRegister, |
| 994 MemOperand( |
| 995 kInterpreterRegisterFileRegister, |
| 996 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
| 997 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
| 998 |
| 999 // Dispatch to the target bytecode. |
| 1000 __ Daddu(a1, kInterpreterBytecodeArrayRegister, |
| 1001 kInterpreterBytecodeOffsetRegister); |
| 1002 __ lbu(a1, MemOperand(a1)); |
| 1003 __ dsll(a1, a1, kPointerSizeLog2); |
| 1004 __ Daddu(a1, kInterpreterDispatchTableRegister, a1); |
| 1005 __ ld(a1, MemOperand(a1)); |
| 1006 __ Daddu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1007 __ Jump(a1); |
| 1008 } |
| 1009 |
| 1010 |
| 1011 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
| 1012 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 1013 } |
| 1014 |
| 1015 |
| 1016 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
| 1017 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1018 } |
| 1019 |
| 1020 |
| 1021 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1022 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1023 } |
| 1024 |
| 1025 |
936 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1026 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
937 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1027 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
938 GenerateTailCallToReturnedCode(masm); | 1028 GenerateTailCallToReturnedCode(masm); |
939 } | 1029 } |
940 | 1030 |
941 | 1031 |
942 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1032 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
943 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1033 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
944 GenerateTailCallToReturnedCode(masm); | 1034 GenerateTailCallToReturnedCode(masm); |
945 } | 1035 } |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 } | 2208 } |
2119 } | 2209 } |
2120 | 2210 |
2121 | 2211 |
2122 #undef __ | 2212 #undef __ |
2123 | 2213 |
2124 } // namespace internal | 2214 } // namespace internal |
2125 } // namespace v8 | 2215 } // namespace v8 |
2126 | 2216 |
2127 #endif // V8_TARGET_ARCH_MIPS64 | 2217 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |