Showing with 32 additions and 0 deletions.
  1. +6 −0 src/hir-instructions.cc
  2. +19 −0 src/hir-instructions.h
  3. +7 −0 src/lir.cc
@@ -229,6 +229,12 @@ void HIRPhi::ReplaceArg(HIRInstruction* o, HIRInstruction* n) {
}


void HIRChi::CalculateRepresentation() {
assert(args()->length() == 1);
representation_ = args()->head()->value()->representation();
}


HIRLiteral::HIRLiteral(AstNode::Type type, ScopeSlot* slot) :
HIRInstruction(kLiteral),
type_(type),
@@ -50,6 +50,7 @@ typedef ZoneList<HIRPhi*> HIRPhiList;
V(GetStackTrace) \
V(AllocateObject) \
V(AllocateArray) \
V(Chi) \
V(Phi)

#define HIR_INSTRUCTION_ENUM(I) \
@@ -80,6 +81,14 @@ class HIRInstruction : public ZoneObject {
kHoleRepresentation = 0x300 // 10000000000
};

// If instruction has effect - it needs to be reloaded before it's use,
// if reload happened and effect was weak - reset effect
enum Effect {
kNoEffect,
kWeakEffect,
kPersistentEffect
};

HIRInstruction(Type type);
HIRInstruction(Type type, ScopeSlot* slot);

@@ -145,6 +154,8 @@ class HIRInstruction : public ZoneObject {
LInstruction* lir_;
HIRBlock* block_;

Effect effect_;

bool hashed_;
uint32_t hash_;

@@ -189,6 +200,14 @@ class HIRPhi : public HIRInstruction {
HIRInstruction* inputs_[2];
};

class HIRChi : public HIRInstruction {
public:
HIRChi(ScopeSlot* slot);

void CalculateRepresentation();
HIR_DEFAULT_METHODS(Chi)
};

class HIRLiteral : public HIRInstruction {
public:
HIRLiteral(AstNode::Type type, ScopeSlot* slot);
@@ -183,6 +183,13 @@ void LGen::VisitPhi(HIRInstruction* instr) {
Bind(instr->lir());
}


void LGen::VisitChi(HIRInstruction* instr) {
Bind(new LMove())
->AddArg(instr, LUse::kAny)
->SetResult(CreateVirtual(), LUse::kAny);
}

#undef LGEN_VISIT_SWITCH

void LGen::ComputeLocalLiveSets() {