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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Only use statically determined features for cross compile (snapshot). | 92 // Only use statically determined features for cross compile (snapshot). |
93 if (cross_compile) return; | 93 if (cross_compile) return; |
94 | 94 |
95 // If the compiler is allowed to use fpu then we can use fpu too in our | 95 // If the compiler is allowed to use fpu then we can use fpu too in our |
96 // code generation. | 96 // code generation. |
97 #ifndef __mips__ | 97 #ifndef __mips__ |
98 // For the simulator build, use FPU. | 98 // For the simulator build, use FPU. |
99 supported_ |= 1u << FPU; | 99 supported_ |= 1u << FPU; |
100 #else | 100 #else |
101 // Probe for additional features at runtime. | 101 // Probe for additional features at runtime. |
102 CPU cpu; | 102 base::CPU cpu; |
103 if (cpu.has_fpu()) supported_ |= 1u << FPU; | 103 if (cpu.has_fpu()) supported_ |= 1u << FPU; |
104 #endif | 104 #endif |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 void CpuFeatures::PrintTarget() { } | 108 void CpuFeatures::PrintTarget() { } |
109 void CpuFeatures::PrintFeatures() { } | 109 void CpuFeatures::PrintFeatures() { } |
110 | 110 |
111 | 111 |
112 int ToNumber(Register reg) { | 112 int ToNumber(Register reg) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 // Patch the code at the current address with the supplied instructions. | 192 // Patch the code at the current address with the supplied instructions. |
193 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { | 193 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { |
194 Instr* pc = reinterpret_cast<Instr*>(pc_); | 194 Instr* pc = reinterpret_cast<Instr*>(pc_); |
195 Instr* instr = reinterpret_cast<Instr*>(instructions); | 195 Instr* instr = reinterpret_cast<Instr*>(instructions); |
196 for (int i = 0; i < instruction_count; i++) { | 196 for (int i = 0; i < instruction_count; i++) { |
197 *(pc + i) = *(instr + i); | 197 *(pc + i) = *(instr + i); |
198 } | 198 } |
199 | 199 |
200 // Indicate that code has changed. | 200 // Indicate that code has changed. |
201 CPU::FlushICache(pc_, instruction_count * Assembler::kInstrSize); | 201 CpuFeatures::FlushICache(pc_, instruction_count * Assembler::kInstrSize); |
202 } | 202 } |
203 | 203 |
204 | 204 |
205 // Patch the code at the current PC with a call to the target address. | 205 // Patch the code at the current PC with a call to the target address. |
206 // Additional guard instructions can be added if required. | 206 // Additional guard instructions can be added if required. |
207 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { | 207 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { |
208 // Patch the code at the current address with a call to the target. | 208 // Patch the code at the current address with a call to the target. |
209 UNIMPLEMENTED_MIPS(); | 209 UNIMPLEMENTED_MIPS(); |
210 } | 210 } |
211 | 211 |
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 UNREACHABLE(); | 2149 UNREACHABLE(); |
2150 return (Address)0x0; | 2150 return (Address)0x0; |
2151 } | 2151 } |
2152 | 2152 |
2153 | 2153 |
2154 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32 | 2154 // MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32 |
2155 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap | 2155 // qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap |
2156 // snapshot generated on ia32, the resulting MIPS sNaN must be quieted. | 2156 // snapshot generated on ia32, the resulting MIPS sNaN must be quieted. |
2157 // OS::nan_value() returns a qNaN. | 2157 // OS::nan_value() returns a qNaN. |
2158 void Assembler::QuietNaN(HeapObject* object) { | 2158 void Assembler::QuietNaN(HeapObject* object) { |
2159 HeapNumber::cast(object)->set_value(OS::nan_value()); | 2159 HeapNumber::cast(object)->set_value(base::OS::nan_value()); |
2160 } | 2160 } |
2161 | 2161 |
2162 | 2162 |
2163 // On Mips, a target address is stored in a lui/ori instruction pair, each | 2163 // On Mips, a target address is stored in a lui/ori instruction pair, each |
2164 // of which load 16 bits of the 32-bit address to a register. | 2164 // of which load 16 bits of the 32-bit address to a register. |
2165 // Patching the address must replace both instr, and flush the i-cache. | 2165 // Patching the address must replace both instr, and flush the i-cache. |
2166 // | 2166 // |
2167 // There is an optimization below, which emits a nop when the address | 2167 // There is an optimization below, which emits a nop when the address |
2168 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, | 2168 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, |
2169 // and possibly removed. | 2169 // and possibly removed. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 } else { | 2257 } else { |
2258 // Trying patch J, but out of range, just go back to JR. | 2258 // Trying patch J, but out of range, just go back to JR. |
2259 // JR 'rs' reg is the 'rt' reg specified in the ORI instruction (instr2). | 2259 // JR 'rs' reg is the 'rt' reg specified in the ORI instruction (instr2). |
2260 uint32_t rs_field = GetRt(instr2) << kRsShift; | 2260 uint32_t rs_field = GetRt(instr2) << kRsShift; |
2261 *(p+2) = SPECIAL | rs_field | JR; | 2261 *(p+2) = SPECIAL | rs_field | JR; |
2262 } | 2262 } |
2263 patched_jump = true; | 2263 patched_jump = true; |
2264 } | 2264 } |
2265 | 2265 |
2266 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 2266 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
2267 CPU::FlushICache(pc, (patched_jump ? 3 : 2) * sizeof(int32_t)); | 2267 CpuFeatures::FlushICache(pc, (patched_jump ? 3 : 2) * sizeof(int32_t)); |
2268 } | 2268 } |
2269 } | 2269 } |
2270 | 2270 |
2271 | 2271 |
2272 void Assembler::JumpLabelToJumpRegister(Address pc) { | 2272 void Assembler::JumpLabelToJumpRegister(Address pc) { |
2273 // Address pc points to lui/ori instructions. | 2273 // Address pc points to lui/ori instructions. |
2274 // Jump to label may follow at pc + 2 * kInstrSize. | 2274 // Jump to label may follow at pc + 2 * kInstrSize. |
2275 uint32_t* p = reinterpret_cast<uint32_t*>(pc); | 2275 uint32_t* p = reinterpret_cast<uint32_t*>(pc); |
2276 #ifdef DEBUG | 2276 #ifdef DEBUG |
2277 Instr instr1 = instr_at(pc); | 2277 Instr instr1 = instr_at(pc); |
(...skipping 13 matching lines...) Expand all Loading... |
2291 } else if (IsJ(instr3)) { | 2291 } else if (IsJ(instr3)) { |
2292 ASSERT(GetOpcodeField(instr1) == LUI); | 2292 ASSERT(GetOpcodeField(instr1) == LUI); |
2293 ASSERT(GetOpcodeField(instr2) == ORI); | 2293 ASSERT(GetOpcodeField(instr2) == ORI); |
2294 | 2294 |
2295 uint32_t rs_field = GetRt(instr2) << kRsShift; | 2295 uint32_t rs_field = GetRt(instr2) << kRsShift; |
2296 *(p+2) = SPECIAL | rs_field | JR; | 2296 *(p+2) = SPECIAL | rs_field | JR; |
2297 patched = true; | 2297 patched = true; |
2298 } | 2298 } |
2299 | 2299 |
2300 if (patched) { | 2300 if (patched) { |
2301 CPU::FlushICache(pc+2, sizeof(Address)); | 2301 CpuFeatures::FlushICache(pc+2, sizeof(Address)); |
2302 } | 2302 } |
2303 } | 2303 } |
2304 | 2304 |
2305 | 2305 |
2306 Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) { | 2306 Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) { |
2307 // No out-of-line constant pool support. | 2307 // No out-of-line constant pool support. |
2308 ASSERT(!FLAG_enable_ool_constant_pool); | 2308 ASSERT(!FLAG_enable_ool_constant_pool); |
2309 return isolate->factory()->empty_constant_pool_array(); | 2309 return isolate->factory()->empty_constant_pool_array(); |
2310 } | 2310 } |
2311 | 2311 |
2312 | 2312 |
2313 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { | 2313 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { |
2314 // No out-of-line constant pool support. | 2314 // No out-of-line constant pool support. |
2315 ASSERT(!FLAG_enable_ool_constant_pool); | 2315 ASSERT(!FLAG_enable_ool_constant_pool); |
2316 return; | 2316 return; |
2317 } | 2317 } |
2318 | 2318 |
2319 | 2319 |
2320 } } // namespace v8::internal | 2320 } } // namespace v8::internal |
2321 | 2321 |
2322 #endif // V8_TARGET_ARCH_MIPS | 2322 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |