| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { |
| 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_)) { |
| 81 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 82 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 83 host(), this, HeapObject::cast(target_code)); |
| 84 } |
| 80 } | 85 } |
| 81 | 86 |
| 82 | 87 |
| 83 Object* RelocInfo::target_object() { | 88 Object* RelocInfo::target_object() { |
| 84 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 89 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 85 return Memory::Object_at(Assembler::target_address_address_at(pc_)); | 90 return Memory::Object_at(Assembler::target_address_address_at(pc_)); |
| 86 } | 91 } |
| 87 | 92 |
| 88 | 93 |
| 89 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 94 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 90 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 95 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 91 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); | 96 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); |
| 92 } | 97 } |
| 93 | 98 |
| 94 | 99 |
| 95 Object** RelocInfo::target_object_address() { | 100 Object** RelocInfo::target_object_address() { |
| 96 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 101 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 97 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); | 102 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); |
| 98 } | 103 } |
| 99 | 104 |
| 100 | 105 |
| 101 void RelocInfo::set_target_object(Object* target) { | 106 void RelocInfo::set_target_object(Object* target) { |
| 102 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 107 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 103 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()) { |
| 110 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 111 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 112 } |
| 104 } | 113 } |
| 105 | 114 |
| 106 | 115 |
| 107 Address* RelocInfo::target_reference_address() { | 116 Address* RelocInfo::target_reference_address() { |
| 108 ASSERT(rmode_ == EXTERNAL_REFERENCE); | 117 ASSERT(rmode_ == EXTERNAL_REFERENCE); |
| 109 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); | 118 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); |
| 110 } | 119 } |
| 111 | 120 |
| 112 | 121 |
| 113 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { | 122 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 124 Object* object = HeapObject::FromAddress( | 133 Object* object = HeapObject::FromAddress( |
| 125 address - JSGlobalPropertyCell::kValueOffset); | 134 address - JSGlobalPropertyCell::kValueOffset); |
| 126 return reinterpret_cast<JSGlobalPropertyCell*>(object); | 135 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 127 } | 136 } |
| 128 | 137 |
| 129 | 138 |
| 130 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { | 139 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { |
| 131 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 140 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 132 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | 141 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 133 Memory::Address_at(pc_) = address; | 142 Memory::Address_at(pc_) = address; |
| 143 if (host() != NULL) { |
| 144 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 145 // evacuation candidate. |
| 146 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 147 host(), NULL, cell); |
| 148 } |
| 134 } | 149 } |
| 135 | 150 |
| 136 | 151 |
| 137 Address RelocInfo::call_address() { | 152 Address RelocInfo::call_address() { |
| 138 // The 2 instructions offset assumes patched debug break slot or return | 153 // The 2 instructions offset assumes patched debug break slot or return |
| 139 // sequence. | 154 // sequence. |
| 140 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 155 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 141 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 156 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 142 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize); | 157 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize); |
| 143 } | 158 } |
| 144 | 159 |
| 145 | 160 |
| 146 void RelocInfo::set_call_address(Address target) { | 161 void RelocInfo::set_call_address(Address target) { |
| 147 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 162 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 148 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 163 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 149 Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target; | 164 Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target; |
| 165 if (host() != NULL) { |
| 166 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 167 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 168 host(), this, HeapObject::cast(target_code)); |
| 169 } |
| 150 } | 170 } |
| 151 | 171 |
| 152 | 172 |
| 153 Object* RelocInfo::call_object() { | 173 Object* RelocInfo::call_object() { |
| 154 return *call_object_address(); | 174 return *call_object_address(); |
| 155 } | 175 } |
| 156 | 176 |
| 157 | 177 |
| 158 void RelocInfo::set_call_object(Object* target) { | 178 void RelocInfo::set_call_object(Object* target) { |
| 159 *call_object_address() = target; | 179 *call_object_address() = target; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // CPU::FlushICache(pc, sizeof(target)); | 364 // CPU::FlushICache(pc, sizeof(target)); |
| 345 // However, on ARM, no instruction was actually patched by the assignment | 365 // However, on ARM, no instruction was actually patched by the assignment |
| 346 // above; the target address is not part of an instruction, it is patched in | 366 // above; the target address is not part of an instruction, it is patched in |
| 347 // the constant pool and is read via a data access; the instruction accessing | 367 // the constant pool and is read via a data access; the instruction accessing |
| 348 // this address in the constant pool remains unchanged. | 368 // this address in the constant pool remains unchanged. |
| 349 } | 369 } |
| 350 | 370 |
| 351 } } // namespace v8::internal | 371 } } // namespace v8::internal |
| 352 | 372 |
| 353 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 373 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
| OLD | NEW |