Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/mips/assembler-mips.cc

Issue 10134031: Merged r11230, r11241, r11283, r11405 into 3.9 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.9
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 return reinterpret_cast<Address>( 2130 return reinterpret_cast<Address>(
2131 (GetImmediate16(instr1) << 16) | GetImmediate16(instr2)); 2131 (GetImmediate16(instr1) << 16) | GetImmediate16(instr2));
2132 } 2132 }
2133 2133
2134 // We should never get here, force a bad address if we do. 2134 // We should never get here, force a bad address if we do.
2135 UNREACHABLE(); 2135 UNREACHABLE();
2136 return (Address)0x0; 2136 return (Address)0x0;
2137 } 2137 }
2138 2138
2139 2139
2140 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32
2141 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap
2142 // snapshot generated on ia32, the resulting MIPS sNaN must be quieted.
2143 // OS::nan_value() returns a qNaN.
2144 void Assembler::QuietNaN(HeapObject* object) {
2145 HeapNumber::cast(object)->set_value(OS::nan_value());
2146 }
2147
2148
2140 // On Mips, a target address is stored in a lui/ori instruction pair, each 2149 // On Mips, a target address is stored in a lui/ori instruction pair, each
2141 // of which load 16 bits of the 32-bit address to a register. 2150 // of which load 16 bits of the 32-bit address to a register.
2142 // Patching the address must replace both instr, and flush the i-cache. 2151 // Patching the address must replace both instr, and flush the i-cache.
2143 // 2152 //
2144 // There is an optimization below, which emits a nop when the address 2153 // There is an optimization below, which emits a nop when the address
2145 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, 2154 // fits in just 16 bits. This is unlikely to help, and should be benchmarked,
2146 // and possibly removed. 2155 // and possibly removed.
2147 void Assembler::set_target_address_at(Address pc, Address target) { 2156 void Assembler::set_target_address_at(Address pc, Address target) {
2148 Instr instr2 = instr_at(pc + kInstrSize); 2157 Instr instr2 = instr_at(pc + kInstrSize);
2149 uint32_t rt_code = GetRtField(instr2); 2158 uint32_t rt_code = GetRtField(instr2);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 } 2279 }
2271 2280
2272 if (patched) { 2281 if (patched) {
2273 CPU::FlushICache(pc+2, sizeof(Address)); 2282 CPU::FlushICache(pc+2, sizeof(Address));
2274 } 2283 }
2275 } 2284 }
2276 2285
2277 } } // namespace v8::internal 2286 } } // namespace v8::internal
2278 2287
2279 #endif // V8_TARGET_ARCH_MIPS 2288 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698