| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (IsInternalReference(rmode_)) { | 132 if (IsInternalReference(rmode_)) { |
| 133 // Absolute code pointer inside code object moves with the code object. | 133 // Absolute code pointer inside code object moves with the code object. |
| 134 byte* p = reinterpret_cast<byte*>(pc_); | 134 byte* p = reinterpret_cast<byte*>(pc_); |
| 135 int count = Assembler::RelocateInternalReference(p, delta); | 135 int count = Assembler::RelocateInternalReference(p, delta); |
| 136 CPU::FlushICache(p, count * sizeof(uint32_t)); | 136 CPU::FlushICache(p, count * sizeof(uint32_t)); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 Address RelocInfo::target_address() { | 141 Address RelocInfo::target_address() { |
| 142 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 142 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
| 143 return Assembler::target_address_at(pc_); | 143 return Assembler::target_address_at(pc_); |
| 144 } | 144 } |
| 145 | 145 |
| 146 | 146 |
| 147 Address RelocInfo::target_address_address() { | 147 Address RelocInfo::target_address_address() { |
| 148 ASSERT(IsCodeTarget(rmode_) || | 148 ASSERT(IsCodeTarget(rmode_) || |
| 149 rmode_ == RUNTIME_ENTRY || | 149 IsRuntimeEntry(rmode_) || |
| 150 rmode_ == EMBEDDED_OBJECT || | 150 rmode_ == EMBEDDED_OBJECT || |
| 151 rmode_ == EXTERNAL_REFERENCE); | 151 rmode_ == EXTERNAL_REFERENCE); |
| 152 // Read the address of the word containing the target_address in an | 152 // Read the address of the word containing the target_address in an |
| 153 // instruction stream. | 153 // instruction stream. |
| 154 // The only architecture-independent user of this function is the serializer. | 154 // The only architecture-independent user of this function is the serializer. |
| 155 // The serializer uses it to find out how many raw bytes of instruction to | 155 // The serializer uses it to find out how many raw bytes of instruction to |
| 156 // output before the next target. | 156 // output before the next target. |
| 157 // For an instruction like LUI/ORI where the target bits are mixed into the | 157 // For an instruction like LUI/ORI where the target bits are mixed into the |
| 158 // instruction bits, the size of the target will be zero, indicating that the | 158 // instruction bits, the size of the target will be zero, indicating that the |
| 159 // serializer should not step forward in memory after a target is resolved | 159 // serializer should not step forward in memory after a target is resolved |
| 160 // and written. In this case the target_address_address function should | 160 // and written. In this case the target_address_address function should |
| 161 // return the end of the instructions to be patched, allowing the | 161 // return the end of the instructions to be patched, allowing the |
| 162 // deserializer to deserialize the instructions as raw bytes and put them in | 162 // deserializer to deserialize the instructions as raw bytes and put them in |
| 163 // place, ready to be patched with the target. After jump optimization, | 163 // place, ready to be patched with the target. After jump optimization, |
| 164 // that is the address of the instruction that follows J/JAL/JR/JALR | 164 // that is the address of the instruction that follows J/JAL/JR/JALR |
| 165 // instruction. | 165 // instruction. |
| 166 return reinterpret_cast<Address>( | 166 return reinterpret_cast<Address>( |
| 167 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); | 167 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 int RelocInfo::target_address_size() { | 171 int RelocInfo::target_address_size() { |
| 172 return Assembler::kSpecialTargetSize; | 172 return Assembler::kSpecialTargetSize; |
| 173 } | 173 } |
| 174 | 174 |
| 175 | 175 |
| 176 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { | 176 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
| 177 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 177 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
| 178 Assembler::set_target_address_at(pc_, target); | 178 Assembler::set_target_address_at(pc_, target); |
| 179 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { | 179 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { |
| 180 Object* target_code = Code::GetCodeFromTargetAddress(target); | 180 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 181 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 181 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 182 host(), this, HeapObject::cast(target_code)); | 182 host(), this, HeapObject::cast(target_code)); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 | 186 |
| 187 Address Assembler::target_address_from_return_address(Address pc) { | 187 Address Assembler::target_address_from_return_address(Address pc) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 visitor->VisitCodeAgeSequence(this); | 365 visitor->VisitCodeAgeSequence(this); |
| 366 #ifdef ENABLE_DEBUGGER_SUPPORT | 366 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 367 // TODO(isolates): Get a cached isolate below. | 367 // TODO(isolates): Get a cached isolate below. |
| 368 } else if (((RelocInfo::IsJSReturn(mode) && | 368 } else if (((RelocInfo::IsJSReturn(mode) && |
| 369 IsPatchedReturnSequence()) || | 369 IsPatchedReturnSequence()) || |
| 370 (RelocInfo::IsDebugBreakSlot(mode) && | 370 (RelocInfo::IsDebugBreakSlot(mode) && |
| 371 IsPatchedDebugBreakSlotSequence())) && | 371 IsPatchedDebugBreakSlotSequence())) && |
| 372 Isolate::Current()->debug()->has_break_points()) { | 372 Isolate::Current()->debug()->has_break_points()) { |
| 373 visitor->VisitDebugTarget(this); | 373 visitor->VisitDebugTarget(this); |
| 374 #endif | 374 #endif |
| 375 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 375 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 376 visitor->VisitRuntimeEntry(this); | 376 visitor->VisitRuntimeEntry(this); |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 | 380 |
| 381 template<typename StaticVisitor> | 381 template<typename StaticVisitor> |
| 382 void RelocInfo::Visit(Heap* heap) { | 382 void RelocInfo::Visit(Heap* heap) { |
| 383 RelocInfo::Mode mode = rmode(); | 383 RelocInfo::Mode mode = rmode(); |
| 384 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 384 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 385 StaticVisitor::VisitEmbeddedPointer(heap, this); | 385 StaticVisitor::VisitEmbeddedPointer(heap, this); |
| 386 } else if (RelocInfo::IsCodeTarget(mode)) { | 386 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 387 StaticVisitor::VisitCodeTarget(heap, this); | 387 StaticVisitor::VisitCodeTarget(heap, this); |
| 388 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 388 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 389 StaticVisitor::VisitGlobalPropertyCell(heap, this); | 389 StaticVisitor::VisitGlobalPropertyCell(heap, this); |
| 390 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 390 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 391 StaticVisitor::VisitExternalReference(this); | 391 StaticVisitor::VisitExternalReference(this); |
| 392 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 392 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
| 393 StaticVisitor::VisitCodeAgeSequence(heap, this); | 393 StaticVisitor::VisitCodeAgeSequence(heap, this); |
| 394 #ifdef ENABLE_DEBUGGER_SUPPORT | 394 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 395 } else if (heap->isolate()->debug()->has_break_points() && | 395 } else if (heap->isolate()->debug()->has_break_points() && |
| 396 ((RelocInfo::IsJSReturn(mode) && | 396 ((RelocInfo::IsJSReturn(mode) && |
| 397 IsPatchedReturnSequence()) || | 397 IsPatchedReturnSequence()) || |
| 398 (RelocInfo::IsDebugBreakSlot(mode) && | 398 (RelocInfo::IsDebugBreakSlot(mode) && |
| 399 IsPatchedDebugBreakSlotSequence()))) { | 399 IsPatchedDebugBreakSlotSequence()))) { |
| 400 StaticVisitor::VisitDebugTarget(heap, this); | 400 StaticVisitor::VisitDebugTarget(heap, this); |
| 401 #endif | 401 #endif |
| 402 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 402 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 403 StaticVisitor::VisitRuntimeEntry(this); | 403 StaticVisitor::VisitRuntimeEntry(this); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 | 407 |
| 408 // ----------------------------------------------------------------------------- | 408 // ----------------------------------------------------------------------------- |
| 409 // Assembler. | 409 // Assembler. |
| 410 | 410 |
| 411 | 411 |
| 412 void Assembler::CheckBuffer() { | 412 void Assembler::CheckBuffer() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 429 } | 429 } |
| 430 *reinterpret_cast<Instr*>(pc_) = x; | 430 *reinterpret_cast<Instr*>(pc_) = x; |
| 431 pc_ += kInstrSize; | 431 pc_ += kInstrSize; |
| 432 CheckTrampolinePoolQuick(); | 432 CheckTrampolinePoolQuick(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 } } // namespace v8::internal | 436 } } // namespace v8::internal |
| 437 | 437 |
| 438 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 438 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |