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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 1021 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
1022 __ push(a5); | 1022 __ push(a5); |
1023 // Continue loop if not done. | 1023 // Continue loop if not done. |
1024 __ bind(&loop_check); | 1024 __ bind(&loop_check); |
1025 __ Dsubu(a4, a4, Operand(kPointerSize)); | 1025 __ Dsubu(a4, a4, Operand(kPointerSize)); |
1026 __ Branch(&loop_header, ge, a4, Operand(zero_reg)); | 1026 __ Branch(&loop_header, ge, a4, Operand(zero_reg)); |
1027 } | 1027 } |
1028 | 1028 |
1029 // Load bytecode offset and dispatch table into registers. | 1029 // Load bytecode offset and dispatch table into registers. |
1030 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1030 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1031 __ Daddu(kInterpreterRegisterFileRegister, fp, | 1031 __ Daddu(a7, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); |
1032 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1033 __ li(kInterpreterBytecodeOffsetRegister, | 1032 __ li(kInterpreterBytecodeOffsetRegister, |
1034 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1033 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
1035 __ li(kInterpreterDispatchTableRegister, | 1034 __ li(kInterpreterDispatchTableRegister, |
1036 Operand(ExternalReference::interpreter_dispatch_table_address( | 1035 Operand(ExternalReference::interpreter_dispatch_table_address( |
1037 masm->isolate()))); | 1036 masm->isolate()))); |
1038 | 1037 |
1039 // Dispatch to the first bytecode handler for the function. | 1038 // Dispatch to the first bytecode handler for the function. |
1040 __ Daddu(a0, kInterpreterBytecodeArrayRegister, | 1039 __ Daddu(a0, kInterpreterBytecodeArrayRegister, |
1041 kInterpreterBytecodeOffsetRegister); | 1040 kInterpreterBytecodeOffsetRegister); |
1042 __ lbu(a0, MemOperand(a0)); | 1041 __ lbu(a0, MemOperand(a0)); |
1043 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); | 1042 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); |
1044 __ ld(at, MemOperand(at)); | 1043 __ ld(at, MemOperand(at)); |
1045 __ Call(at); | 1044 __ Call(at); |
1046 | 1045 |
1047 // Even though the first bytecode handler was called, we will never return. | 1046 // Even though the first bytecode handler was called, we will never return. |
1048 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 1047 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
1049 | 1048 |
1050 // Load debug copy of the bytecode array. | 1049 // Load debug copy of the bytecode array. |
1051 __ bind(&load_debug_bytecode_array); | 1050 __ bind(&load_debug_bytecode_array); |
1052 __ ld(kInterpreterBytecodeArrayRegister, | 1051 __ ld(kInterpreterBytecodeArrayRegister, |
1053 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); | 1052 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); |
1054 __ Branch(&bytecode_array_loaded); | 1053 __ Branch(&bytecode_array_loaded); |
1055 } | 1054 } |
1056 | 1055 |
1057 | 1056 |
1058 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1057 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
1059 // TODO(rmcilroy): List of things not currently dealt with here but done in | |
1060 // fullcodegen's EmitReturnSequence. | |
1061 // - Supporting FLAG_trace for Runtime::TraceExit. | |
1062 // - Support profiler (specifically decrementing profiling_counter | |
1063 // appropriately and calling out to HandleInterrupts if necessary). | |
1064 | |
1065 // The return value is in accumulator, which is already in v0. | 1058 // The return value is in accumulator, which is already in v0. |
1066 | 1059 |
1067 // Leave the frame (also dropping the register file). | 1060 // Leave the frame (also dropping the register file). |
1068 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1061 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1069 | 1062 |
1070 // Drop receiver + arguments and return. | 1063 // Drop receiver + arguments and return. |
1071 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1064 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1072 BytecodeArray::kParameterSizeOffset)); | 1065 BytecodeArray::kParameterSizeOffset)); |
1073 __ Daddu(sp, sp, at); | 1066 __ Daddu(sp, sp, at); |
1074 __ Jump(ra); | 1067 __ Jump(ra); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 __ push(t1); | 1126 __ push(t1); |
1134 __ bind(&loop_check); | 1127 __ bind(&loop_check); |
1135 __ Branch(&loop_header, gt, a2, Operand(t0)); | 1128 __ Branch(&loop_header, gt, a2, Operand(t0)); |
1136 | 1129 |
1137 // Call the constructor with a0, a1, and a3 unmodified. | 1130 // Call the constructor with a0, a1, and a3 unmodified. |
1138 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1131 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1139 } | 1132 } |
1140 | 1133 |
1141 | 1134 |
1142 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 1135 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
1143 // Initialize register file register and dispatch table register. | 1136 // Initialize the dispatch table register. |
1144 __ Daddu(kInterpreterRegisterFileRegister, fp, | |
1145 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1146 __ li(kInterpreterDispatchTableRegister, | 1137 __ li(kInterpreterDispatchTableRegister, |
1147 Operand(ExternalReference::interpreter_dispatch_table_address( | 1138 Operand(ExternalReference::interpreter_dispatch_table_address( |
1148 masm->isolate()))); | 1139 masm->isolate()))); |
1149 | 1140 |
1150 // Get the bytecode array pointer from the frame. | 1141 // Get the bytecode array pointer from the frame. |
1151 __ ld( | 1142 __ ld(kInterpreterBytecodeArrayRegister, |
1152 kInterpreterBytecodeArrayRegister, | 1143 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
1153 MemOperand(kInterpreterRegisterFileRegister, | |
1154 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); | |
1155 | 1144 |
1156 if (FLAG_debug_code) { | 1145 if (FLAG_debug_code) { |
1157 // Check function data field is actually a BytecodeArray object. | 1146 // Check function data field is actually a BytecodeArray object. |
1158 __ SmiTst(kInterpreterBytecodeArrayRegister, at); | 1147 __ SmiTst(kInterpreterBytecodeArrayRegister, at); |
1159 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, | 1148 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, |
1160 Operand(zero_reg)); | 1149 Operand(zero_reg)); |
1161 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); | 1150 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); |
1162 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, | 1151 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, |
1163 Operand(BYTECODE_ARRAY_TYPE)); | 1152 Operand(BYTECODE_ARRAY_TYPE)); |
1164 } | 1153 } |
1165 | 1154 |
1166 // Get the target bytecode offset from the frame. | 1155 // Get the target bytecode offset from the frame. |
1167 __ ld(kInterpreterBytecodeOffsetRegister, | 1156 __ ld(kInterpreterBytecodeOffsetRegister, |
1168 MemOperand( | 1157 MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
1169 kInterpreterRegisterFileRegister, | |
1170 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); | |
1171 __ SmiUntag(kInterpreterBytecodeOffsetRegister); | 1158 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
1172 | 1159 |
1173 // Dispatch to the target bytecode. | 1160 // Dispatch to the target bytecode. |
1174 __ Daddu(a1, kInterpreterBytecodeArrayRegister, | 1161 __ Daddu(a1, kInterpreterBytecodeArrayRegister, |
1175 kInterpreterBytecodeOffsetRegister); | 1162 kInterpreterBytecodeOffsetRegister); |
1176 __ lbu(a1, MemOperand(a1)); | 1163 __ lbu(a1, MemOperand(a1)); |
1177 __ Dlsa(a1, kInterpreterDispatchTableRegister, a1, kPointerSizeLog2); | 1164 __ Dlsa(a1, kInterpreterDispatchTableRegister, a1, kPointerSizeLog2); |
1178 __ ld(a1, MemOperand(a1)); | 1165 __ ld(a1, MemOperand(a1)); |
1179 __ Jump(a1); | 1166 __ Jump(a1); |
1180 } | 1167 } |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 } | 2847 } |
2861 } | 2848 } |
2862 | 2849 |
2863 | 2850 |
2864 #undef __ | 2851 #undef __ |
2865 | 2852 |
2866 } // namespace internal | 2853 } // namespace internal |
2867 } // namespace v8 | 2854 } // namespace v8 |
2868 | 2855 |
2869 #endif // V8_TARGET_ARCH_MIPS64 | 2856 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |