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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 __ mov(a2, s1); | 1118 __ mov(a2, s1); |
1119 __ mov(a1, a0); | 1119 __ mov(a1, a0); |
1120 __ mov(a0, sp); | 1120 __ mov(a0, sp); |
1121 } | 1121 } |
1122 | 1122 |
1123 // To let the GC traverse the return address of the exit frames, we need to | 1123 // To let the GC traverse the return address of the exit frames, we need to |
1124 // know where the return address is. The CEntryStub is unmovable, so | 1124 // know where the return address is. The CEntryStub is unmovable, so |
1125 // we can store the address on the stack to be able to find it again and | 1125 // we can store the address on the stack to be able to find it again and |
1126 // we never have to restore it, because it will not change. | 1126 // we never have to restore it, because it will not change. |
1127 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); | 1127 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); |
1128 // This branch-and-link sequence is needed to find the current PC on mips, | 1128 int kNumInstructionsToJump = 4; |
1129 // saved to the ra register. | |
1130 // Use masm-> here instead of the double-underscore macro since extra | |
1131 // coverage code can interfere with the proper calculation of ra. | |
1132 Label find_ra; | 1129 Label find_ra; |
1133 __ bal(&find_ra); // bal exposes branch delay slot. | |
1134 __ nop(); | |
1135 __ bind(&find_ra); | |
1136 | |
1137 // Adjust the value in ra to point to the correct return location, 2nd | 1130 // Adjust the value in ra to point to the correct return location, 2nd |
1138 // instruction past the real call into C code (the jalr(t9)), and push it. | 1131 // instruction past the real call into C code (the jalr(t9)), and push it. |
1139 // This is the return address of the exit frame. | 1132 // This is the return address of the exit frame. |
1140 const int kNumInstructionsToJump = 5; | 1133 if (kArchVariant >= kMips32r6) { |
1141 __ Addu(ra, ra, kNumInstructionsToJump * kPointerSize); | 1134 __ addiupc(ra, kNumInstructionsToJump + 1); |
| 1135 } else { |
| 1136 // This branch-and-link sequence is needed to find the current PC on mips |
| 1137 // before r6, saved to the ra register. |
| 1138 __ bal(&find_ra); // bal exposes branch delay slot. |
| 1139 __ Addu(ra, ra, kNumInstructionsToJump * Instruction::kInstrSize); |
| 1140 } |
| 1141 __ bind(&find_ra); |
| 1142 |
1142 // This spot was reserved in EnterExitFrame. | 1143 // This spot was reserved in EnterExitFrame. |
1143 __ sw(ra, MemOperand(sp, result_stack_size)); | 1144 __ sw(ra, MemOperand(sp, result_stack_size)); |
1144 // Stack space reservation moved to the branch delay slot below. | 1145 // Stack space reservation moved to the branch delay slot below. |
1145 // Stack is still aligned. | 1146 // Stack is still aligned. |
1146 | 1147 |
1147 // Call the C routine. | 1148 // Call the C routine. |
1148 __ mov(t9, s2); // Function pointer to t9 to conform to ABI for PIC. | 1149 __ mov(t9, s2); // Function pointer to t9 to conform to ABI for PIC. |
1149 __ jalr(t9); | 1150 __ jalr(t9); |
1150 // Set up sp in the delay slot. | 1151 // Set up sp in the delay slot. |
1151 __ addiu(sp, sp, -kCArgsSlotsSize); | 1152 __ addiu(sp, sp, -kCArgsSlotsSize); |
(...skipping 4466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5618 return_value_operand, NULL); | 5619 return_value_operand, NULL); |
5619 } | 5620 } |
5620 | 5621 |
5621 | 5622 |
5622 #undef __ | 5623 #undef __ |
5623 | 5624 |
5624 } // namespace internal | 5625 } // namespace internal |
5625 } // namespace v8 | 5626 } // namespace v8 |
5626 | 5627 |
5627 #endif // V8_TARGET_ARCH_MIPS | 5628 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |