| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, Code* code) { | 77 void RelocInfo::set_target_address(Address target, Code* code) { |
| 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 (code != NULL && IsCodeTarget(rmode_)) { | 80 if (code != NULL && IsCodeTarget(rmode_)) { |
| 81 Object* target_code = Code::GetCodeFromTargetAddress(target); | 81 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 82 // TODO(gc) We do not compact code pages. |
| 82 code->GetHeap()->incremental_marking()->RecordWrite( | 83 code->GetHeap()->incremental_marking()->RecordWrite( |
| 83 code, HeapObject::cast(target_code)); | 84 code, NULL, HeapObject::cast(target_code)); |
| 84 } | 85 } |
| 85 } | 86 } |
| 86 | 87 |
| 87 | 88 |
| 88 Object* RelocInfo::target_object() { | 89 Object* RelocInfo::target_object() { |
| 89 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 90 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 90 return Memory::Object_at(Assembler::target_address_address_at(pc_)); | 91 return Memory::Object_at(Assembler::target_address_address_at(pc_)); |
| 91 } | 92 } |
| 92 | 93 |
| 93 | 94 |
| 94 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 95 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 95 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 96 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 96 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); | 97 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); |
| 97 } | 98 } |
| 98 | 99 |
| 99 | 100 |
| 100 Object** RelocInfo::target_object_address() { | 101 Object** RelocInfo::target_object_address() { |
| 101 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 102 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 102 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); | 103 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); |
| 103 } | 104 } |
| 104 | 105 |
| 105 | 106 |
| 106 void RelocInfo::set_target_object(Object* target, Code* code) { | 107 void RelocInfo::set_target_object(Object* target, Code* code) { |
| 107 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 108 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 108 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); | 109 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); |
| 109 if (code != NULL && target->IsHeapObject()) { | 110 if (code != NULL && target->IsHeapObject()) { |
| 111 // It is safe to record this slot as a simple in object slot |
| 112 // because it resides outside of code stream and updating it |
| 113 // does not require code cache flushing. |
| 110 code->GetHeap()->incremental_marking()->RecordWrite( | 114 code->GetHeap()->incremental_marking()->RecordWrite( |
| 111 code, HeapObject::cast(target)); | 115 code, target_object_address(), HeapObject::cast(target)); |
| 112 } | 116 } |
| 113 } | 117 } |
| 114 | 118 |
| 115 | 119 |
| 116 Address* RelocInfo::target_reference_address() { | 120 Address* RelocInfo::target_reference_address() { |
| 117 ASSERT(rmode_ == EXTERNAL_REFERENCE); | 121 ASSERT(rmode_ == EXTERNAL_REFERENCE); |
| 118 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); | 122 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); |
| 119 } | 123 } |
| 120 | 124 |
| 121 | 125 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 134 address - JSGlobalPropertyCell::kValueOffset); | 138 address - JSGlobalPropertyCell::kValueOffset); |
| 135 return reinterpret_cast<JSGlobalPropertyCell*>(object); | 139 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 136 } | 140 } |
| 137 | 141 |
| 138 | 142 |
| 139 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, Code* code) { | 143 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, Code* code) { |
| 140 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 144 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 141 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | 145 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 142 Memory::Address_at(pc_) = address; | 146 Memory::Address_at(pc_) = address; |
| 143 if (code != NULL) { | 147 if (code != NULL) { |
| 144 code->GetHeap()->incremental_marking()->RecordWrite(code, cell); | 148 code->GetHeap()->incremental_marking()->RecordWrite( |
| 149 code, &Memory::Object_at(pc_), cell); |
| 145 } | 150 } |
| 146 } | 151 } |
| 147 | 152 |
| 148 | 153 |
| 149 Address RelocInfo::call_address() { | 154 Address RelocInfo::call_address() { |
| 150 // The 2 instructions offset assumes patched debug break slot or return | 155 // The 2 instructions offset assumes patched debug break slot or return |
| 151 // sequence. | 156 // sequence. |
| 152 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 157 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 153 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 158 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 154 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize); | 159 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // CPU::FlushICache(pc, sizeof(target)); | 361 // CPU::FlushICache(pc, sizeof(target)); |
| 357 // However, on ARM, no instruction was actually patched by the assignment | 362 // However, on ARM, no instruction was actually patched by the assignment |
| 358 // above; the target address is not part of an instruction, it is patched in | 363 // above; the target address is not part of an instruction, it is patched in |
| 359 // the constant pool and is read via a data access; the instruction accessing | 364 // the constant pool and is read via a data access; the instruction accessing |
| 360 // this address in the constant pool remains unchanged. | 365 // this address in the constant pool remains unchanged. |
| 361 } | 366 } |
| 362 | 367 |
| 363 } } // namespace v8::internal | 368 } } // namespace v8::internal |
| 364 | 369 |
| 365 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 370 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
| OLD | NEW |