| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 Address RelocInfo::target_address() { | 113 Address RelocInfo::target_address() { |
| 114 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 114 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 115 return Assembler::target_address_at(pc_); | 115 return Assembler::target_address_at(pc_); |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 Address RelocInfo::target_address_address() { | 119 Address RelocInfo::target_address_address() { |
| 120 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 120 ASSERT(IsCodeTarget(rmode_) || |
| 121 return reinterpret_cast<Address>(pc_); | 121 rmode_ == RUNTIME_ENTRY || |
| 122 rmode_ == EMBEDDED_OBJECT || |
| 123 rmode_ == EXTERNAL_REFERENCE); |
| 124 // Read the address of the word containing the target_address in an |
| 125 // instruction stream. |
| 126 // The only architecture-independent user of this function is the serializer. |
| 127 // The serializer uses it to find out how many raw bytes of instruction to |
| 128 // output before the next target. |
| 129 // For an instruction like LUI/ORI where the target bits are mixed into the |
| 130 // instruction bits, the size of the target will be zero, indicating that the |
| 131 // serializer should not step forward in memory after a target is resolved |
| 132 // and written. In this case the target_address_address function should |
| 133 // return the end of the instructions to be patched, allowing the |
| 134 // deserializer to deserialize the instructions as raw bytes and put them in |
| 135 // place, ready to be patched with the target. After jump optimization, |
| 136 // that is the address of the instruction that follows J/JAL/JR/JALR |
| 137 // instruction. |
| 138 return reinterpret_cast<Address>( |
| 139 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); |
| 122 } | 140 } |
| 123 | 141 |
| 124 | 142 |
| 125 int RelocInfo::target_address_size() { | 143 int RelocInfo::target_address_size() { |
| 126 return Assembler::kExternalTargetSize; | 144 return Assembler::kExternalTargetSize; |
| 127 } | 145 } |
| 128 | 146 |
| 129 | 147 |
| 130 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { | 148 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
| 131 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 149 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 292 |
| 275 void RelocInfo::Visit(ObjectVisitor* visitor) { | 293 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 276 RelocInfo::Mode mode = rmode(); | 294 RelocInfo::Mode mode = rmode(); |
| 277 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 295 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 278 visitor->VisitEmbeddedPointer(this); | 296 visitor->VisitEmbeddedPointer(this); |
| 279 } else if (RelocInfo::IsCodeTarget(mode)) { | 297 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 280 visitor->VisitCodeTarget(this); | 298 visitor->VisitCodeTarget(this); |
| 281 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 299 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 282 visitor->VisitGlobalPropertyCell(this); | 300 visitor->VisitGlobalPropertyCell(this); |
| 283 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 301 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 284 visitor->VisitExternalReference(target_reference_address()); | 302 visitor->VisitExternalReference(this); |
| 285 #ifdef ENABLE_DEBUGGER_SUPPORT | 303 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 286 // TODO(isolates): Get a cached isolate below. | 304 // TODO(isolates): Get a cached isolate below. |
| 287 } else if (((RelocInfo::IsJSReturn(mode) && | 305 } else if (((RelocInfo::IsJSReturn(mode) && |
| 288 IsPatchedReturnSequence()) || | 306 IsPatchedReturnSequence()) || |
| 289 (RelocInfo::IsDebugBreakSlot(mode) && | 307 (RelocInfo::IsDebugBreakSlot(mode) && |
| 290 IsPatchedDebugBreakSlotSequence())) && | 308 IsPatchedDebugBreakSlotSequence())) && |
| 291 Isolate::Current()->debug()->has_break_points()) { | 309 Isolate::Current()->debug()->has_break_points()) { |
| 292 visitor->VisitDebugTarget(this); | 310 visitor->VisitDebugTarget(this); |
| 293 #endif | 311 #endif |
| 294 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 312 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 295 visitor->VisitRuntimeEntry(this); | 313 visitor->VisitRuntimeEntry(this); |
| 296 } | 314 } |
| 297 } | 315 } |
| 298 | 316 |
| 299 | 317 |
| 300 template<typename StaticVisitor> | 318 template<typename StaticVisitor> |
| 301 void RelocInfo::Visit(Heap* heap) { | 319 void RelocInfo::Visit(Heap* heap) { |
| 302 RelocInfo::Mode mode = rmode(); | 320 RelocInfo::Mode mode = rmode(); |
| 303 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 321 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 304 StaticVisitor::VisitEmbeddedPointer(heap, this); | 322 StaticVisitor::VisitEmbeddedPointer(heap, this); |
| 305 } else if (RelocInfo::IsCodeTarget(mode)) { | 323 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 306 StaticVisitor::VisitCodeTarget(heap, this); | 324 StaticVisitor::VisitCodeTarget(heap, this); |
| 307 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 325 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 308 StaticVisitor::VisitGlobalPropertyCell(heap, this); | 326 StaticVisitor::VisitGlobalPropertyCell(heap, this); |
| 309 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 327 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 310 StaticVisitor::VisitExternalReference(target_reference_address()); | 328 StaticVisitor::VisitExternalReference(this); |
| 311 #ifdef ENABLE_DEBUGGER_SUPPORT | 329 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 312 } else if (heap->isolate()->debug()->has_break_points() && | 330 } else if (heap->isolate()->debug()->has_break_points() && |
| 313 ((RelocInfo::IsJSReturn(mode) && | 331 ((RelocInfo::IsJSReturn(mode) && |
| 314 IsPatchedReturnSequence()) || | 332 IsPatchedReturnSequence()) || |
| 315 (RelocInfo::IsDebugBreakSlot(mode) && | 333 (RelocInfo::IsDebugBreakSlot(mode) && |
| 316 IsPatchedDebugBreakSlotSequence()))) { | 334 IsPatchedDebugBreakSlotSequence()))) { |
| 317 StaticVisitor::VisitDebugTarget(heap, this); | 335 StaticVisitor::VisitDebugTarget(heap, this); |
| 318 #endif | 336 #endif |
| 319 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 337 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 320 StaticVisitor::VisitRuntimeEntry(this); | 338 StaticVisitor::VisitRuntimeEntry(this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 346 } | 364 } |
| 347 *reinterpret_cast<Instr*>(pc_) = x; | 365 *reinterpret_cast<Instr*>(pc_) = x; |
| 348 pc_ += kInstrSize; | 366 pc_ += kInstrSize; |
| 349 CheckTrampolinePoolQuick(); | 367 CheckTrampolinePoolQuick(); |
| 350 } | 368 } |
| 351 | 369 |
| 352 | 370 |
| 353 } } // namespace v8::internal | 371 } } // namespace v8::internal |
| 354 | 372 |
| 355 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 373 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |