OLD | NEW |
1 | 1 |
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 2 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
3 // All Rights Reserved. | 3 // All Rights Reserved. |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // - Redistributions of source code must retain the above copyright notice, | 9 // - Redistributions of source code must retain the above copyright notice, |
10 // this list of conditions and the following disclaimer. | 10 // this list of conditions and the following disclaimer. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 int RelocInfo::target_address_size() { | 138 int RelocInfo::target_address_size() { |
139 return Assembler::kSpecialTargetSize; | 139 return Assembler::kSpecialTargetSize; |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 void RelocInfo::set_target_address(Address target, | 143 void RelocInfo::set_target_address(Address target, |
144 WriteBarrierMode write_barrier_mode, | 144 WriteBarrierMode write_barrier_mode, |
145 ICacheFlushMode icache_flush_mode) { | 145 ICacheFlushMode icache_flush_mode) { |
146 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 146 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
147 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); | 147 Assembler::set_target_address_at(isolate_, pc_, host_, target, |
| 148 icache_flush_mode); |
148 if (write_barrier_mode == UPDATE_WRITE_BARRIER && | 149 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
149 host() != NULL && IsCodeTarget(rmode_)) { | 150 host() != NULL && IsCodeTarget(rmode_)) { |
150 Object* target_code = Code::GetCodeFromTargetAddress(target); | 151 Object* target_code = Code::GetCodeFromTargetAddress(target); |
151 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 152 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
152 host(), this, HeapObject::cast(target_code)); | 153 host(), this, HeapObject::cast(target_code)); |
153 } | 154 } |
154 } | 155 } |
155 | 156 |
156 | 157 |
157 Address Assembler::target_address_from_return_address(Address pc) { | 158 Address Assembler::target_address_from_return_address(Address pc) { |
(...skipping 13 matching lines...) Expand all Loading... |
171 uint64_t imm26 = imm28 >> 2; | 172 uint64_t imm26 = imm28 >> 2; |
172 DCHECK(is_uint26(imm26)); | 173 DCHECK(is_uint26(imm26)); |
173 | 174 |
174 instr_at_put(pc, instr | (imm26 & kImm26Mask)); | 175 instr_at_put(pc, instr | (imm26 & kImm26Mask)); |
175 // Currently used only by deserializer, and all code will be flushed | 176 // Currently used only by deserializer, and all code will be flushed |
176 // after complete deserialization, no need to flush on each reference. | 177 // after complete deserialization, no need to flush on each reference. |
177 } | 178 } |
178 | 179 |
179 | 180 |
180 void Assembler::deserialization_set_target_internal_reference_at( | 181 void Assembler::deserialization_set_target_internal_reference_at( |
181 Address pc, Address target, RelocInfo::Mode mode) { | 182 Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) { |
182 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { | 183 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
183 DCHECK(IsJ(instr_at(pc))); | 184 DCHECK(IsJ(instr_at(pc))); |
184 set_target_internal_reference_encoded_at(pc, target); | 185 set_target_internal_reference_encoded_at(pc, target); |
185 } else { | 186 } else { |
186 DCHECK(mode == RelocInfo::INTERNAL_REFERENCE); | 187 DCHECK(mode == RelocInfo::INTERNAL_REFERENCE); |
187 Memory::Address_at(pc) = target; | 188 Memory::Address_at(pc) = target; |
188 } | 189 } |
189 } | 190 } |
190 | 191 |
191 | 192 |
192 Object* RelocInfo::target_object() { | 193 Object* RelocInfo::target_object() { |
193 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 194 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
194 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); | 195 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); |
195 } | 196 } |
196 | 197 |
197 | 198 |
198 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 199 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
199 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 200 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
200 return Handle<Object>(reinterpret_cast<Object**>( | 201 return Handle<Object>(reinterpret_cast<Object**>( |
201 Assembler::target_address_at(pc_, host_))); | 202 Assembler::target_address_at(pc_, host_))); |
202 } | 203 } |
203 | 204 |
204 | 205 |
205 void RelocInfo::set_target_object(Object* target, | 206 void RelocInfo::set_target_object(Object* target, |
206 WriteBarrierMode write_barrier_mode, | 207 WriteBarrierMode write_barrier_mode, |
207 ICacheFlushMode icache_flush_mode) { | 208 ICacheFlushMode icache_flush_mode) { |
208 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 209 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
209 Assembler::set_target_address_at(pc_, host_, | 210 Assembler::set_target_address_at(isolate_, pc_, host_, |
210 reinterpret_cast<Address>(target), | 211 reinterpret_cast<Address>(target), |
211 icache_flush_mode); | 212 icache_flush_mode); |
212 if (write_barrier_mode == UPDATE_WRITE_BARRIER && | 213 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
213 host() != NULL && | 214 host() != NULL && |
214 target->IsHeapObject()) { | 215 target->IsHeapObject()) { |
215 host()->GetHeap()->incremental_marking()->RecordWrite( | 216 host()->GetHeap()->incremental_marking()->RecordWrite( |
216 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 217 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
217 } | 218 } |
218 } | 219 } |
219 | 220 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 Code* RelocInfo::code_age_stub() { | 302 Code* RelocInfo::code_age_stub() { |
302 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 303 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
303 return Code::GetCodeFromTargetAddress( | 304 return Code::GetCodeFromTargetAddress( |
304 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_)); | 305 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_)); |
305 } | 306 } |
306 | 307 |
307 | 308 |
308 void RelocInfo::set_code_age_stub(Code* stub, | 309 void RelocInfo::set_code_age_stub(Code* stub, |
309 ICacheFlushMode icache_flush_mode) { | 310 ICacheFlushMode icache_flush_mode) { |
310 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 311 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
311 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, | 312 Assembler::set_target_address_at(isolate_, pc_ + Assembler::kInstrSize, host_, |
312 host_, | |
313 stub->instruction_start()); | 313 stub->instruction_start()); |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 Address RelocInfo::debug_call_address() { | 317 Address RelocInfo::debug_call_address() { |
318 // The pc_ offset of 0 assumes patched debug break slot or return | 318 // The pc_ offset of 0 assumes patched debug break slot or return |
319 // sequence. | 319 // sequence. |
320 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 320 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
321 return Assembler::target_address_at(pc_, host_); | 321 return Assembler::target_address_at(pc_, host_); |
322 } | 322 } |
323 | 323 |
324 | 324 |
325 void RelocInfo::set_debug_call_address(Address target) { | 325 void RelocInfo::set_debug_call_address(Address target) { |
326 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 326 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
327 // The pc_ offset of 0 assumes patched debug break slot or return | 327 // The pc_ offset of 0 assumes patched debug break slot or return |
328 // sequence. | 328 // sequence. |
329 Assembler::set_target_address_at(pc_, host_, target); | 329 Assembler::set_target_address_at(isolate_, pc_, host_, target); |
330 if (host() != NULL) { | 330 if (host() != NULL) { |
331 Object* target_code = Code::GetCodeFromTargetAddress(target); | 331 Object* target_code = Code::GetCodeFromTargetAddress(target); |
332 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 332 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
333 host(), this, HeapObject::cast(target_code)); | 333 host(), this, HeapObject::cast(target_code)); |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 | 337 |
338 void RelocInfo::WipeOut() { | 338 void RelocInfo::WipeOut() { |
339 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || | 339 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
340 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || | 340 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
341 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); | 341 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); |
342 if (IsInternalReference(rmode_)) { | 342 if (IsInternalReference(rmode_)) { |
343 Memory::Address_at(pc_) = NULL; | 343 Memory::Address_at(pc_) = NULL; |
344 } else if (IsInternalReferenceEncoded(rmode_)) { | 344 } else if (IsInternalReferenceEncoded(rmode_)) { |
345 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); | 345 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); |
346 } else { | 346 } else { |
347 Assembler::set_target_address_at(pc_, host_, NULL); | 347 Assembler::set_target_address_at(isolate_, pc_, host_, NULL); |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 | 351 |
352 bool RelocInfo::IsPatchedReturnSequence() { | 352 bool RelocInfo::IsPatchedReturnSequence() { |
353 Instr instr0 = Assembler::instr_at(pc_); // lui. | 353 Instr instr0 = Assembler::instr_at(pc_); // lui. |
354 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); // ori. | 354 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); // ori. |
355 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); // dsll. | 355 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); // dsll. |
356 Instr instr3 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); // ori. | 356 Instr instr3 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); // ori. |
357 Instr instr4 = Assembler::instr_at(pc_ + 4 * Assembler::kInstrSize); // jalr. | 357 Instr instr4 = Assembler::instr_at(pc_ + 4 * Assembler::kInstrSize); // jalr. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 *reinterpret_cast<uint64_t*>(pc_) = x; | 455 *reinterpret_cast<uint64_t*>(pc_) = x; |
456 pc_ += kInstrSize * 2; | 456 pc_ += kInstrSize * 2; |
457 CheckTrampolinePoolQuick(); | 457 CheckTrampolinePoolQuick(); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 } // namespace internal | 461 } // namespace internal |
462 } // namespace v8 | 462 } // namespace v8 |
463 | 463 |
464 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 464 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
OLD | NEW |