| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 return sregisters[code]; | 232 return sregisters[code]; |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 inline const FPRegister& FPRegister::DRegFromCode(unsigned code) { | 236 inline const FPRegister& FPRegister::DRegFromCode(unsigned code) { |
| 237 ASSERT(code < kNumberOfFPRegisters); | 237 ASSERT(code < kNumberOfFPRegisters); |
| 238 return dregisters[code]; | 238 return dregisters[code]; |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 inline const Register& CPURegister::W() { | 242 inline const Register& CPURegister::W() const { |
| 243 ASSERT(IsValidRegister()); | 243 ASSERT(IsValidRegister()); |
| 244 return Register::WRegFromCode(code_); | 244 return Register::WRegFromCode(code_); |
| 245 } | 245 } |
| 246 | 246 |
| 247 | 247 |
| 248 inline const Register& CPURegister::X() { | 248 inline const Register& CPURegister::X() const { |
| 249 ASSERT(IsValidRegister()); | 249 ASSERT(IsValidRegister()); |
| 250 return Register::XRegFromCode(code_); | 250 return Register::XRegFromCode(code_); |
| 251 } | 251 } |
| 252 | 252 |
| 253 | 253 |
| 254 inline const FPRegister& CPURegister::S() { | 254 inline const FPRegister& CPURegister::S() const { |
| 255 ASSERT(IsValidFPRegister()); | 255 ASSERT(IsValidFPRegister()); |
| 256 return FPRegister::SRegFromCode(code_); | 256 return FPRegister::SRegFromCode(code_); |
| 257 } | 257 } |
| 258 | 258 |
| 259 | 259 |
| 260 inline const FPRegister& CPURegister::D() { | 260 inline const FPRegister& CPURegister::D() const { |
| 261 ASSERT(IsValidFPRegister()); | 261 ASSERT(IsValidFPRegister()); |
| 262 return FPRegister::DRegFromCode(code_); | 262 return FPRegister::DRegFromCode(code_); |
| 263 } | 263 } |
| 264 | 264 |
| 265 | 265 |
| 266 // Operand. | 266 // Operand. |
| 267 #define DECLARE_INT_OPERAND_CONSTRUCTOR(type) \ | 267 #define DECLARE_INT_OPERAND_CONSTRUCTOR(type) \ |
| 268 Operand::Operand(type immediate, RelocInfo::Mode rmode) \ | 268 Operand::Operand(type immediate, RelocInfo::Mode rmode) \ |
| 269 : immediate_(immediate), \ | 269 : immediate_(immediate), \ |
| 270 reg_(NoReg), \ | 270 reg_(NoReg), \ |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 494 |
| 495 | 495 |
| 496 Address Assembler::target_pointer_address_at(Address pc) { | 496 Address Assembler::target_pointer_address_at(Address pc) { |
| 497 Instruction* instr = reinterpret_cast<Instruction*>(pc); | 497 Instruction* instr = reinterpret_cast<Instruction*>(pc); |
| 498 ASSERT(instr->IsLdrLiteralX()); | 498 ASSERT(instr->IsLdrLiteralX()); |
| 499 return reinterpret_cast<Address>(instr->ImmPCOffsetTarget()); | 499 return reinterpret_cast<Address>(instr->ImmPCOffsetTarget()); |
| 500 } | 500 } |
| 501 | 501 |
| 502 | 502 |
| 503 // Read/Modify the code target address in the branch/call instruction at pc. | 503 // Read/Modify the code target address in the branch/call instruction at pc. |
| 504 Address Assembler::target_pointer_at(Address pc) { | 504 Address Assembler::target_address_at(Address pc) { |
| 505 return Memory::Address_at(target_pointer_address_at(pc)); | 505 return Memory::Address_at(target_pointer_address_at(pc)); |
| 506 } | 506 } |
| 507 | 507 |
| 508 | 508 |
| 509 Address Assembler::target_address_from_return_address(Address pc) { | 509 Address Assembler::target_address_from_return_address(Address pc) { |
| 510 // Returns the address of the call target from the return address that will | 510 // Returns the address of the call target from the return address that will |
| 511 // be returned to after a call. | 511 // be returned to after a call. |
| 512 // Call sequence on A64 is: | 512 // Call sequence on A64 is: |
| 513 // ldr ip0, #... @ load from literal pool | 513 // ldr ip0, #... @ load from literal pool |
| 514 // blr ip0 | 514 // blr ip0 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 return pc + Assembler::kCallSizeWithoutRelocation; | 551 return pc + Assembler::kCallSizeWithoutRelocation; |
| 552 } else { | 552 } else { |
| 553 // Verify the instruction sequence. | 553 // Verify the instruction sequence. |
| 554 ASSERT(instr->IsLdrLiteralX()); | 554 ASSERT(instr->IsLdrLiteralX()); |
| 555 ASSERT(instr->following(1)->IsBranchAndLinkToRegister()); | 555 ASSERT(instr->following(1)->IsBranchAndLinkToRegister()); |
| 556 return pc + Assembler::kCallSizeWithRelocation; | 556 return pc + Assembler::kCallSizeWithRelocation; |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 | 559 |
| 560 | 560 |
| 561 Address Assembler::target_address_at(Address pc) { | |
| 562 return target_pointer_at(pc); | |
| 563 } | |
| 564 | |
| 565 | |
| 566 void Assembler::set_target_address_at(Address pc, Address target) { | |
| 567 set_target_pointer_at(pc, target); | |
| 568 } | |
| 569 | |
| 570 | |
| 571 void Assembler::deserialization_set_special_target_at( | 561 void Assembler::deserialization_set_special_target_at( |
| 572 Address constant_pool_entry, Address target) { | 562 Address constant_pool_entry, Address target) { |
| 573 Memory::Address_at(constant_pool_entry) = target; | 563 Memory::Address_at(constant_pool_entry) = target; |
| 574 } | 564 } |
| 575 | 565 |
| 576 | 566 |
| 577 void Assembler::set_external_target_at(Address constant_pool_entry, | 567 void Assembler::set_external_target_at(Address constant_pool_entry, |
| 578 Address target) { | 568 Address target) { |
| 579 Memory::Address_at(constant_pool_entry) = target; | 569 Memory::Address_at(constant_pool_entry) = target; |
| 580 } | 570 } |
| 581 | 571 |
| 582 | 572 |
| 583 void Assembler::set_target_pointer_at(Address pc, Address target) { | 573 void Assembler::set_target_address_at(Address pc, Address target) { |
| 584 Memory::Address_at(target_pointer_address_at(pc)) = target; | 574 Memory::Address_at(target_pointer_address_at(pc)) = target; |
| 585 // Intuitively, we would think it is necessary to always flush the | 575 // Intuitively, we would think it is necessary to always flush the |
| 586 // instruction cache after patching a target address in the code as follows: | 576 // instruction cache after patching a target address in the code as follows: |
| 587 // CPU::FlushICache(pc, sizeof(target)); | 577 // CPU::FlushICache(pc, sizeof(target)); |
| 588 // However, on ARM, an instruction is actually patched in the case of | 578 // However, on ARM, an instruction is actually patched in the case of |
| 589 // embedded constants of the form: | 579 // embedded constants of the form: |
| 590 // ldr ip, [pc, #...] | 580 // ldr ip, [pc, #...] |
| 591 // since the instruction accessing this address in the constant pool remains | 581 // since the instruction accessing this address in the constant pool remains |
| 592 // unchanged, a flush is not required. | 582 // unchanged, a flush is not required. |
| 593 } | 583 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 607 Address RelocInfo::target_address_address() { | 597 Address RelocInfo::target_address_address() { |
| 608 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) | 598 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) |
| 609 || rmode_ == EMBEDDED_OBJECT | 599 || rmode_ == EMBEDDED_OBJECT |
| 610 || rmode_ == EXTERNAL_REFERENCE); | 600 || rmode_ == EXTERNAL_REFERENCE); |
| 611 return Assembler::target_pointer_address_at(pc_); | 601 return Assembler::target_pointer_address_at(pc_); |
| 612 } | 602 } |
| 613 | 603 |
| 614 | 604 |
| 615 Object* RelocInfo::target_object() { | 605 Object* RelocInfo::target_object() { |
| 616 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 606 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 617 return reinterpret_cast<Object*>(Assembler::target_pointer_at(pc_)); | 607 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); |
| 618 } | 608 } |
| 619 | 609 |
| 620 | 610 |
| 621 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 611 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 622 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 612 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 623 return Handle<Object>(reinterpret_cast<Object**>( | 613 return Handle<Object>(reinterpret_cast<Object**>( |
| 624 Assembler::target_pointer_at(pc_))); | 614 Assembler::target_address_at(pc_))); |
| 625 } | 615 } |
| 626 | 616 |
| 627 | 617 |
| 628 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { | 618 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
| 629 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 619 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 630 ASSERT(!target->IsConsString()); | 620 ASSERT(!target->IsConsString()); |
| 631 Assembler::set_target_pointer_at(pc_, reinterpret_cast<Address>(target)); | 621 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); |
| 632 if (mode == UPDATE_WRITE_BARRIER && | 622 if (mode == UPDATE_WRITE_BARRIER && |
| 633 host() != NULL && | 623 host() != NULL && |
| 634 target->IsHeapObject()) { | 624 target->IsHeapObject()) { |
| 635 host()->GetHeap()->incremental_marking()->RecordWrite( | 625 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 636 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 626 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 637 } | 627 } |
| 638 } | 628 } |
| 639 | 629 |
| 640 | 630 |
| 641 Address RelocInfo::target_reference() { | 631 Address RelocInfo::target_reference() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 host(), this, HeapObject::cast(target_code)); | 713 host(), this, HeapObject::cast(target_code)); |
| 724 } | 714 } |
| 725 } | 715 } |
| 726 | 716 |
| 727 | 717 |
| 728 void RelocInfo::WipeOut() { | 718 void RelocInfo::WipeOut() { |
| 729 ASSERT(IsEmbeddedObject(rmode_) || | 719 ASSERT(IsEmbeddedObject(rmode_) || |
| 730 IsCodeTarget(rmode_) || | 720 IsCodeTarget(rmode_) || |
| 731 IsRuntimeEntry(rmode_) || | 721 IsRuntimeEntry(rmode_) || |
| 732 IsExternalReference(rmode_)); | 722 IsExternalReference(rmode_)); |
| 733 Assembler::set_target_pointer_at(pc_, NULL); | 723 Assembler::set_target_address_at(pc_, NULL); |
| 734 } | 724 } |
| 735 | 725 |
| 736 | 726 |
| 737 bool RelocInfo::IsPatchedReturnSequence() { | 727 bool RelocInfo::IsPatchedReturnSequence() { |
| 738 // The sequence must be: | 728 // The sequence must be: |
| 739 // ldr ip0, [pc, #offset] | 729 // ldr ip0, [pc, #offset] |
| 740 // blr ip0 | 730 // blr ip0 |
| 741 // See a64/debug-a64.cc BreakLocationIterator::SetDebugBreakAtReturn(). | 731 // See a64/debug-a64.cc BreakLocationIterator::SetDebugBreakAtReturn(). |
| 742 Instruction* i1 = reinterpret_cast<Instruction*>(pc_); | 732 Instruction* i1 = reinterpret_cast<Instruction*>(pc_); |
| 743 Instruction* i2 = i1->following(); | 733 Instruction* i2 = i1->following(); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1144 |
| 1155 | 1145 |
| 1156 void Assembler::ClearRecordedAstId() { | 1146 void Assembler::ClearRecordedAstId() { |
| 1157 recorded_ast_id_ = TypeFeedbackId::None(); | 1147 recorded_ast_id_ = TypeFeedbackId::None(); |
| 1158 } | 1148 } |
| 1159 | 1149 |
| 1160 | 1150 |
| 1161 } } // namespace v8::internal | 1151 } } // namespace v8::internal |
| 1162 | 1152 |
| 1163 #endif // V8_A64_ASSEMBLER_A64_INL_H_ | 1153 #endif // V8_A64_ASSEMBLER_A64_INL_H_ |
| OLD | NEW |