| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // ----------------------------------------------------------------------------- | 194 // ----------------------------------------------------------------------------- |
| 195 // Implementation of RelocInfo | 195 // Implementation of RelocInfo |
| 196 | 196 |
| 197 // The modes possibly affected by apply must be in kApplyMask. | 197 // The modes possibly affected by apply must be in kApplyMask. |
| 198 void RelocInfo::apply(intptr_t delta) { | 198 void RelocInfo::apply(intptr_t delta) { |
| 199 if (IsInternalReference(rmode_)) { | 199 if (IsInternalReference(rmode_)) { |
| 200 // absolute code pointer inside code object moves with the code object. | 200 // absolute code pointer inside code object moves with the code object. |
| 201 Memory::Address_at(pc_) += static_cast<int32_t>(delta); | 201 Memory::Address_at(pc_) += static_cast<int32_t>(delta); |
| 202 } else if (IsCodeTarget(rmode_)) { | 202 } else if (IsCodeTarget(rmode_)) { |
| 203 Memory::int32_at(pc_) -= static_cast<int32_t>(delta); | 203 Memory::int32_at(pc_) -= static_cast<int32_t>(delta); |
| 204 } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) { | |
| 205 // Special handling of js_return when a break point is set (call | |
| 206 // instruction has been inserted). | |
| 207 Memory::int32_at(pc_ + 1) -= static_cast<int32_t>(delta); // relocate entry | |
| 208 } else if (rmode_ == DEBUG_BREAK_SLOT && IsPatchedDebugBreakSlotSequence()) { | |
| 209 // Special handling of debug break slot when a break point is set (call | |
| 210 // instruction has been inserted). | |
| 211 Memory::int32_at(pc_ + 1) -= static_cast<int32_t>(delta); // relocate entry | |
| 212 } | 204 } |
| 213 } | 205 } |
| 214 | 206 |
| 215 | 207 |
| 216 Address RelocInfo::target_address() { | 208 Address RelocInfo::target_address() { |
| 217 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 209 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 218 if (IsCodeTarget(rmode_)) { | 210 if (IsCodeTarget(rmode_)) { |
| 219 return Assembler::target_address_at(pc_); | 211 return Assembler::target_address_at(pc_); |
| 220 } else { | 212 } else { |
| 221 return Memory::Address_at(pc_); | 213 return Memory::Address_at(pc_); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 #endif | 288 #endif |
| 297 } | 289 } |
| 298 | 290 |
| 299 | 291 |
| 300 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 292 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
| 301 return !Assembler::IsNop(pc()); | 293 return !Assembler::IsNop(pc()); |
| 302 } | 294 } |
| 303 | 295 |
| 304 | 296 |
| 305 Address RelocInfo::call_address() { | 297 Address RelocInfo::call_address() { |
| 306 ASSERT(IsPatchedReturnSequence()); | 298 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 299 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 307 return Memory::Address_at( | 300 return Memory::Address_at( |
| 308 pc_ + Assembler::kRealPatchReturnSequenceAddressOffset); | 301 pc_ + Assembler::kRealPatchReturnSequenceAddressOffset); |
| 309 } | 302 } |
| 310 | 303 |
| 311 | 304 |
| 312 void RelocInfo::set_call_address(Address target) { | 305 void RelocInfo::set_call_address(Address target) { |
| 313 ASSERT(IsPatchedReturnSequence()); | 306 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 307 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 314 Memory::Address_at(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset) = | 308 Memory::Address_at(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset) = |
| 315 target; | 309 target; |
| 316 } | 310 } |
| 317 | 311 |
| 318 | 312 |
| 319 Object* RelocInfo::call_object() { | 313 Object* RelocInfo::call_object() { |
| 320 ASSERT(IsPatchedReturnSequence()); | |
| 321 return *call_object_address(); | 314 return *call_object_address(); |
| 322 } | 315 } |
| 323 | 316 |
| 324 | 317 |
| 325 void RelocInfo::set_call_object(Object* target) { | 318 void RelocInfo::set_call_object(Object* target) { |
| 326 ASSERT(IsPatchedReturnSequence()); | |
| 327 *call_object_address() = target; | 319 *call_object_address() = target; |
| 328 } | 320 } |
| 329 | 321 |
| 330 | 322 |
| 331 Object** RelocInfo::call_object_address() { | 323 Object** RelocInfo::call_object_address() { |
| 332 ASSERT(IsPatchedReturnSequence()); | 324 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 325 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 333 return reinterpret_cast<Object**>( | 326 return reinterpret_cast<Object**>( |
| 334 pc_ + Assembler::kPatchReturnSequenceAddressOffset); | 327 pc_ + Assembler::kPatchReturnSequenceAddressOffset); |
| 335 } | 328 } |
| 336 | 329 |
| 337 | 330 |
| 338 void RelocInfo::Visit(ObjectVisitor* visitor) { | 331 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 339 RelocInfo::Mode mode = rmode(); | 332 RelocInfo::Mode mode = rmode(); |
| 340 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 333 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 341 visitor->VisitPointer(target_object_address()); | 334 visitor->VisitPointer(target_object_address()); |
| 342 } else if (RelocInfo::IsCodeTarget(mode)) { | 335 } else if (RelocInfo::IsCodeTarget(mode)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 ASSERT(len_ == 1 || len_ == 2); | 384 ASSERT(len_ == 1 || len_ == 2); |
| 392 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 385 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 393 *p = disp; | 386 *p = disp; |
| 394 len_ += sizeof(int32_t); | 387 len_ += sizeof(int32_t); |
| 395 } | 388 } |
| 396 | 389 |
| 397 | 390 |
| 398 } } // namespace v8::internal | 391 } } // namespace v8::internal |
| 399 | 392 |
| 400 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 393 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |