OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 20, // s4 | 136 20, // s4 |
137 21, // s5 | 137 21, // s5 |
138 22, // s6 | 138 22, // s6 |
139 23, // s7 | 139 23, // s7 |
140 24, // t8 | 140 24, // t8 |
141 25, // t9 | 141 25, // t9 |
142 26, // k0 | 142 26, // k0 |
143 27, // k1 | 143 27, // k1 |
144 28, // gp | 144 28, // gp |
145 29, // sp | 145 29, // sp |
146 30, // s8_fp | 146 30, // fp |
147 31, // ra | 147 31, // ra |
148 }; | 148 }; |
149 return kNumbers[reg.code()]; | 149 return kNumbers[reg.code()]; |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 Register ToRegister(int num) { | 153 Register ToRegister(int num) { |
154 ASSERT(num >= 0 && num < kNumRegisters); | 154 ASSERT(num >= 0 && num < kNumRegisters); |
155 const Register kRegisters[] = { | 155 const Register kRegisters[] = { |
156 zero_reg, | 156 zero_reg, |
157 at, | 157 at, |
158 v0, v1, | 158 v0, v1, |
159 a0, a1, a2, a3, | 159 a0, a1, a2, a3, |
160 t0, t1, t2, t3, t4, t5, t6, t7, | 160 t0, t1, t2, t3, t4, t5, t6, t7, |
161 s0, s1, s2, s3, s4, s5, s6, s7, | 161 s0, s1, s2, s3, s4, s5, s6, s7, |
162 t8, t9, | 162 t8, t9, |
163 k0, k1, | 163 k0, k1, |
164 gp, | 164 gp, |
165 sp, | 165 sp, |
166 s8_fp, | 166 fp, |
167 ra | 167 ra |
168 }; | 168 }; |
169 return kRegisters[num]; | 169 return kRegisters[num]; |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 // ----------------------------------------------------------------------------- | 173 // ----------------------------------------------------------------------------- |
174 // Implementation of RelocInfo. | 174 // Implementation of RelocInfo. |
175 | 175 |
176 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | | 176 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 offset_ = offset; | 230 offset_ = offset; |
231 } | 231 } |
232 | 232 |
233 | 233 |
234 // ----------------------------------------------------------------------------- | 234 // ----------------------------------------------------------------------------- |
235 // Specific instructions, constants, and masks. | 235 // Specific instructions, constants, and masks. |
236 | 236 |
237 static const int kNegOffset = 0x00008000; | 237 static const int kNegOffset = 0x00008000; |
238 // addiu(sp, sp, 4) aka Pop() operation or part of Pop(r) | 238 // addiu(sp, sp, 4) aka Pop() operation or part of Pop(r) |
239 // operations as post-increment of sp. | 239 // operations as post-increment of sp. |
240 const Instr kPopInstruction = ADDIU | (sp.code() << kRsShift) | 240 const Instr kPopInstruction = ADDIU | (kRegister_sp_Code << kRsShift) |
241 | (sp.code() << kRtShift) | (kPointerSize & kImm16Mask); | 241 | (kRegister_sp_Code << kRtShift) | (kPointerSize & kImm16Mask); |
242 // addiu(sp, sp, -4) part of Push(r) operation as pre-decrement of sp. | 242 // addiu(sp, sp, -4) part of Push(r) operation as pre-decrement of sp. |
243 const Instr kPushInstruction = ADDIU | (sp.code() << kRsShift) | 243 const Instr kPushInstruction = ADDIU | (kRegister_sp_Code << kRsShift) |
244 | (sp.code() << kRtShift) | (-kPointerSize & kImm16Mask); | 244 | (kRegister_sp_Code << kRtShift) | (-kPointerSize & kImm16Mask); |
245 // sw(r, MemOperand(sp, 0)) | 245 // sw(r, MemOperand(sp, 0)) |
246 const Instr kPushRegPattern = SW | (sp.code() << kRsShift) | 246 const Instr kPushRegPattern = SW | (kRegister_sp_Code << kRsShift) |
247 | (0 & kImm16Mask); | 247 | (0 & kImm16Mask); |
248 // lw(r, MemOperand(sp, 0)) | 248 // lw(r, MemOperand(sp, 0)) |
249 const Instr kPopRegPattern = LW | (sp.code() << kRsShift) | 249 const Instr kPopRegPattern = LW | (kRegister_sp_Code << kRsShift) |
250 | (0 & kImm16Mask); | 250 | (0 & kImm16Mask); |
251 | 251 |
252 const Instr kLwRegFpOffsetPattern = LW | (s8_fp.code() << kRsShift) | 252 const Instr kLwRegFpOffsetPattern = LW | (kRegister_fp_Code << kRsShift) |
253 | (0 & kImm16Mask); | 253 | (0 & kImm16Mask); |
254 | 254 |
255 const Instr kSwRegFpOffsetPattern = SW | (s8_fp.code() << kRsShift) | 255 const Instr kSwRegFpOffsetPattern = SW | (kRegister_fp_Code << kRsShift) |
256 | (0 & kImm16Mask); | 256 | (0 & kImm16Mask); |
257 | 257 |
258 const Instr kLwRegFpNegOffsetPattern = LW | (s8_fp.code() << kRsShift) | 258 const Instr kLwRegFpNegOffsetPattern = LW | (kRegister_fp_Code << kRsShift) |
259 | (kNegOffset & kImm16Mask); | 259 | (kNegOffset & kImm16Mask); |
260 | 260 |
261 const Instr kSwRegFpNegOffsetPattern = SW | (s8_fp.code() << kRsShift) | 261 const Instr kSwRegFpNegOffsetPattern = SW | (kRegister_fp_Code << kRsShift) |
262 | (kNegOffset & kImm16Mask); | 262 | (kNegOffset & kImm16Mask); |
263 // A mask for the Rt register for push, pop, lw, sw instructions. | 263 // A mask for the Rt register for push, pop, lw, sw instructions. |
264 const Instr kRtMask = kRtFieldMask; | 264 const Instr kRtMask = kRtFieldMask; |
265 const Instr kLwSwInstrTypeMask = 0xffe00000; | 265 const Instr kLwSwInstrTypeMask = 0xffe00000; |
266 const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; | 266 const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; |
267 const Instr kLwSwOffsetMask = kImm16Mask; | 267 const Instr kLwSwOffsetMask = kImm16Mask; |
268 | 268 |
269 | 269 |
270 // Spare buffer. | 270 // Spare buffer. |
271 static const int kMinimalBufferSize = 4 * KB; | 271 static const int kMinimalBufferSize = 4 * KB; |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 } | 2270 } |
2271 | 2271 |
2272 if (patched) { | 2272 if (patched) { |
2273 CPU::FlushICache(pc+2, sizeof(Address)); | 2273 CPU::FlushICache(pc+2, sizeof(Address)); |
2274 } | 2274 } |
2275 } | 2275 } |
2276 | 2276 |
2277 } } // namespace v8::internal | 2277 } } // namespace v8::internal |
2278 | 2278 |
2279 #endif // V8_TARGET_ARCH_MIPS | 2279 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |