| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 UnallocatedOperand(ExtendedPolicy policy, Lifetime lifetime, | 187 UnallocatedOperand(ExtendedPolicy policy, Lifetime lifetime, |
| 188 int virtual_register) | 188 int virtual_register) |
| 189 : UnallocatedOperand(virtual_register) { | 189 : UnallocatedOperand(virtual_register) { |
| 190 value_ |= BasicPolicyField::encode(EXTENDED_POLICY); | 190 value_ |= BasicPolicyField::encode(EXTENDED_POLICY); |
| 191 value_ |= ExtendedPolicyField::encode(policy); | 191 value_ |= ExtendedPolicyField::encode(policy); |
| 192 value_ |= LifetimeField::encode(lifetime); | 192 value_ |= LifetimeField::encode(lifetime); |
| 193 } | 193 } |
| 194 | 194 |
| 195 UnallocatedOperand(int reg_id, int slot_id, int virtual_register) |
| 196 : UnallocatedOperand(FIXED_REGISTER, reg_id, virtual_register) { |
| 197 value_ |= HasSecondaryStorageField::encode(true); |
| 198 value_ |= SecondaryStorageField::encode(slot_id); |
| 199 } |
| 200 |
| 195 // Predicates for the operand policy. | 201 // Predicates for the operand policy. |
| 196 bool HasAnyPolicy() const { | 202 bool HasAnyPolicy() const { |
| 197 return basic_policy() == EXTENDED_POLICY && extended_policy() == ANY; | 203 return basic_policy() == EXTENDED_POLICY && extended_policy() == ANY; |
| 198 } | 204 } |
| 199 bool HasFixedPolicy() const { | 205 bool HasFixedPolicy() const { |
| 200 return basic_policy() == FIXED_SLOT || | 206 return basic_policy() == FIXED_SLOT || |
| 201 extended_policy() == FIXED_REGISTER || | 207 extended_policy() == FIXED_REGISTER || |
| 202 extended_policy() == FIXED_DOUBLE_REGISTER; | 208 extended_policy() == FIXED_DOUBLE_REGISTER; |
| 203 } | 209 } |
| 204 bool HasRegisterPolicy() const { | 210 bool HasRegisterPolicy() const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 215 } | 221 } |
| 216 bool HasFixedSlotPolicy() const { return basic_policy() == FIXED_SLOT; } | 222 bool HasFixedSlotPolicy() const { return basic_policy() == FIXED_SLOT; } |
| 217 bool HasFixedRegisterPolicy() const { | 223 bool HasFixedRegisterPolicy() const { |
| 218 return basic_policy() == EXTENDED_POLICY && | 224 return basic_policy() == EXTENDED_POLICY && |
| 219 extended_policy() == FIXED_REGISTER; | 225 extended_policy() == FIXED_REGISTER; |
| 220 } | 226 } |
| 221 bool HasFixedDoubleRegisterPolicy() const { | 227 bool HasFixedDoubleRegisterPolicy() const { |
| 222 return basic_policy() == EXTENDED_POLICY && | 228 return basic_policy() == EXTENDED_POLICY && |
| 223 extended_policy() == FIXED_DOUBLE_REGISTER; | 229 extended_policy() == FIXED_DOUBLE_REGISTER; |
| 224 } | 230 } |
| 231 bool HasSecondaryStorage() const { |
| 232 return basic_policy() == EXTENDED_POLICY && |
| 233 extended_policy() == FIXED_REGISTER && |
| 234 HasSecondaryStorageField::decode(value_); |
| 235 } |
| 236 int GetSecondaryStorage() const { |
| 237 DCHECK(HasSecondaryStorage()); |
| 238 return SecondaryStorageField::decode(value_); |
| 239 } |
| 225 | 240 |
| 226 // [basic_policy]: Distinguish between FIXED_SLOT and all other policies. | 241 // [basic_policy]: Distinguish between FIXED_SLOT and all other policies. |
| 227 BasicPolicy basic_policy() const { | 242 BasicPolicy basic_policy() const { |
| 228 DCHECK_EQ(UNALLOCATED, kind()); | 243 DCHECK_EQ(UNALLOCATED, kind()); |
| 229 return BasicPolicyField::decode(value_); | 244 return BasicPolicyField::decode(value_); |
| 230 } | 245 } |
| 231 | 246 |
| 232 // [extended_policy]: Only for non-FIXED_SLOT. The finer-grained policy. | 247 // [extended_policy]: Only for non-FIXED_SLOT. The finer-grained policy. |
| 233 ExtendedPolicy extended_policy() const { | 248 ExtendedPolicy extended_policy() const { |
| 234 DCHECK(basic_policy() == EXTENDED_POLICY); | 249 DCHECK(basic_policy() == EXTENDED_POLICY); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 309 |
| 295 // BitFields for all unallocated operands. | 310 // BitFields for all unallocated operands. |
| 296 class BasicPolicyField : public BitField64<BasicPolicy, 35, 1> {}; | 311 class BasicPolicyField : public BitField64<BasicPolicy, 35, 1> {}; |
| 297 | 312 |
| 298 // BitFields specific to BasicPolicy::FIXED_SLOT. | 313 // BitFields specific to BasicPolicy::FIXED_SLOT. |
| 299 class FixedSlotIndexField : public BitField64<int, 36, 28> {}; | 314 class FixedSlotIndexField : public BitField64<int, 36, 28> {}; |
| 300 | 315 |
| 301 // BitFields specific to BasicPolicy::EXTENDED_POLICY. | 316 // BitFields specific to BasicPolicy::EXTENDED_POLICY. |
| 302 class ExtendedPolicyField : public BitField64<ExtendedPolicy, 36, 3> {}; | 317 class ExtendedPolicyField : public BitField64<ExtendedPolicy, 36, 3> {}; |
| 303 class LifetimeField : public BitField64<Lifetime, 39, 1> {}; | 318 class LifetimeField : public BitField64<Lifetime, 39, 1> {}; |
| 304 class FixedRegisterField : public BitField64<int, 40, 6> {}; | 319 class HasSecondaryStorageField : public BitField64<bool, 40, 1> {}; |
| 320 class FixedRegisterField : public BitField64<int, 41, 6> {}; |
| 321 class SecondaryStorageField : public BitField64<int, 47, 3> {}; |
| 305 | 322 |
| 306 private: | 323 private: |
| 307 explicit UnallocatedOperand(int virtual_register) | 324 explicit UnallocatedOperand(int virtual_register) |
| 308 : InstructionOperand(UNALLOCATED) { | 325 : InstructionOperand(UNALLOCATED) { |
| 309 value_ |= | 326 value_ |= |
| 310 VirtualRegisterField::encode(static_cast<uint32_t>(virtual_register)); | 327 VirtualRegisterField::encode(static_cast<uint32_t>(virtual_register)); |
| 311 } | 328 } |
| 312 }; | 329 }; |
| 313 | 330 |
| 314 | 331 |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 | 1277 |
| 1261 | 1278 |
| 1262 std::ostream& operator<<(std::ostream& os, | 1279 std::ostream& operator<<(std::ostream& os, |
| 1263 const PrintableInstructionSequence& code); | 1280 const PrintableInstructionSequence& code); |
| 1264 | 1281 |
| 1265 } // namespace compiler | 1282 } // namespace compiler |
| 1266 } // namespace internal | 1283 } // namespace internal |
| 1267 } // namespace v8 | 1284 } // namespace v8 |
| 1268 | 1285 |
| 1269 #endif // V8_COMPILER_INSTRUCTION_H_ | 1286 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |