| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_ASSEMBLER_X64_H_ | 5 #ifndef VM_ASSEMBLER_X64_H_ |
| 6 #define VM_ASSEMBLER_X64_H_ | 6 #define VM_ASSEMBLER_X64_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_x64.h directly; use assembler.h instead. | 9 #error Do not include assembler_x64.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 // pool pointer is in another register, or that it is not available at all, | 738 // pool pointer is in another register, or that it is not available at all, |
| 739 // PP should be passed for pp. | 739 // PP should be passed for pp. |
| 740 // TODO(koda): Assert that these are not used for heap objects. | 740 // TODO(koda): Assert that these are not used for heap objects. |
| 741 void AddImmediate(Register reg, const Immediate& imm, Register pp); | 741 void AddImmediate(Register reg, const Immediate& imm, Register pp); |
| 742 void AddImmediate(const Address& address, const Immediate& imm, Register pp); | 742 void AddImmediate(const Address& address, const Immediate& imm, Register pp); |
| 743 void SubImmediate(Register reg, const Immediate& imm, Register pp); | 743 void SubImmediate(Register reg, const Immediate& imm, Register pp); |
| 744 void SubImmediate(const Address& address, const Immediate& imm, Register pp); | 744 void SubImmediate(const Address& address, const Immediate& imm, Register pp); |
| 745 | 745 |
| 746 void Drop(intptr_t stack_elements, Register tmp = TMP); | 746 void Drop(intptr_t stack_elements, Register tmp = TMP); |
| 747 | 747 |
| 748 enum Patchability { | |
| 749 kPatchable, | |
| 750 kNotPatchable, | |
| 751 }; | |
| 752 | |
| 753 bool allow_constant_pool() const { | 748 bool allow_constant_pool() const { |
| 754 return allow_constant_pool_; | 749 return allow_constant_pool_; |
| 755 } | 750 } |
| 756 void set_allow_constant_pool(bool b) { | 751 void set_allow_constant_pool(bool b) { |
| 757 allow_constant_pool_ = b; | 752 allow_constant_pool_ = b; |
| 758 } | 753 } |
| 759 | 754 |
| 760 bool CanLoadImmediateFromPool(const Immediate& imm, Register pp); | 755 bool CanLoadImmediateFromPool(const Immediate& imm, Register pp); |
| 761 void LoadImmediate(Register reg, const Immediate& imm, Register pp); | 756 void LoadImmediate(Register reg, const Immediate& imm, Register pp); |
| 762 void LoadIsolate(Register dst); | 757 void LoadIsolate(Register dst); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 | 888 |
| 894 // Count the fixups that produce a pointer offset, without processing | 889 // Count the fixups that produce a pointer offset, without processing |
| 895 // the fixups. | 890 // the fixups. |
| 896 intptr_t CountPointerOffsets() const { | 891 intptr_t CountPointerOffsets() const { |
| 897 return buffer_.CountPointerOffsets(); | 892 return buffer_.CountPointerOffsets(); |
| 898 } | 893 } |
| 899 | 894 |
| 900 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { | 895 const ZoneGrowableArray<intptr_t>& GetPointerOffsets() const { |
| 901 return buffer_.pointer_offsets(); | 896 return buffer_.pointer_offsets(); |
| 902 } | 897 } |
| 903 const GrowableObjectArray& object_pool() const { return object_pool_; } | 898 const GrowableObjectArray& object_pool() const { return object_pool_.data(); } |
| 904 | 899 |
| 905 void FinalizeInstructions(const MemoryRegion& region) { | 900 void FinalizeInstructions(const MemoryRegion& region) { |
| 906 buffer_.FinalizeInstructions(region); | 901 buffer_.FinalizeInstructions(region); |
| 907 } | 902 } |
| 908 | 903 |
| 909 // Index of constant pool entries pointing to debugger stubs. | 904 // Index of constant pool entries pointing to debugger stubs. |
| 910 static const int kICCallBreakpointCPIndex = 5; | 905 static const int kICCallBreakpointCPIndex = 5; |
| 911 static const int kClosureCallBreakpointCPIndex = 6; | 906 static const int kClosureCallBreakpointCPIndex = 6; |
| 912 static const int kRuntimeCallBreakpointCPIndex = 7; | 907 static const int kRuntimeCallBreakpointCPIndex = 7; |
| 913 | 908 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 | 1021 |
| 1027 // On some other platforms, we draw a distinction between safe and unsafe | 1022 // On some other platforms, we draw a distinction between safe and unsafe |
| 1028 // smis. | 1023 // smis. |
| 1029 static bool IsSafe(const Object& object) { return true; } | 1024 static bool IsSafe(const Object& object) { return true; } |
| 1030 static bool IsSafeSmi(const Object& object) { return object.IsSmi(); } | 1025 static bool IsSafeSmi(const Object& object) { return object.IsSmi(); } |
| 1031 | 1026 |
| 1032 private: | 1027 private: |
| 1033 AssemblerBuffer buffer_; | 1028 AssemblerBuffer buffer_; |
| 1034 | 1029 |
| 1035 // Objects and jump targets. | 1030 // Objects and jump targets. |
| 1036 GrowableObjectArray& object_pool_; | 1031 ObjectPool object_pool_; |
| 1037 | |
| 1038 // Patchability of pool entries. | |
| 1039 GrowableArray<Patchability> patchable_pool_entries_; | |
| 1040 | |
| 1041 // Hashmap for fast lookup in object pool. | |
| 1042 DirectChainedHashMap<ObjIndexPair> object_pool_index_table_; | |
| 1043 | 1032 |
| 1044 intptr_t prologue_offset_; | 1033 intptr_t prologue_offset_; |
| 1045 | 1034 |
| 1046 class CodeComment : public ZoneAllocated { | 1035 class CodeComment : public ZoneAllocated { |
| 1047 public: | 1036 public: |
| 1048 CodeComment(intptr_t pc_offset, const String& comment) | 1037 CodeComment(intptr_t pc_offset, const String& comment) |
| 1049 : pc_offset_(pc_offset), comment_(comment) { } | 1038 : pc_offset_(pc_offset), comment_(comment) { } |
| 1050 | 1039 |
| 1051 intptr_t pc_offset() const { return pc_offset_; } | 1040 intptr_t pc_offset() const { return pc_offset_; } |
| 1052 const String& comment() const { return comment_; } | 1041 const String& comment() const { return comment_; } |
| 1053 | 1042 |
| 1054 private: | 1043 private: |
| 1055 intptr_t pc_offset_; | 1044 intptr_t pc_offset_; |
| 1056 const String& comment_; | 1045 const String& comment_; |
| 1057 | 1046 |
| 1058 DISALLOW_COPY_AND_ASSIGN(CodeComment); | 1047 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
| 1059 }; | 1048 }; |
| 1060 | 1049 |
| 1061 GrowableArray<CodeComment*> comments_; | 1050 GrowableArray<CodeComment*> comments_; |
| 1062 bool allow_constant_pool_; | 1051 bool allow_constant_pool_; |
| 1063 | 1052 |
| 1064 intptr_t FindObject(const Object& obj, Patchability patchable); | |
| 1065 intptr_t FindExternalLabel(const ExternalLabel* label, | |
| 1066 Patchability patchable); | |
| 1067 intptr_t FindImmediate(int64_t imm); | 1053 intptr_t FindImmediate(int64_t imm); |
| 1068 void LoadExternalLabel(Register dst, | 1054 void LoadExternalLabel(Register dst, |
| 1069 const ExternalLabel* label, | 1055 const ExternalLabel* label, |
| 1070 Patchability patchable, | 1056 Patchability patchable, |
| 1071 Register pp); | 1057 Register pp); |
| 1072 bool CanLoadFromObjectPool(const Object& object); | 1058 bool CanLoadFromObjectPool(const Object& object); |
| 1073 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); | 1059 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); |
| 1074 | 1060 |
| 1075 inline void EmitUint8(uint8_t value); | 1061 inline void EmitUint8(uint8_t value); |
| 1076 inline void EmitInt32(int32_t value); | 1062 inline void EmitInt32(int32_t value); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 } | 1189 } |
| 1204 | 1190 |
| 1205 | 1191 |
| 1206 inline void Assembler::EmitOperandSizeOverride() { | 1192 inline void Assembler::EmitOperandSizeOverride() { |
| 1207 EmitUint8(0x66); | 1193 EmitUint8(0x66); |
| 1208 } | 1194 } |
| 1209 | 1195 |
| 1210 } // namespace dart | 1196 } // namespace dart |
| 1211 | 1197 |
| 1212 #endif // VM_ASSEMBLER_X64_H_ | 1198 #endif // VM_ASSEMBLER_X64_H_ |
| OLD | NEW |