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 | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 Address RelocInfo::target_address_address() { | 74 Address RelocInfo::target_address_address() { |
75 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY | 75 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY |
76 || rmode_ == EMBEDDED_OBJECT | 76 || rmode_ == EMBEDDED_OBJECT |
77 || rmode_ == EXTERNAL_REFERENCE); | 77 || rmode_ == EXTERNAL_REFERENCE); |
78 return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_)); | 78 return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_)); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 int RelocInfo::target_address_size() { | 82 int RelocInfo::target_address_size() { |
83 return Assembler::kExternalTargetSize; | 83 return kPointerSize; |
84 } | 84 } |
85 | 85 |
86 | 86 |
87 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { | 87 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
88 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 88 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
89 Assembler::set_target_address_at(pc_, target); | 89 Assembler::set_target_address_at(pc_, target); |
90 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { | 90 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { |
91 Object* target_code = Code::GetCodeFromTargetAddress(target); | 91 Object* target_code = Code::GetCodeFromTargetAddress(target); |
92 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 92 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
93 host(), this, HeapObject::cast(target_code)); | 93 host(), this, HeapObject::cast(target_code)); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 ASSERT(offset >= -4); | 357 ASSERT(offset >= -4); |
358 return target_pc + offset + 8; | 358 return target_pc + offset + 8; |
359 } | 359 } |
360 | 360 |
361 | 361 |
362 Address Assembler::target_address_at(Address pc) { | 362 Address Assembler::target_address_at(Address pc) { |
363 return Memory::Address_at(target_address_address_at(pc)); | 363 return Memory::Address_at(target_address_address_at(pc)); |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 void Assembler::set_target_at(Address constant_pool_entry, | 367 void Assembler::deserialization_set_special_target_at( |
368 Address target) { | 368 Address constant_pool_entry, Address target) { |
| 369 Memory::Address_at(constant_pool_entry) = target; |
| 370 } |
| 371 |
| 372 |
| 373 void Assembler::set_external_target_at(Address constant_pool_entry, |
| 374 Address target) { |
369 Memory::Address_at(constant_pool_entry) = target; | 375 Memory::Address_at(constant_pool_entry) = target; |
370 } | 376 } |
371 | 377 |
372 | 378 |
373 void Assembler::set_target_address_at(Address pc, Address target) { | 379 void Assembler::set_target_address_at(Address pc, Address target) { |
374 Memory::Address_at(target_address_address_at(pc)) = target; | 380 Memory::Address_at(target_address_address_at(pc)) = target; |
375 // Intuitively, we would think it is necessary to flush the instruction cache | 381 // Intuitively, we would think it is necessary to flush the instruction cache |
376 // after patching a target address in the code as follows: | 382 // after patching a target address in the code as follows: |
377 // CPU::FlushICache(pc, sizeof(target)); | 383 // CPU::FlushICache(pc, sizeof(target)); |
378 // However, on ARM, no instruction was actually patched by the assignment | 384 // However, on ARM, no instruction was actually patched by the assignment |
379 // above; the target address is not part of an instruction, it is patched in | 385 // above; the target address is not part of an instruction, it is patched in |
380 // the constant pool and is read via a data access; the instruction accessing | 386 // the constant pool and is read via a data access; the instruction accessing |
381 // this address in the constant pool remains unchanged. | 387 // this address in the constant pool remains unchanged. |
382 } | 388 } |
383 | 389 |
384 } } // namespace v8::internal | 390 } } // namespace v8::internal |
385 | 391 |
386 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 392 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
OLD | NEW |