| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 67 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 68 return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_)); | 68 return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 int RelocInfo::target_address_size() { | 72 int RelocInfo::target_address_size() { |
| 73 return Assembler::kExternalTargetSize; | 73 return Assembler::kExternalTargetSize; |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 void RelocInfo::set_target_address(Address target) { | 77 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
| 78 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 78 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 79 Assembler::set_target_address_at(pc_, target); | 79 Assembler::set_target_address_at(pc_, target); |
| 80 if (host() != NULL && IsCodeTarget(rmode_)) { | 80 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { |
| 81 Object* target_code = Code::GetCodeFromTargetAddress(target); | 81 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 82 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 82 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 83 host(), this, HeapObject::cast(target_code)); | 83 host(), this, HeapObject::cast(target_code)); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 Object* RelocInfo::target_object() { | 88 Object* RelocInfo::target_object() { |
| 89 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 89 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 90 return Memory::Object_at(Assembler::target_address_address_at(pc_)); | 90 return Memory::Object_at(Assembler::target_address_address_at(pc_)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 94 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 95 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 95 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 96 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); | 96 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 Object** RelocInfo::target_object_address() { | 100 Object** RelocInfo::target_object_address() { |
| 101 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 101 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 102 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); | 102 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 void RelocInfo::set_target_object(Object* target) { | 106 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
| 107 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 107 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 108 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); | 108 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); |
| 109 if (host() != NULL && target->IsHeapObject()) { | 109 if (mode == UPDATE_WRITE_BARRIER && |
| 110 host() != NULL && |
| 111 target->IsHeapObject()) { |
| 110 host()->GetHeap()->incremental_marking()->RecordWrite( | 112 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 111 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 113 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 112 } | 114 } |
| 113 } | 115 } |
| 114 | 116 |
| 115 | 117 |
| 116 Address* RelocInfo::target_reference_address() { | 118 Address* RelocInfo::target_reference_address() { |
| 117 ASSERT(rmode_ == EXTERNAL_REFERENCE); | 119 ASSERT(rmode_ == EXTERNAL_REFERENCE); |
| 118 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); | 120 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); |
| 119 } | 121 } |
| 120 | 122 |
| 121 | 123 |
| 122 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { | 124 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
| 123 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 125 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 124 Address address = Memory::Address_at(pc_); | 126 Address address = Memory::Address_at(pc_); |
| 125 return Handle<JSGlobalPropertyCell>( | 127 return Handle<JSGlobalPropertyCell>( |
| 126 reinterpret_cast<JSGlobalPropertyCell**>(address)); | 128 reinterpret_cast<JSGlobalPropertyCell**>(address)); |
| 127 } | 129 } |
| 128 | 130 |
| 129 | 131 |
| 130 JSGlobalPropertyCell* RelocInfo::target_cell() { | 132 JSGlobalPropertyCell* RelocInfo::target_cell() { |
| 131 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 133 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 132 Address address = Memory::Address_at(pc_); | 134 Address address = Memory::Address_at(pc_); |
| 133 Object* object = HeapObject::FromAddress( | 135 Object* object = HeapObject::FromAddress( |
| 134 address - JSGlobalPropertyCell::kValueOffset); | 136 address - JSGlobalPropertyCell::kValueOffset); |
| 135 return reinterpret_cast<JSGlobalPropertyCell*>(object); | 137 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 136 } | 138 } |
| 137 | 139 |
| 138 | 140 |
| 139 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { | 141 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, |
| 142 WriteBarrierMode mode) { |
| 140 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 143 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 141 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | 144 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 142 Memory::Address_at(pc_) = address; | 145 Memory::Address_at(pc_) = address; |
| 143 if (host() != NULL) { | 146 if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { |
| 144 // TODO(1550) We are passing NULL as a slot because cell can never be on | 147 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 145 // evacuation candidate. | 148 // evacuation candidate. |
| 146 host()->GetHeap()->incremental_marking()->RecordWrite( | 149 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 147 host(), NULL, cell); | 150 host(), NULL, cell); |
| 148 } | 151 } |
| 149 } | 152 } |
| 150 | 153 |
| 151 | 154 |
| 152 Address RelocInfo::call_address() { | 155 Address RelocInfo::call_address() { |
| 153 // The 2 instructions offset assumes patched debug break slot or return | 156 // The 2 instructions offset assumes patched debug break slot or return |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // CPU::FlushICache(pc, sizeof(target)); | 367 // CPU::FlushICache(pc, sizeof(target)); |
| 365 // However, on ARM, no instruction was actually patched by the assignment | 368 // However, on ARM, no instruction was actually patched by the assignment |
| 366 // above; the target address is not part of an instruction, it is patched in | 369 // above; the target address is not part of an instruction, it is patched in |
| 367 // the constant pool and is read via a data access; the instruction accessing | 370 // the constant pool and is read via a data access; the instruction accessing |
| 368 // this address in the constant pool remains unchanged. | 371 // this address in the constant pool remains unchanged. |
| 369 } | 372 } |
| 370 | 373 |
| 371 } } // namespace v8::internal | 374 } } // namespace v8::internal |
| 372 | 375 |
| 373 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 376 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
| OLD | NEW |