| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 | 185 |
| 186 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 186 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 187 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 187 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 188 return Handle<Object>(reinterpret_cast<Object**>( | 188 return Handle<Object>(reinterpret_cast<Object**>( |
| 189 Assembler::target_address_at(pc_))); | 189 Assembler::target_address_at(pc_))); |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| 193 Object** RelocInfo::target_object_address() { | |
| 194 // Provide a "natural pointer" to the embedded object, | |
| 195 // which can be de-referenced during heap iteration. | |
| 196 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | |
| 197 reconstructed_obj_ptr_ = | |
| 198 reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); | |
| 199 return &reconstructed_obj_ptr_; | |
| 200 } | |
| 201 | |
| 202 | |
| 203 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { | 193 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
| 204 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 194 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 205 ASSERT(!target->IsConsString()); | 195 ASSERT(!target->IsConsString()); |
| 206 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); | 196 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); |
| 207 if (mode == UPDATE_WRITE_BARRIER && | 197 if (mode == UPDATE_WRITE_BARRIER && |
| 208 host() != NULL && | 198 host() != NULL && |
| 209 target->IsHeapObject()) { | 199 target->IsHeapObject()) { |
| 210 host()->GetHeap()->incremental_marking()->RecordWrite( | 200 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 211 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 201 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 212 } | 202 } |
| 213 } | 203 } |
| 214 | 204 |
| 215 | 205 |
| 216 Address* RelocInfo::target_reference_address() { | 206 Address RelocInfo::target_reference() { |
| 217 ASSERT(rmode_ == EXTERNAL_REFERENCE); | 207 ASSERT(rmode_ == EXTERNAL_REFERENCE); |
| 218 reconstructed_adr_ptr_ = Assembler::target_address_at(pc_); | 208 return Assembler::target_address_at(pc_); |
| 219 return &reconstructed_adr_ptr_; | |
| 220 } | 209 } |
| 221 | 210 |
| 222 | 211 |
| 223 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 212 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
| 224 ASSERT(IsRuntimeEntry(rmode_)); | 213 ASSERT(IsRuntimeEntry(rmode_)); |
| 225 return target_address(); | 214 return target_address(); |
| 226 } | 215 } |
| 227 | 216 |
| 228 | 217 |
| 229 void RelocInfo::set_target_runtime_entry(Address target, | 218 void RelocInfo::set_target_runtime_entry(Address target, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 308 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 320 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); | 309 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); |
| 321 } | 310 } |
| 322 | 311 |
| 323 | 312 |
| 324 void RelocInfo::set_call_object(Object* target) { | 313 void RelocInfo::set_call_object(Object* target) { |
| 325 *call_object_address() = target; | 314 *call_object_address() = target; |
| 326 } | 315 } |
| 327 | 316 |
| 328 | 317 |
| 318 void RelocInfo::WipeOut() { |
| 319 ASSERT(IsEmbeddedObject(rmode_) || |
| 320 IsCodeTarget(rmode_) || |
| 321 IsRuntimeEntry(rmode_) || |
| 322 IsExternalReference(rmode_)); |
| 323 Assembler::set_target_address_at(pc_, NULL); |
| 324 } |
| 325 |
| 326 |
| 329 bool RelocInfo::IsPatchedReturnSequence() { | 327 bool RelocInfo::IsPatchedReturnSequence() { |
| 330 Instr instr0 = Assembler::instr_at(pc_); | 328 Instr instr0 = Assembler::instr_at(pc_); |
| 331 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); | 329 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); |
| 332 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); | 330 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); |
| 333 bool patched_return = ((instr0 & kOpcodeMask) == LUI && | 331 bool patched_return = ((instr0 & kOpcodeMask) == LUI && |
| 334 (instr1 & kOpcodeMask) == ORI && | 332 (instr1 & kOpcodeMask) == ORI && |
| 335 ((instr2 & kOpcodeMask) == JAL || | 333 ((instr2 & kOpcodeMask) == JAL || |
| 336 ((instr2 & kOpcodeMask) == SPECIAL && | 334 ((instr2 & kOpcodeMask) == SPECIAL && |
| 337 (instr2 & kFunctionFieldMask) == JALR))); | 335 (instr2 & kFunctionFieldMask) == JALR))); |
| 338 return patched_return; | 336 return patched_return; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 420 } |
| 423 *reinterpret_cast<Instr*>(pc_) = x; | 421 *reinterpret_cast<Instr*>(pc_) = x; |
| 424 pc_ += kInstrSize; | 422 pc_ += kInstrSize; |
| 425 CheckTrampolinePoolQuick(); | 423 CheckTrampolinePoolQuick(); |
| 426 } | 424 } |
| 427 | 425 |
| 428 | 426 |
| 429 } } // namespace v8::internal | 427 } } // namespace v8::internal |
| 430 | 428 |
| 431 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 429 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |