| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ | 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ |
| 6 #define V8_X64_ASSEMBLER_X64_INL_H_ | 6 #define V8_X64_ASSEMBLER_X64_INL_H_ |
| 7 | 7 |
| 8 #include "src/x64/assembler-x64.h" | 8 #include "src/x64/assembler-x64.h" |
| 9 | 9 |
| 10 #include "src/base/cpu.h" | 10 #include "src/base/cpu.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { | 469 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
| 470 // Effectively write zero into the relocation. | 470 // Effectively write zero into the relocation. |
| 471 Assembler::set_target_address_at(isolate_, pc_, host_, | 471 Assembler::set_target_address_at(isolate_, pc_, host_, |
| 472 pc_ + sizeof(int32_t)); | 472 pc_ + sizeof(int32_t)); |
| 473 } else { | 473 } else { |
| 474 UNREACHABLE(); | 474 UNREACHABLE(); |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 | 477 |
| 478 | 478 |
| 479 bool RelocInfo::IsPatchedReturnSequence() { | |
| 480 // The recognized call sequence is: | |
| 481 // movq(kScratchRegister, address); call(kScratchRegister); | |
| 482 // It only needs to be distinguished from a return sequence | |
| 483 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 | |
| 484 // The 11th byte is int3 (0xCC) in the return sequence and | |
| 485 // REX.WB (0x48+register bit) for the call sequence. | |
| 486 return pc_[Assembler::kMoveAddressIntoScratchRegisterInstructionLength] != | |
| 487 0xCC; | |
| 488 } | |
| 489 | |
| 490 | |
| 491 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | |
| 492 return !Assembler::IsNop(pc()); | |
| 493 } | |
| 494 | |
| 495 | |
| 496 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { | 479 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { |
| 497 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 480 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 498 DCHECK(*pc_ == kCallOpcode); | 481 DCHECK(*pc_ == kCallOpcode); |
| 499 return origin->code_target_object_handle_at(pc_ + 1); | 482 return origin->code_target_object_handle_at(pc_ + 1); |
| 500 } | 483 } |
| 501 | 484 |
| 502 | 485 |
| 503 Code* RelocInfo::code_age_stub() { | 486 Code* RelocInfo::code_age_stub() { |
| 504 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 487 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 505 DCHECK(*pc_ == kCallOpcode); | 488 DCHECK(*pc_ == kCallOpcode); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 void Operand::set_disp64(int64_t disp) { | 610 void Operand::set_disp64(int64_t disp) { |
| 628 DCHECK_EQ(1, len_); | 611 DCHECK_EQ(1, len_); |
| 629 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); | 612 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); |
| 630 *p = disp; | 613 *p = disp; |
| 631 len_ += sizeof(disp); | 614 len_ += sizeof(disp); |
| 632 } | 615 } |
| 633 } // namespace internal | 616 } // namespace internal |
| 634 } // namespace v8 | 617 } // namespace v8 |
| 635 | 618 |
| 636 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 619 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |