Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: src/compiler/instruction.h

Issue 754843002: [turbofan] Implement jump threading after register allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/instruction.h
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index 1740dfbf25b970054417d75c533ba95e8ea65366..8e2192fb86b1f06761296be612946f5feb762798 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,12 @@ class Instruction : public ZoneObject {
void operator delete(void* pointer, void* location) { UNREACHABLE(); }
+ void OverwriteWithNop() {
+ opcode_ = ArchOpcodeField::encode(kArchNop);
+ bit_field_ = 0;
+ pointer_map_ = NULL;
+ }
+
protected:
explicit Instruction(InstructionCode opcode)
: opcode_(opcode),
@@ -599,6 +609,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);
@@ -885,12 +897,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.
// TODO(dcarney): probably dont't need this.
const BasicBlock::RpoNumber rpo_number_;
const BasicBlock::RpoNumber loop_header_;
@@ -1024,6 +1040,15 @@ class InstructionSequence FINAL : public ZoneObject {
FrameStateDescriptor* GetFrameStateDescriptor(StateId deoptimization_id);
int GetFrameStateDescriptorCount();
+ BasicBlock::RpoNumber InputRpo(Instruction* instr, int index) {
+ InstructionOperand* operand = instr->InputAt(index);
+ Constant constant = operand->IsImmediate() ? GetImmediate(operand->index())
+ : GetConstant(operand->index());
+ int rpo = constant.ToInt32();
+ DCHECK(rpo >= 0 && rpo < static_cast<int>(instruction_blocks_->size()));
+ return BasicBlock::RpoNumber::FromInt(rpo);
+ }
+
private:
friend std::ostream& operator<<(std::ostream& os,
const PrintableInstructionSequence& code);
« no previous file with comments | « BUILD.gn ('k') | src/compiler/instruction.cc » ('j') | src/compiler/jump-threading.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698