| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 Address RelocInfo::target_address() { | 102 Address RelocInfo::target_address() { |
| 103 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 103 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 104 return Assembler::target_address_at(pc_); | 104 return Assembler::target_address_at(pc_); |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 Address RelocInfo::target_address_address() { | 108 Address RelocInfo::target_address_address() { |
| 109 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 109 ASSERT(IsCodeTarget(rmode_) || |
| 110 return reinterpret_cast<Address>(pc_); | 110 rmode_ == RUNTIME_ENTRY || |
| 111 rmode_ == EMBEDDED_OBJECT || |
| 112 rmode_ == EXTERNAL_REFERENCE); |
| 113 // Read the address of the word containing the target_address in an |
| 114 // instruction stream. |
| 115 // The only architecture-independent user of this function is the serializer. |
| 116 // The serializer uses it to find out how many raw bytes of instruction to |
| 117 // output before the next target. |
| 118 // For an instruction like LUI/ORI where the target bits are mixed into the |
| 119 // instruction bits, the size of the target will be zero, indicating that the |
| 120 // serializer should not step forward in memory after a target is resolved |
| 121 // and written. In this case the target_address_address function should |
| 122 // return the end of the instructions to be patched, allowing the |
| 123 // deserializer to deserialize the instructions as raw bytes and put them in |
| 124 // place, ready to be patched with the target. After jump optimization, |
| 125 // that is the address of the instruction that follows J/JAL/JR/JALR |
| 126 // instruction. |
| 127 return reinterpret_cast<Address>( |
| 128 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); |
| 111 } | 129 } |
| 112 | 130 |
| 113 | 131 |
| 114 int RelocInfo::target_address_size() { | 132 int RelocInfo::target_address_size() { |
| 115 return Assembler::kExternalTargetSize; | 133 return Assembler::kExternalTargetSize; |
| 116 } | 134 } |
| 117 | 135 |
| 118 | 136 |
| 119 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { | 137 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
| 120 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 138 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 281 |
| 264 void RelocInfo::Visit(ObjectVisitor* visitor) { | 282 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 265 RelocInfo::Mode mode = rmode(); | 283 RelocInfo::Mode mode = rmode(); |
| 266 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 284 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 267 visitor->VisitEmbeddedPointer(this); | 285 visitor->VisitEmbeddedPointer(this); |
| 268 } else if (RelocInfo::IsCodeTarget(mode)) { | 286 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 269 visitor->VisitCodeTarget(this); | 287 visitor->VisitCodeTarget(this); |
| 270 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 288 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 271 visitor->VisitGlobalPropertyCell(this); | 289 visitor->VisitGlobalPropertyCell(this); |
| 272 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 290 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 273 visitor->VisitExternalReference(target_reference_address()); | 291 visitor->VisitExternalReference(this); |
| 274 #ifdef ENABLE_DEBUGGER_SUPPORT | 292 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 275 // TODO(isolates): Get a cached isolate below. | 293 // TODO(isolates): Get a cached isolate below. |
| 276 } else if (((RelocInfo::IsJSReturn(mode) && | 294 } else if (((RelocInfo::IsJSReturn(mode) && |
| 277 IsPatchedReturnSequence()) || | 295 IsPatchedReturnSequence()) || |
| 278 (RelocInfo::IsDebugBreakSlot(mode) && | 296 (RelocInfo::IsDebugBreakSlot(mode) && |
| 279 IsPatchedDebugBreakSlotSequence())) && | 297 IsPatchedDebugBreakSlotSequence())) && |
| 280 Isolate::Current()->debug()->has_break_points()) { | 298 Isolate::Current()->debug()->has_break_points()) { |
| 281 visitor->VisitDebugTarget(this); | 299 visitor->VisitDebugTarget(this); |
| 282 #endif | 300 #endif |
| 283 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 301 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 284 visitor->VisitRuntimeEntry(this); | 302 visitor->VisitRuntimeEntry(this); |
| 285 } | 303 } |
| 286 } | 304 } |
| 287 | 305 |
| 288 | 306 |
| 289 template<typename StaticVisitor> | 307 template<typename StaticVisitor> |
| 290 void RelocInfo::Visit(Heap* heap) { | 308 void RelocInfo::Visit(Heap* heap) { |
| 291 RelocInfo::Mode mode = rmode(); | 309 RelocInfo::Mode mode = rmode(); |
| 292 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 310 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 293 StaticVisitor::VisitEmbeddedPointer(heap, this); | 311 StaticVisitor::VisitEmbeddedPointer(heap, this); |
| 294 } else if (RelocInfo::IsCodeTarget(mode)) { | 312 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 295 StaticVisitor::VisitCodeTarget(heap, this); | 313 StaticVisitor::VisitCodeTarget(heap, this); |
| 296 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 314 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 297 StaticVisitor::VisitGlobalPropertyCell(heap, this); | 315 StaticVisitor::VisitGlobalPropertyCell(heap, this); |
| 298 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 316 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 299 StaticVisitor::VisitExternalReference(target_reference_address()); | 317 StaticVisitor::VisitExternalReference(this); |
| 300 #ifdef ENABLE_DEBUGGER_SUPPORT | 318 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 301 } else if (heap->isolate()->debug()->has_break_points() && | 319 } else if (heap->isolate()->debug()->has_break_points() && |
| 302 ((RelocInfo::IsJSReturn(mode) && | 320 ((RelocInfo::IsJSReturn(mode) && |
| 303 IsPatchedReturnSequence()) || | 321 IsPatchedReturnSequence()) || |
| 304 (RelocInfo::IsDebugBreakSlot(mode) && | 322 (RelocInfo::IsDebugBreakSlot(mode) && |
| 305 IsPatchedDebugBreakSlotSequence()))) { | 323 IsPatchedDebugBreakSlotSequence()))) { |
| 306 StaticVisitor::VisitDebugTarget(heap, this); | 324 StaticVisitor::VisitDebugTarget(heap, this); |
| 307 #endif | 325 #endif |
| 308 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 326 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
| 309 StaticVisitor::VisitRuntimeEntry(this); | 327 StaticVisitor::VisitRuntimeEntry(this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 335 } | 353 } |
| 336 *reinterpret_cast<Instr*>(pc_) = x; | 354 *reinterpret_cast<Instr*>(pc_) = x; |
| 337 pc_ += kInstrSize; | 355 pc_ += kInstrSize; |
| 338 CheckTrampolinePoolQuick(); | 356 CheckTrampolinePoolQuick(); |
| 339 } | 357 } |
| 340 | 358 |
| 341 | 359 |
| 342 } } // namespace v8::internal | 360 } } // namespace v8::internal |
| 343 | 361 |
| 344 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 362 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |