OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void Assembler::set_target_address_at(Address pc, Address target) { | 140 void Assembler::set_target_address_at(Address pc, Address target) { |
141 Memory::Address_at(pc) = target; | 141 Memory::Address_at(pc) = target; |
142 CPU::FlushICache(pc, sizeof(intptr_t)); | 142 CPU::FlushICache(pc, sizeof(intptr_t)); |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 // ----------------------------------------------------------------------------- | 146 // ----------------------------------------------------------------------------- |
147 // Implementation of RelocInfo | 147 // Implementation of RelocInfo |
148 | 148 |
149 // The modes possibly affected by apply must be in kApplyMask. | 149 // The modes possibly affected by apply must be in kApplyMask. |
150 void RelocInfo::apply(int delta) { | 150 void RelocInfo::apply(intptr_t delta) { |
151 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { | 151 if (IsInternalReference(rmode_)) { |
152 intptr_t* p = reinterpret_cast<intptr_t*>(pc_); | |
153 *p -= delta; // relocate entry | |
154 } else if (IsInternalReference(rmode_)) { | |
155 // absolute code pointer inside code object moves with the code object. | 152 // absolute code pointer inside code object moves with the code object. |
156 intptr_t* p = reinterpret_cast<intptr_t*>(pc_); | 153 intptr_t* p = reinterpret_cast<intptr_t*>(pc_); |
157 *p += delta; // relocate entry | 154 *p += delta; // relocate entry |
158 } | 155 } |
159 } | 156 } |
160 | 157 |
161 | 158 |
162 Address RelocInfo::target_address() { | 159 Address RelocInfo::target_address() { |
163 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 160 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
164 return Assembler::target_address_at(pc_); | 161 return Assembler::target_address_at(pc_); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ASSERT(len_ == 1 || len_ == 2); | 272 ASSERT(len_ == 1 || len_ == 2); |
276 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 273 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
277 *p = disp; | 274 *p = disp; |
278 len_ += sizeof(int32_t); | 275 len_ += sizeof(int32_t); |
279 } | 276 } |
280 | 277 |
281 | 278 |
282 } } // namespace v8::internal | 279 } } // namespace v8::internal |
283 | 280 |
284 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 281 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |