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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 } | 1059 } |
1060 | 1060 |
1061 | 1061 |
1062 void CEntryStub::Generate(MacroAssembler* masm) { | 1062 void CEntryStub::Generate(MacroAssembler* masm) { |
1063 // Called from JavaScript; parameters are on stack as if calling JS function | 1063 // Called from JavaScript; parameters are on stack as if calling JS function |
1064 // a0: number of arguments including receiver | 1064 // a0: number of arguments including receiver |
1065 // a1: pointer to builtin function | 1065 // a1: pointer to builtin function |
1066 // fp: frame pointer (restored after C call) | 1066 // fp: frame pointer (restored after C call) |
1067 // sp: stack pointer (restored as callee's sp after C call) | 1067 // sp: stack pointer (restored as callee's sp after C call) |
1068 // cp: current context (C callee-saved) | 1068 // cp: current context (C callee-saved) |
| 1069 // |
| 1070 // If argv_in_register(): |
| 1071 // a2: pointer to the first argument |
1069 | 1072 |
1070 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 1073 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1071 | 1074 |
1072 // Compute the argv pointer in a callee-saved register. | 1075 if (argv_in_register()) { |
1073 __ sll(s1, a0, kPointerSizeLog2); | 1076 // Move argv into the correct register. |
1074 __ Addu(s1, sp, s1); | 1077 __ mov(s1, a2); |
1075 __ Subu(s1, s1, kPointerSize); | 1078 } else { |
| 1079 // Compute the argv pointer in a callee-saved register. |
| 1080 __ sll(s1, a0, kPointerSizeLog2); |
| 1081 __ Addu(s1, sp, s1); |
| 1082 __ Subu(s1, s1, kPointerSize); |
| 1083 } |
1076 | 1084 |
1077 // Enter the exit frame that transitions from JavaScript to C++. | 1085 // Enter the exit frame that transitions from JavaScript to C++. |
1078 FrameScope scope(masm, StackFrame::MANUAL); | 1086 FrameScope scope(masm, StackFrame::MANUAL); |
1079 __ EnterExitFrame(save_doubles()); | 1087 __ EnterExitFrame(save_doubles()); |
1080 | 1088 |
1081 // s0: number of arguments including receiver (C callee-saved) | 1089 // s0: number of arguments including receiver (C callee-saved) |
1082 // s1: pointer to first argument (C callee-saved) | 1090 // s1: pointer to first argument (C callee-saved) |
1083 // s2: pointer to builtin function (C callee-saved) | 1091 // s2: pointer to builtin function (C callee-saved) |
1084 | 1092 |
1085 // Prepare arguments for C routine. | 1093 // Prepare arguments for C routine. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 // Cannot use check here as it attempts to generate call into runtime. | 1154 // Cannot use check here as it attempts to generate call into runtime. |
1147 __ Branch(&okay, eq, t0, Operand(a2)); | 1155 __ Branch(&okay, eq, t0, Operand(a2)); |
1148 __ stop("Unexpected pending exception"); | 1156 __ stop("Unexpected pending exception"); |
1149 __ bind(&okay); | 1157 __ bind(&okay); |
1150 } | 1158 } |
1151 | 1159 |
1152 // Exit C frame and return. | 1160 // Exit C frame and return. |
1153 // v0:v1: result | 1161 // v0:v1: result |
1154 // sp: stack pointer | 1162 // sp: stack pointer |
1155 // fp: frame pointer | 1163 // fp: frame pointer |
1156 // s0: still holds argc (callee-saved). | 1164 Register argc; |
1157 __ LeaveExitFrame(save_doubles(), s0, true, EMIT_RETURN); | 1165 if (argv_in_register()) { |
| 1166 // We don't want to pop arguments so set argc to no_reg. |
| 1167 argc = no_reg; |
| 1168 } else { |
| 1169 // s0: still holds argc (callee-saved). |
| 1170 argc = s0; |
| 1171 } |
| 1172 __ LeaveExitFrame(save_doubles(), argc, true, EMIT_RETURN); |
1158 | 1173 |
1159 // Handling of exception. | 1174 // Handling of exception. |
1160 __ bind(&exception_returned); | 1175 __ bind(&exception_returned); |
1161 | 1176 |
1162 ExternalReference pending_handler_context_address( | 1177 ExternalReference pending_handler_context_address( |
1163 Isolate::kPendingHandlerContextAddress, isolate()); | 1178 Isolate::kPendingHandlerContextAddress, isolate()); |
1164 ExternalReference pending_handler_code_address( | 1179 ExternalReference pending_handler_code_address( |
1165 Isolate::kPendingHandlerCodeAddress, isolate()); | 1180 Isolate::kPendingHandlerCodeAddress, isolate()); |
1166 ExternalReference pending_handler_offset_address( | 1181 ExternalReference pending_handler_offset_address( |
1167 Isolate::kPendingHandlerOffsetAddress, isolate()); | 1182 Isolate::kPendingHandlerOffsetAddress, isolate()); |
(...skipping 4559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5727 MemOperand(fp, 6 * kPointerSize), NULL); | 5742 MemOperand(fp, 6 * kPointerSize), NULL); |
5728 } | 5743 } |
5729 | 5744 |
5730 | 5745 |
5731 #undef __ | 5746 #undef __ |
5732 | 5747 |
5733 } // namespace internal | 5748 } // namespace internal |
5734 } // namespace v8 | 5749 } // namespace v8 |
5735 | 5750 |
5736 #endif // V8_TARGET_ARCH_MIPS | 5751 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |