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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode); | 658 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode); |
659 uint8_t* LoadStoreAddress(unsigned addr_reg, | 659 uint8_t* LoadStoreAddress(unsigned addr_reg, |
660 int64_t offset, | 660 int64_t offset, |
661 AddrMode addrmode); | 661 AddrMode addrmode); |
662 void LoadStoreWriteBack(unsigned addr_reg, | 662 void LoadStoreWriteBack(unsigned addr_reg, |
663 int64_t offset, | 663 int64_t offset, |
664 AddrMode addrmode); | 664 AddrMode addrmode); |
665 void CheckMemoryAccess(uint8_t* address, uint8_t* stack); | 665 void CheckMemoryAccess(uint8_t* address, uint8_t* stack); |
666 | 666 |
667 uint64_t MemoryRead(uint8_t* address, unsigned num_bytes); | 667 uint64_t MemoryRead(uint8_t* address, unsigned num_bytes); |
668 uint8_t MemoryRead8(uint8_t* address); | 668 template <typename T> |
669 uint16_t MemoryRead16(uint8_t* address); | 669 T MemoryRead(uint8_t* address) { |
670 uint32_t MemoryRead32(uint8_t* address); | 670 ASSERT(address != NULL); |
| 671 T read = 0; |
| 672 memcpy(&read, address, sizeof(T)); |
| 673 return read; |
| 674 } |
| 675 uint8_t MemoryRead8(uint8_t* address) { |
| 676 return MemoryRead<uint8_t>(address); |
| 677 } |
| 678 uint16_t MemoryRead16(uint8_t* address) { |
| 679 return MemoryRead<uint16_t>(address); |
| 680 } |
| 681 uint32_t MemoryRead32(uint8_t* address) { |
| 682 return MemoryRead<uint32_t>(address); |
| 683 } |
| 684 uint64_t MemoryRead64(uint8_t* address) { |
| 685 return MemoryRead<uint64_t>(address); |
| 686 } |
671 float MemoryReadFP32(uint8_t* address); | 687 float MemoryReadFP32(uint8_t* address); |
672 uint64_t MemoryRead64(uint8_t* address); | |
673 double MemoryReadFP64(uint8_t* address); | 688 double MemoryReadFP64(uint8_t* address); |
674 | 689 |
675 void MemoryWrite(uint8_t* address, uint64_t value, unsigned num_bytes); | 690 void MemoryWrite(uint8_t* address, uint64_t value, unsigned num_bytes); |
676 void MemoryWrite32(uint8_t* address, uint32_t value); | 691 template <typename T> |
| 692 void MemoryWrite(uint8_t* address, T value) { |
| 693 ASSERT(address != NULL); |
| 694 LogWrite(address, value, sizeof(T)); |
| 695 memcpy(address, &value, sizeof(T)); |
| 696 } |
| 697 void MemoryWrite8(uint8_t* address, uint8_t value) { |
| 698 MemoryWrite<uint8_t>(address, value); |
| 699 } |
| 700 void MemoryWrite16(uint8_t* address, uint16_t value) { |
| 701 MemoryWrite<uint16_t>(address, value); |
| 702 } |
| 703 void MemoryWrite32(uint8_t* address, uint32_t value) { |
| 704 MemoryWrite<uint32_t>(address, value); |
| 705 } |
| 706 void MemoryWrite64(uint8_t* address, uint64_t value) { |
| 707 MemoryWrite<uint64_t>(address, value); |
| 708 } |
677 void MemoryWriteFP32(uint8_t* address, float value); | 709 void MemoryWriteFP32(uint8_t* address, float value); |
678 void MemoryWrite64(uint8_t* address, uint64_t value); | |
679 void MemoryWriteFP64(uint8_t* address, double value); | 710 void MemoryWriteFP64(uint8_t* address, double value); |
680 | 711 |
681 int64_t ShiftOperand(unsigned reg_size, | 712 int64_t ShiftOperand(unsigned reg_size, |
682 int64_t value, | 713 int64_t value, |
683 Shift shift_type, | 714 Shift shift_type, |
684 unsigned amount); | 715 unsigned amount); |
685 int64_t Rotate(unsigned reg_width, | 716 int64_t Rotate(unsigned reg_width, |
686 int64_t value, | 717 int64_t value, |
687 Shift shift_type, | 718 Shift shift_type, |
688 unsigned amount); | 719 unsigned amount); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 static void UnregisterCTryCatch() { | 890 static void UnregisterCTryCatch() { |
860 Simulator::current(Isolate::Current())->PopAddress(); | 891 Simulator::current(Isolate::Current())->PopAddress(); |
861 } | 892 } |
862 }; | 893 }; |
863 | 894 |
864 #endif // !defined(USE_SIMULATOR) | 895 #endif // !defined(USE_SIMULATOR) |
865 | 896 |
866 } } // namespace v8::internal | 897 } } // namespace v8::internal |
867 | 898 |
868 #endif // V8_A64_SIMULATOR_A64_H_ | 899 #endif // V8_A64_SIMULATOR_A64_H_ |
OLD | NEW |