| Index: src/compiler/instruction.h
|
| diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
|
| index bcd25b2eb87fb2df4fbd8783bfc25107680fb6ac..21734470919f475b63e71ce57e4507f4210fe78d 100644
|
| --- a/src/compiler/instruction.h
|
| +++ b/src/compiler/instruction.h
|
| @@ -441,6 +441,10 @@ class Instruction : public ZoneObject {
|
| DCHECK(i < InputCount());
|
| return operands_[OutputCount() + i];
|
| }
|
| + void SetInputAt(size_t i, InstructionOperand* operand) {
|
| + DCHECK(i < InputCount());
|
| + operands_[OutputCount() + i] = operand;
|
| + }
|
|
|
| size_t TempCount() const { return TempCountField::decode(bit_field_); }
|
| InstructionOperand* TempAt(size_t i) const {
|
| @@ -520,6 +524,17 @@ class Instruction : public ZoneObject {
|
|
|
| void operator delete(void* pointer, void* location) { UNREACHABLE(); }
|
|
|
| + void OverwriteWithNop() {
|
| + opcode_ = ArchOpcodeField::encode(kArchNop);
|
| + bit_field_ = 0;
|
| + pointer_map_ = NULL;
|
| + }
|
| +
|
| + bool IsNop() const {
|
| + return arch_opcode() == kArchNop && InputCount() == 0 &&
|
| + OutputCount() == 0 && TempCount() == 0;
|
| + }
|
| +
|
| protected:
|
| explicit Instruction(InstructionCode opcode)
|
| : opcode_(opcode),
|
| @@ -599,6 +614,8 @@ class GapInstruction : public Instruction {
|
| return parallel_moves_[pos];
|
| }
|
|
|
| + bool IsRedundant() const;
|
| +
|
| static GapInstruction* New(Zone* zone) {
|
| void* buffer = zone->New(sizeof(GapInstruction));
|
| return new (buffer) GapInstruction(kGapInstruction);
|
| @@ -893,12 +910,16 @@ class InstructionBlock FINAL : public ZoneObject {
|
| const PhiInstructions& phis() const { return phis_; }
|
| void AddPhi(PhiInstruction* phi) { phis_.push_back(phi); }
|
|
|
| + void set_ao_number(BasicBlock::RpoNumber ao_number) {
|
| + ao_number_ = ao_number;
|
| + }
|
| +
|
| private:
|
| Successors successors_;
|
| Predecessors predecessors_;
|
| PhiInstructions phis_;
|
| const BasicBlock::Id id_;
|
| - const BasicBlock::RpoNumber ao_number_; // Assembly order number.
|
| + BasicBlock::RpoNumber ao_number_; // Assembly order number.
|
| const BasicBlock::RpoNumber rpo_number_;
|
| const BasicBlock::RpoNumber loop_header_;
|
| const BasicBlock::RpoNumber loop_end_;
|
| @@ -991,6 +1012,8 @@ class InstructionSequence FINAL : public ZoneObject {
|
| void EndBlock(BasicBlock::RpoNumber rpo);
|
|
|
| int AddConstant(int virtual_register, Constant constant) {
|
| + // TODO(titzer): allow RPO numbers as constants?
|
| + DCHECK(constant.type() != Constant::kRpoNumber);
|
| DCHECK(virtual_register >= 0 && virtual_register < next_virtual_register_);
|
| DCHECK(constants_.find(virtual_register) == constants_.end());
|
| constants_.insert(std::make_pair(virtual_register, constant));
|
| @@ -1003,8 +1026,8 @@ class InstructionSequence FINAL : public ZoneObject {
|
| return it->second;
|
| }
|
|
|
| - typedef ConstantDeque Immediates;
|
| - const Immediates& immediates() const { return immediates_; }
|
| + typedef ZoneVector<Constant> Immediates;
|
| + Immediates& immediates() { return immediates_; }
|
|
|
| int AddImmediate(Constant constant) {
|
| int index = static_cast<int>(immediates_.size());
|
| @@ -1031,6 +1054,13 @@ class InstructionSequence FINAL : public ZoneObject {
|
| FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id);
|
| int GetFrameStateDescriptorCount();
|
|
|
| + BasicBlock::RpoNumber InputRpo(Instruction* instr, size_t index) {
|
| + InstructionOperand* operand = instr->InputAt(index);
|
| + Constant constant = operand->IsImmediate() ? GetImmediate(operand->index())
|
| + : GetConstant(operand->index());
|
| + return constant.ToRpoNumber();
|
| + }
|
| +
|
| private:
|
| friend std::ostream& operator<<(std::ostream& os,
|
| const PrintableInstructionSequence& code);
|
| @@ -1041,7 +1071,7 @@ class InstructionSequence FINAL : public ZoneObject {
|
| InstructionBlocks* const instruction_blocks_;
|
| IntVector block_starts_;
|
| ConstantMap constants_;
|
| - ConstantDeque immediates_;
|
| + Immediates immediates_;
|
| InstructionDeque instructions_;
|
| int next_virtual_register_;
|
| PointerMapDeque pointer_maps_;
|
|
|