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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // The dumping code is generated though the given MacroAssembler. No registers | 52 // The dumping code is generated though the given MacroAssembler. No registers |
53 // are corrupted in the process, but the stack is used briefly. The flags will | 53 // are corrupted in the process, but the stack is used briefly. The flags will |
54 // be corrupted during this call. | 54 // be corrupted during this call. |
55 void Dump(MacroAssembler* assm); | 55 void Dump(MacroAssembler* assm); |
56 | 56 |
57 // Register accessors. | 57 // Register accessors. |
58 inline int32_t wreg(unsigned code) const { | 58 inline int32_t wreg(unsigned code) const { |
59 if (code == kSPRegInternalCode) { | 59 if (code == kSPRegInternalCode) { |
60 return wspreg(); | 60 return wspreg(); |
61 } | 61 } |
62 DCHECK(RegAliasesMatch(code)); | 62 CHECK(RegAliasesMatch(code)); |
63 return dump_.w_[code]; | 63 return dump_.w_[code]; |
64 } | 64 } |
65 | 65 |
66 inline int64_t xreg(unsigned code) const { | 66 inline int64_t xreg(unsigned code) const { |
67 if (code == kSPRegInternalCode) { | 67 if (code == kSPRegInternalCode) { |
68 return spreg(); | 68 return spreg(); |
69 } | 69 } |
70 DCHECK(RegAliasesMatch(code)); | 70 CHECK(RegAliasesMatch(code)); |
71 return dump_.x_[code]; | 71 return dump_.x_[code]; |
72 } | 72 } |
73 | 73 |
74 // FPRegister accessors. | 74 // FPRegister accessors. |
75 inline uint32_t sreg_bits(unsigned code) const { | 75 inline uint32_t sreg_bits(unsigned code) const { |
76 DCHECK(FPRegAliasesMatch(code)); | 76 CHECK(FPRegAliasesMatch(code)); |
77 return dump_.s_[code]; | 77 return dump_.s_[code]; |
78 } | 78 } |
79 | 79 |
80 inline float sreg(unsigned code) const { | 80 inline float sreg(unsigned code) const { |
81 return rawbits_to_float(sreg_bits(code)); | 81 return rawbits_to_float(sreg_bits(code)); |
82 } | 82 } |
83 | 83 |
84 inline uint64_t dreg_bits(unsigned code) const { | 84 inline uint64_t dreg_bits(unsigned code) const { |
85 DCHECK(FPRegAliasesMatch(code)); | 85 CHECK(FPRegAliasesMatch(code)); |
86 return dump_.d_[code]; | 86 return dump_.d_[code]; |
87 } | 87 } |
88 | 88 |
89 inline double dreg(unsigned code) const { | 89 inline double dreg(unsigned code) const { |
90 return rawbits_to_double(dreg_bits(code)); | 90 return rawbits_to_double(dreg_bits(code)); |
91 } | 91 } |
92 | 92 |
93 // Stack pointer accessors. | 93 // Stack pointer accessors. |
94 inline int64_t spreg() const { | 94 inline int64_t spreg() const { |
95 DCHECK(SPRegAliasesMatch()); | 95 CHECK(SPRegAliasesMatch()); |
96 return dump_.sp_; | 96 return dump_.sp_; |
97 } | 97 } |
98 | 98 |
99 inline int32_t wspreg() const { | 99 inline int32_t wspreg() const { |
100 DCHECK(SPRegAliasesMatch()); | 100 CHECK(SPRegAliasesMatch()); |
101 return static_cast<int32_t>(dump_.wsp_); | 101 return static_cast<int32_t>(dump_.wsp_); |
102 } | 102 } |
103 | 103 |
104 // Flags accessors. | 104 // Flags accessors. |
105 inline uint32_t flags_nzcv() const { | 105 inline uint32_t flags_nzcv() const { |
106 DCHECK(IsComplete()); | 106 CHECK(IsComplete()); |
107 DCHECK((dump_.flags_ & ~Flags_mask) == 0); | 107 CHECK((dump_.flags_ & ~Flags_mask) == 0); |
108 return dump_.flags_ & Flags_mask; | 108 return dump_.flags_ & Flags_mask; |
109 } | 109 } |
110 | 110 |
111 inline bool IsComplete() const { | 111 inline bool IsComplete() const { |
112 return completed_; | 112 return completed_; |
113 } | 113 } |
114 | 114 |
115 private: | 115 private: |
116 // Indicate whether the dump operation has been completed. | 116 // Indicate whether the dump operation has been completed. |
117 bool completed_; | 117 bool completed_; |
118 | 118 |
119 // Check that the lower 32 bits of x<code> exactly match the 32 bits of | 119 // Check that the lower 32 bits of x<code> exactly match the 32 bits of |
120 // w<code>. A failure of this test most likely represents a failure in the | 120 // w<code>. A failure of this test most likely represents a failure in the |
121 // ::Dump method, or a failure in the simulator. | 121 // ::Dump method, or a failure in the simulator. |
122 bool RegAliasesMatch(unsigned code) const { | 122 bool RegAliasesMatch(unsigned code) const { |
123 DCHECK(IsComplete()); | 123 CHECK(IsComplete()); |
124 DCHECK(code < kNumberOfRegisters); | 124 CHECK(code < kNumberOfRegisters); |
125 return ((dump_.x_[code] & kWRegMask) == dump_.w_[code]); | 125 return ((dump_.x_[code] & kWRegMask) == dump_.w_[code]); |
126 } | 126 } |
127 | 127 |
128 // As RegAliasesMatch, but for the stack pointer. | 128 // As RegAliasesMatch, but for the stack pointer. |
129 bool SPRegAliasesMatch() const { | 129 bool SPRegAliasesMatch() const { |
130 DCHECK(IsComplete()); | 130 CHECK(IsComplete()); |
131 return ((dump_.sp_ & kWRegMask) == dump_.wsp_); | 131 return ((dump_.sp_ & kWRegMask) == dump_.wsp_); |
132 } | 132 } |
133 | 133 |
134 // As RegAliasesMatch, but for floating-point registers. | 134 // As RegAliasesMatch, but for floating-point registers. |
135 bool FPRegAliasesMatch(unsigned code) const { | 135 bool FPRegAliasesMatch(unsigned code) const { |
136 DCHECK(IsComplete()); | 136 CHECK(IsComplete()); |
137 DCHECK(code < kNumberOfFPRegisters); | 137 CHECK(code < kNumberOfFPRegisters); |
138 return (dump_.d_[code] & kSRegMask) == dump_.s_[code]; | 138 return (dump_.d_[code] & kSRegMask) == dump_.s_[code]; |
139 } | 139 } |
140 | 140 |
141 // Store all the dumped elements in a simple struct so the implementation can | 141 // Store all the dumped elements in a simple struct so the implementation can |
142 // use offsetof to quickly find the correct field. | 142 // use offsetof to quickly find the correct field. |
143 struct dump_t { | 143 struct dump_t { |
144 // Core registers. | 144 // Core registers. |
145 uint64_t x_[kNumberOfRegisters]; | 145 uint64_t x_[kNumberOfRegisters]; |
146 uint32_t w_[kNumberOfRegisters]; | 146 uint32_t w_[kNumberOfRegisters]; |
147 | 147 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // As Clobber, but for FP registers. | 224 // As Clobber, but for FP registers. |
225 void ClobberFP(MacroAssembler* masm, RegList reg_list, | 225 void ClobberFP(MacroAssembler* masm, RegList reg_list, |
226 double const value = kFP64SignallingNaN); | 226 double const value = kFP64SignallingNaN); |
227 | 227 |
228 // As Clobber, but for a CPURegList with either FP or integer registers. When | 228 // As Clobber, but for a CPURegList with either FP or integer registers. When |
229 // using this method, the clobber value is always the default for the basic | 229 // using this method, the clobber value is always the default for the basic |
230 // Clobber or ClobberFP functions. | 230 // Clobber or ClobberFP functions. |
231 void Clobber(MacroAssembler* masm, CPURegList reg_list); | 231 void Clobber(MacroAssembler* masm, CPURegList reg_list); |
232 | 232 |
233 #endif // V8_ARM64_TEST_UTILS_ARM64_H_ | 233 #endif // V8_ARM64_TEST_UTILS_ARM64_H_ |
OLD | NEW |