| 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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 1032 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
| 1033 __ push(t1); | 1033 __ push(t1); |
| 1034 // Continue loop if not done. | 1034 // Continue loop if not done. |
| 1035 __ bind(&loop_check); | 1035 __ bind(&loop_check); |
| 1036 __ Subu(t0, t0, Operand(kPointerSize)); | 1036 __ Subu(t0, t0, Operand(kPointerSize)); |
| 1037 __ Branch(&loop_header, ge, t0, Operand(zero_reg)); | 1037 __ Branch(&loop_header, ge, t0, Operand(zero_reg)); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 // Load bytecode offset and dispatch table into registers. | 1040 // Load bytecode offset and dispatch table into registers. |
| 1041 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1041 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 1042 __ Addu(kInterpreterRegisterFileRegister, fp, | 1042 __ Addu(t3, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); |
| 1043 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
| 1044 __ li(kInterpreterBytecodeOffsetRegister, | 1043 __ li(kInterpreterBytecodeOffsetRegister, |
| 1045 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1044 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 1046 __ li(kInterpreterDispatchTableRegister, | 1045 __ li(kInterpreterDispatchTableRegister, |
| 1047 Operand(ExternalReference::interpreter_dispatch_table_address( | 1046 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1048 masm->isolate()))); | 1047 masm->isolate()))); |
| 1049 | 1048 |
| 1050 // Dispatch to the first bytecode handler for the function. | 1049 // Dispatch to the first bytecode handler for the function. |
| 1051 __ Addu(a0, kInterpreterBytecodeArrayRegister, | 1050 __ Addu(a0, kInterpreterBytecodeArrayRegister, |
| 1052 kInterpreterBytecodeOffsetRegister); | 1051 kInterpreterBytecodeOffsetRegister); |
| 1053 __ lbu(a0, MemOperand(a0)); | 1052 __ lbu(a0, MemOperand(a0)); |
| 1054 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); | 1053 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); |
| 1055 __ lw(at, MemOperand(at)); | 1054 __ lw(at, MemOperand(at)); |
| 1056 __ Call(at); | 1055 __ Call(at); |
| 1057 | 1056 |
| 1058 // Even though the first bytecode handler was called, we will never return. | 1057 // Even though the first bytecode handler was called, we will never return. |
| 1059 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 1058 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
| 1060 | 1059 |
| 1061 // Load debug copy of the bytecode array. | 1060 // Load debug copy of the bytecode array. |
| 1062 __ bind(&load_debug_bytecode_array); | 1061 __ bind(&load_debug_bytecode_array); |
| 1063 __ lw(kInterpreterBytecodeArrayRegister, | 1062 __ lw(kInterpreterBytecodeArrayRegister, |
| 1064 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); | 1063 FieldMemOperand(debug_info, DebugInfo::kAbstractCodeIndex)); |
| 1065 __ Branch(&bytecode_array_loaded); | 1064 __ Branch(&bytecode_array_loaded); |
| 1066 } | 1065 } |
| 1067 | 1066 |
| 1068 | 1067 |
| 1069 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1068 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
| 1070 // TODO(rmcilroy): List of things not currently dealt with here but done in | |
| 1071 // fullcodegen's EmitReturnSequence. | |
| 1072 // - Supporting FLAG_trace for Runtime::TraceExit. | |
| 1073 // - Support profiler (specifically decrementing profiling_counter | |
| 1074 // appropriately and calling out to HandleInterrupts if necessary). | |
| 1075 | |
| 1076 // The return value is in accumulator, which is already in v0. | 1069 // The return value is in accumulator, which is already in v0. |
| 1077 | 1070 |
| 1078 // Leave the frame (also dropping the register file). | 1071 // Leave the frame (also dropping the register file). |
| 1079 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1072 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
| 1080 | 1073 |
| 1081 // Drop receiver + arguments and return. | 1074 // Drop receiver + arguments and return. |
| 1082 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1075 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
| 1083 BytecodeArray::kParameterSizeOffset)); | 1076 BytecodeArray::kParameterSizeOffset)); |
| 1084 __ Addu(sp, sp, at); | 1077 __ Addu(sp, sp, at); |
| 1085 __ Jump(ra); | 1078 __ Jump(ra); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 __ push(t1); | 1137 __ push(t1); |
| 1145 __ bind(&loop_check); | 1138 __ bind(&loop_check); |
| 1146 __ Branch(&loop_header, gt, a2, Operand(t0)); | 1139 __ Branch(&loop_header, gt, a2, Operand(t0)); |
| 1147 | 1140 |
| 1148 // Call the constructor with a0, a1, and a3 unmodified. | 1141 // Call the constructor with a0, a1, and a3 unmodified. |
| 1149 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1142 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 1150 } | 1143 } |
| 1151 | 1144 |
| 1152 | 1145 |
| 1153 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 1146 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
| 1154 // Initialize register file register and dispatch table register. | 1147 // Initialize the dispatch table register. |
| 1155 __ Addu(kInterpreterRegisterFileRegister, fp, | |
| 1156 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
| 1157 __ li(kInterpreterDispatchTableRegister, | 1148 __ li(kInterpreterDispatchTableRegister, |
| 1158 Operand(ExternalReference::interpreter_dispatch_table_address( | 1149 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1159 masm->isolate()))); | 1150 masm->isolate()))); |
| 1160 | 1151 |
| 1161 // Get the bytecode array pointer from the frame. | 1152 // Get the bytecode array pointer from the frame. |
| 1162 __ lw( | 1153 __ lw(kInterpreterBytecodeArrayRegister, |
| 1163 kInterpreterBytecodeArrayRegister, | 1154 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
| 1164 MemOperand(kInterpreterRegisterFileRegister, | |
| 1165 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); | |
| 1166 | 1155 |
| 1167 if (FLAG_debug_code) { | 1156 if (FLAG_debug_code) { |
| 1168 // Check function data field is actually a BytecodeArray object. | 1157 // Check function data field is actually a BytecodeArray object. |
| 1169 __ SmiTst(kInterpreterBytecodeArrayRegister, at); | 1158 __ SmiTst(kInterpreterBytecodeArrayRegister, at); |
| 1170 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, | 1159 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, at, |
| 1171 Operand(zero_reg)); | 1160 Operand(zero_reg)); |
| 1172 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); | 1161 __ GetObjectType(kInterpreterBytecodeArrayRegister, a1, a1); |
| 1173 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, | 1162 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a1, |
| 1174 Operand(BYTECODE_ARRAY_TYPE)); | 1163 Operand(BYTECODE_ARRAY_TYPE)); |
| 1175 } | 1164 } |
| 1176 | 1165 |
| 1177 // Get the target bytecode offset from the frame. | 1166 // Get the target bytecode offset from the frame. |
| 1178 __ lw(kInterpreterBytecodeOffsetRegister, | 1167 __ lw(kInterpreterBytecodeOffsetRegister, |
| 1179 MemOperand( | 1168 MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
| 1180 kInterpreterRegisterFileRegister, | |
| 1181 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); | |
| 1182 __ SmiUntag(kInterpreterBytecodeOffsetRegister); | 1169 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
| 1183 | 1170 |
| 1184 // Dispatch to the target bytecode. | 1171 // Dispatch to the target bytecode. |
| 1185 __ Addu(a1, kInterpreterBytecodeArrayRegister, | 1172 __ Addu(a1, kInterpreterBytecodeArrayRegister, |
| 1186 kInterpreterBytecodeOffsetRegister); | 1173 kInterpreterBytecodeOffsetRegister); |
| 1187 __ lbu(a1, MemOperand(a1)); | 1174 __ lbu(a1, MemOperand(a1)); |
| 1188 __ Lsa(a1, kInterpreterDispatchTableRegister, a1, kPointerSizeLog2); | 1175 __ Lsa(a1, kInterpreterDispatchTableRegister, a1, kPointerSizeLog2); |
| 1189 __ lw(a1, MemOperand(a1)); | 1176 __ lw(a1, MemOperand(a1)); |
| 1190 __ Jump(a1); | 1177 __ Jump(a1); |
| 1191 } | 1178 } |
| (...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2870 } | 2857 } |
| 2871 } | 2858 } |
| 2872 | 2859 |
| 2873 | 2860 |
| 2874 #undef __ | 2861 #undef __ |
| 2875 | 2862 |
| 2876 } // namespace internal | 2863 } // namespace internal |
| 2877 } // namespace v8 | 2864 } // namespace v8 |
| 2878 | 2865 |
| 2879 #endif // V8_TARGET_ARCH_MIPS | 2866 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |