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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 __ Addu(a2, a2, Operand(-kPointerSize)); | 935 __ Addu(a2, a2, Operand(-kPointerSize)); |
936 __ push(t1); | 936 __ push(t1); |
937 __ bind(&loop_check); | 937 __ bind(&loop_check); |
938 __ Branch(&loop_header, gt, a2, Operand(t0)); | 938 __ Branch(&loop_header, gt, a2, Operand(t0)); |
939 | 939 |
940 // Call the constructor with a0, a1, and a3 unmodified. | 940 // Call the constructor with a0, a1, and a3 unmodified. |
941 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 941 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
942 } | 942 } |
943 | 943 |
944 | 944 |
| 945 static void Generate_InterpreterNotifyDeoptimizedHelper( |
| 946 MacroAssembler* masm, Deoptimizer::BailoutType type) { |
| 947 // Enter an internal frame. |
| 948 { |
| 949 FrameScope scope(masm, StackFrame::INTERNAL); |
| 950 __ push(kInterpreterAccumulatorRegister); // Save accumulator register. |
| 951 |
| 952 // Pass the deoptimization type to the runtime system. |
| 953 __ li(a1, Operand(Smi::FromInt(static_cast<int>(type)))); |
| 954 __ push(a1); |
| 955 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 956 |
| 957 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. |
| 958 // Tear down internal frame. |
| 959 } |
| 960 |
| 961 // Drop state (we don't use these for interpreter deopts) and push PC at top |
| 962 // of stack (to simulate initial call to bytecode handler in interpreter entry |
| 963 // trampoline). |
| 964 __ lw(a1, MemOperand(sp)); |
| 965 __ Drop(1); |
| 966 __ sw(a1, MemOperand(sp)); |
| 967 |
| 968 // Initialize register file register and dispatch table register. |
| 969 __ Addu(kInterpreterRegisterFileRegister, fp, |
| 970 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 971 __ LoadRoot(kInterpreterDispatchTableRegister, |
| 972 Heap::kInterpreterTableRootIndex); |
| 973 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
| 974 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 975 |
| 976 // Get the context from the frame. |
| 977 // TODO(rmcilroy): Update interpreter frame to expect current context at the |
| 978 // context slot instead of the function context. |
| 979 __ lw(kContextRegister, |
| 980 MemOperand(kInterpreterRegisterFileRegister, |
| 981 InterpreterFrameConstants::kContextFromRegisterPointer)); |
| 982 |
| 983 // Get the bytecode array pointer from the frame. |
| 984 __ lw(a1, |
| 985 MemOperand(kInterpreterRegisterFileRegister, |
| 986 InterpreterFrameConstants::kFunctionFromRegisterPointer)); |
| 987 __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 988 __ lw(kInterpreterBytecodeArrayRegister, |
| 989 FieldMemOperand(a1, SharedFunctionInfo::kFunctionDataOffset)); |
| 990 |
| 991 if (FLAG_debug_code) { |
| 992 // Check function data field is actually a BytecodeArray object. |
| 993 __ SmiTst(kInterpreterBytecodeArrayRegister, at); |
| 994 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, |
| 995 Operand(zero_reg)); |
| 996 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); |
| 997 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, |
| 998 Operand(BYTECODE_ARRAY_TYPE)); |
| 999 } |
| 1000 |
| 1001 // Get the target bytecode offset from the frame. |
| 1002 __ lw(kInterpreterBytecodeOffsetRegister, |
| 1003 MemOperand( |
| 1004 kInterpreterRegisterFileRegister, |
| 1005 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
| 1006 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
| 1007 |
| 1008 // Dispatch to the target bytecode. |
| 1009 __ Addu(a1, kInterpreterBytecodeArrayRegister, |
| 1010 kInterpreterBytecodeOffsetRegister); |
| 1011 __ lbu(a1, MemOperand(a1)); |
| 1012 __ sll(a1, a1, kPointerSizeLog2); |
| 1013 __ Addu(a1, kInterpreterDispatchTableRegister, a1); |
| 1014 __ lw(a1, MemOperand(a1)); |
| 1015 __ Addu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1016 __ Jump(a1); |
| 1017 } |
| 1018 |
| 1019 |
| 1020 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { |
| 1021 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 1022 } |
| 1023 |
| 1024 |
| 1025 void Builtins::Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm) { |
| 1026 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1027 } |
| 1028 |
| 1029 |
| 1030 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1031 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1032 } |
| 1033 |
| 1034 |
945 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1035 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
946 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1036 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
947 GenerateTailCallToReturnedCode(masm); | 1037 GenerateTailCallToReturnedCode(masm); |
948 } | 1038 } |
949 | 1039 |
950 | 1040 |
951 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1041 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
952 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1042 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); |
953 GenerateTailCallToReturnedCode(masm); | 1043 GenerateTailCallToReturnedCode(masm); |
954 } | 1044 } |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 } | 2218 } |
2129 } | 2219 } |
2130 | 2220 |
2131 | 2221 |
2132 #undef __ | 2222 #undef __ |
2133 | 2223 |
2134 } // namespace internal | 2224 } // namespace internal |
2135 } // namespace v8 | 2225 } // namespace v8 |
2136 | 2226 |
2137 #endif // V8_TARGET_ARCH_MIPS | 2227 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |