OLD | NEW |
1 | 1 |
2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4088 Move(a1, a0, src1); | 4088 Move(a1, a0, src1); |
4089 Move(a3, a2, src2); | 4089 Move(a3, a2, src2); |
4090 } | 4090 } |
4091 } | 4091 } |
4092 } | 4092 } |
4093 | 4093 |
4094 | 4094 |
4095 // ----------------------------------------------------------------------------- | 4095 // ----------------------------------------------------------------------------- |
4096 // JavaScript invokes. | 4096 // JavaScript invokes. |
4097 | 4097 |
| 4098 void MacroAssembler::PrepareForTailCall(const ParameterCount& callee_args_count, |
| 4099 Register caller_args_count_reg, |
| 4100 Register scratch0, Register scratch1) { |
| 4101 #if DEBUG |
| 4102 if (callee_args_count.is_reg()) { |
| 4103 DCHECK(!AreAliased(callee_args_count.reg(), caller_args_count_reg, scratch0, |
| 4104 scratch1)); |
| 4105 } else { |
| 4106 DCHECK(!AreAliased(caller_args_count_reg, scratch0, scratch1)); |
| 4107 } |
| 4108 #endif |
| 4109 |
| 4110 // Calculate the end of destination area where we will put the arguments |
| 4111 // after we drop current frame. We add kPointerSize to count the receiver |
| 4112 // argument which is not included into formal parameters count. |
| 4113 Register dst_reg = scratch0; |
| 4114 Lsa(dst_reg, fp, caller_args_count_reg, kPointerSizeLog2); |
| 4115 Addu(dst_reg, dst_reg, |
| 4116 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize)); |
| 4117 |
| 4118 Register src_reg = caller_args_count_reg; |
| 4119 // Calculate the end of source area. +kPointerSize is for the receiver. |
| 4120 if (callee_args_count.is_reg()) { |
| 4121 Lsa(src_reg, sp, callee_args_count.reg(), kPointerSizeLog2); |
| 4122 Addu(src_reg, src_reg, Operand(kPointerSize)); |
| 4123 } else { |
| 4124 Addu(src_reg, sp, |
| 4125 Operand((callee_args_count.immediate() + 1) * kPointerSize)); |
| 4126 } |
| 4127 |
| 4128 if (FLAG_debug_code) { |
| 4129 Check(lo, kStackAccessBelowStackPointer, src_reg, Operand(dst_reg)); |
| 4130 } |
| 4131 |
| 4132 // Restore caller's frame pointer and return address now as they will be |
| 4133 // overwritten by the copying loop. |
| 4134 lw(ra, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); |
| 4135 lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 4136 |
| 4137 // Now copy callee arguments to the caller frame going backwards to avoid |
| 4138 // callee arguments corruption (source and destination areas could overlap). |
| 4139 |
| 4140 // Both src_reg and dst_reg are pointing to the word after the one to copy, |
| 4141 // so they must be pre-decremented in the loop. |
| 4142 Register tmp_reg = scratch1; |
| 4143 Label loop, entry; |
| 4144 Branch(&entry); |
| 4145 bind(&loop); |
| 4146 Subu(src_reg, src_reg, Operand(kPointerSize)); |
| 4147 Subu(dst_reg, dst_reg, Operand(kPointerSize)); |
| 4148 lw(tmp_reg, MemOperand(src_reg)); |
| 4149 sw(tmp_reg, MemOperand(dst_reg)); |
| 4150 bind(&entry); |
| 4151 Branch(&loop, ne, sp, Operand(src_reg)); |
| 4152 |
| 4153 // Leave current frame. |
| 4154 mov(sp, dst_reg); |
| 4155 } |
| 4156 |
4098 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 4157 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
4099 const ParameterCount& actual, | 4158 const ParameterCount& actual, |
4100 Label* done, | 4159 Label* done, |
4101 bool* definitely_mismatches, | 4160 bool* definitely_mismatches, |
4102 InvokeFlag flag, | 4161 InvokeFlag flag, |
4103 const CallWrapper& call_wrapper) { | 4162 const CallWrapper& call_wrapper) { |
4104 bool definitely_matches = false; | 4163 bool definitely_matches = false; |
4105 *definitely_mismatches = false; | 4164 *definitely_mismatches = false; |
4106 Label regular_invoke; | 4165 Label regular_invoke; |
4107 | 4166 |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5913 if (mag.shift > 0) sra(result, result, mag.shift); | 5972 if (mag.shift > 0) sra(result, result, mag.shift); |
5914 srl(at, dividend, 31); | 5973 srl(at, dividend, 31); |
5915 Addu(result, result, Operand(at)); | 5974 Addu(result, result, Operand(at)); |
5916 } | 5975 } |
5917 | 5976 |
5918 | 5977 |
5919 } // namespace internal | 5978 } // namespace internal |
5920 } // namespace v8 | 5979 } // namespace v8 |
5921 | 5980 |
5922 #endif // V8_TARGET_ARCH_MIPS | 5981 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |