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