Chromium Code Reviews| Index: src/compiler/instruction.h |
| diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h |
| index 05128c6cdf42d22ab993f2f870a17890557b735b..b69fd84d3ff56a6b234e18fb0225bc057e127407 100644 |
| --- a/src/compiler/instruction.h |
| +++ b/src/compiler/instruction.h |
| @@ -167,7 +167,7 @@ std::ostream& operator<<(std::ostream& os, |
| return *static_cast<const OperandType*>(&op); \ |
| } |
| -class UnallocatedOperand : public InstructionOperand { |
| +class UnallocatedOperand final : public InstructionOperand { |
| public: |
| enum BasicPolicy { FIXED_SLOT, EXTENDED_POLICY }; |
| @@ -183,15 +183,14 @@ class UnallocatedOperand : public InstructionOperand { |
| // Lifetime of operand inside the instruction. |
| enum Lifetime { |
| - // USED_AT_START operand is guaranteed to be live only at |
| - // instruction start. Register allocator is free to assign the same register |
| - // to some other operand used inside instruction (i.e. temporary or |
| - // output). |
| + // USED_AT_START operand is guaranteed to be live only at instruction start. |
| + // The register allocator is free to assign the same register to some other |
| + // operand used inside instruction (i.e. temporary or output). |
| USED_AT_START, |
| - // USED_AT_END operand is treated as live until the end of |
| - // instruction. This means that register allocator will not reuse it's |
| - // register for any other operand inside instruction. |
| + // USED_AT_END operand is treated as live until the end of instruction. |
| + // This means that register allocator will not reuse its register for any |
| + // other operand inside instruction. |
| USED_AT_END |
| }; |
| @@ -233,6 +232,12 @@ class UnallocatedOperand : public InstructionOperand { |
| value_ |= SecondaryStorageField::encode(slot_id); |
| } |
| + UnallocatedOperand(const UnallocatedOperand* other, int virtual_register) { |
|
Mircea Trofin
2017/05/24 07:00:46
You can pass other as a const UnallocatedOperand&,
bbudge
2017/05/24 16:12:03
Much better, thanks.
|
| + DCHECK_NE(kInvalidVirtualRegister, virtual_register); |
| + value_ = VirtualRegisterField::update( |
| + other->value_, static_cast<uint32_t>(virtual_register)); |
| + } |
| + |
| // Predicates for the operand policy. |
| bool HasAnyPolicy() const { |
| return basic_policy() == EXTENDED_POLICY && extended_policy() == ANY; |
| @@ -275,7 +280,6 @@ class UnallocatedOperand : public InstructionOperand { |
| // [basic_policy]: Distinguish between FIXED_SLOT and all other policies. |
| BasicPolicy basic_policy() const { |
| - DCHECK_EQ(UNALLOCATED, kind()); |
| return BasicPolicyField::decode(value_); |
| } |
| @@ -300,16 +304,9 @@ class UnallocatedOperand : public InstructionOperand { |
| // [virtual_register]: The virtual register ID for this operand. |
| int32_t virtual_register() const { |
| - DCHECK_EQ(UNALLOCATED, kind()); |
| return static_cast<int32_t>(VirtualRegisterField::decode(value_)); |
| } |
| - // TODO(dcarney): remove this. |
| - void set_virtual_register(int32_t id) { |
| - DCHECK_EQ(UNALLOCATED, kind()); |
| - value_ = VirtualRegisterField::update(value_, static_cast<uint32_t>(id)); |
| - } |
| - |
| // [lifetime]: Only for non-FIXED_SLOT. |
| bool IsUsedAtStart() const { |
| DCHECK(basic_policy() == EXTENDED_POLICY); |