Cleanup unused lithium instructions.
Instructions that have side effects can never have EmitAtUses() true. These instructions (CmpTAndBranch, InstanceOfAndBranch) are therefore never generated and can therefor be safely removed. Review URL: http://codereview.chromium.org/7031074 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8220 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
59485c1060
commit
2dc734c108
@ -1055,16 +1055,15 @@ LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
|
|||||||
|
|
||||||
LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
||||||
HValue* v = instr->value();
|
HValue* v = instr->value();
|
||||||
if (!v->EmitAtUses()) {
|
if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v));
|
||||||
return new LBranch(UseRegisterAtStart(v));
|
ASSERT(!v->HasSideEffects());
|
||||||
} else if (v->IsClassOfTest()) {
|
if (v->IsClassOfTest()) {
|
||||||
HClassOfTest* compare = HClassOfTest::cast(v);
|
HClassOfTest* compare = HClassOfTest::cast(v);
|
||||||
ASSERT(compare->value()->representation().IsTagged());
|
ASSERT(compare->value()->representation().IsTagged());
|
||||||
return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
|
return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
|
||||||
TempRegister());
|
TempRegister());
|
||||||
} else if (v->IsCompare()) {
|
} else if (v->IsCompare()) {
|
||||||
HCompare* compare = HCompare::cast(v);
|
HCompare* compare = HCompare::cast(v);
|
||||||
Token::Value op = compare->token();
|
|
||||||
HValue* left = compare->left();
|
HValue* left = compare->left();
|
||||||
HValue* right = compare->right();
|
HValue* right = compare->right();
|
||||||
Representation r = compare->GetInputRepresentation();
|
Representation r = compare->GetInputRepresentation();
|
||||||
@ -1073,19 +1072,12 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
ASSERT(right->representation().IsInteger32());
|
ASSERT(right->representation().IsInteger32());
|
||||||
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
||||||
UseRegisterAtStart(right));
|
UseRegisterAtStart(right));
|
||||||
} else if (r.IsDouble()) {
|
} else {
|
||||||
|
ASSERT(r.IsDouble());
|
||||||
ASSERT(left->representation().IsDouble());
|
ASSERT(left->representation().IsDouble());
|
||||||
ASSERT(right->representation().IsDouble());
|
ASSERT(right->representation().IsDouble());
|
||||||
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
||||||
UseRegisterAtStart(right));
|
UseRegisterAtStart(right));
|
||||||
} else {
|
|
||||||
ASSERT(left->representation().IsTagged());
|
|
||||||
ASSERT(right->representation().IsTagged());
|
|
||||||
bool reversed = op == Token::GT || op == Token::LTE;
|
|
||||||
LOperand* left_operand = UseFixed(left, reversed ? r0 : r1);
|
|
||||||
LOperand* right_operand = UseFixed(right, reversed ? r1 : r0);
|
|
||||||
LInstruction* result = new LCmpTAndBranch(left_operand, right_operand);
|
|
||||||
return MarkAsCall(result, instr);
|
|
||||||
}
|
}
|
||||||
} else if (v->IsIsSmi()) {
|
} else if (v->IsIsSmi()) {
|
||||||
HIsSmi* compare = HIsSmi::cast(v);
|
HIsSmi* compare = HIsSmi::cast(v);
|
||||||
@ -1122,12 +1114,6 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
||||||
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||||
UseRegisterAtStart(compare->right()));
|
UseRegisterAtStart(compare->right()));
|
||||||
} else if (v->IsInstanceOf()) {
|
|
||||||
HInstanceOf* instance_of = HInstanceOf::cast(v);
|
|
||||||
LInstruction* result =
|
|
||||||
new LInstanceOfAndBranch(UseFixed(instance_of->left(), r0),
|
|
||||||
UseFixed(instance_of->right(), r1));
|
|
||||||
return MarkAsCall(result, instr);
|
|
||||||
} else if (v->IsTypeofIs()) {
|
} else if (v->IsTypeofIs()) {
|
||||||
HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
||||||
return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
|
return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
|
||||||
|
@ -86,7 +86,6 @@ class LCodeGen;
|
|||||||
V(CmpSymbolEq) \
|
V(CmpSymbolEq) \
|
||||||
V(CmpSymbolEqAndBranch) \
|
V(CmpSymbolEqAndBranch) \
|
||||||
V(CmpT) \
|
V(CmpT) \
|
||||||
V(CmpTAndBranch) \
|
|
||||||
V(ConstantD) \
|
V(ConstantD) \
|
||||||
V(ConstantI) \
|
V(ConstantI) \
|
||||||
V(ConstantT) \
|
V(ConstantT) \
|
||||||
@ -108,7 +107,6 @@ class LCodeGen;
|
|||||||
V(HasInstanceTypeAndBranch) \
|
V(HasInstanceTypeAndBranch) \
|
||||||
V(In) \
|
V(In) \
|
||||||
V(InstanceOf) \
|
V(InstanceOf) \
|
||||||
V(InstanceOfAndBranch) \
|
|
||||||
V(InstanceOfKnownGlobal) \
|
V(InstanceOfKnownGlobal) \
|
||||||
V(InstructionGap) \
|
V(InstructionGap) \
|
||||||
V(Integer32ToDouble) \
|
V(Integer32ToDouble) \
|
||||||
@ -910,20 +908,6 @@ class LCmpT: public LTemplateInstruction<1, 2, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LCmpTAndBranch: public LControlInstruction<2, 0> {
|
|
||||||
public:
|
|
||||||
LCmpTAndBranch(LOperand* left, LOperand* right) {
|
|
||||||
inputs_[0] = left;
|
|
||||||
inputs_[1] = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
|
|
||||||
DECLARE_HYDROGEN_ACCESSOR(Compare)
|
|
||||||
|
|
||||||
Token::Value op() const { return hydrogen()->token(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
|
class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
|
||||||
public:
|
public:
|
||||||
LInstanceOf(LOperand* left, LOperand* right) {
|
LInstanceOf(LOperand* left, LOperand* right) {
|
||||||
@ -935,17 +919,6 @@ class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOfAndBranch: public LControlInstruction<2, 0> {
|
|
||||||
public:
|
|
||||||
LInstanceOfAndBranch(LOperand* left, LOperand* right) {
|
|
||||||
inputs_[0] = left;
|
|
||||||
inputs_[1] = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch")
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
|
class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
|
||||||
public:
|
public:
|
||||||
LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
|
LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
|
||||||
|
@ -2150,20 +2150,6 @@ void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
|
|
||||||
ASSERT(ToRegister(instr->InputAt(0)).is(r0)); // Object is in r0.
|
|
||||||
ASSERT(ToRegister(instr->InputAt(1)).is(r1)); // Function is in r1.
|
|
||||||
|
|
||||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
|
||||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
|
||||||
|
|
||||||
InstanceofStub stub(InstanceofStub::kArgsInRegisters);
|
|
||||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
|
||||||
__ cmp(r0, Operand(0));
|
|
||||||
EmitBranch(true_block, false_block, eq);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
||||||
class DeferredInstanceOfKnownGlobal: public LDeferredCode {
|
class DeferredInstanceOfKnownGlobal: public LDeferredCode {
|
||||||
public:
|
public:
|
||||||
@ -2318,25 +2304,6 @@ void LCodeGen::DoCmpT(LCmpT* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
|
|
||||||
Token::Value op = instr->op();
|
|
||||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
|
||||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
|
||||||
|
|
||||||
Handle<Code> ic = CompareIC::GetUninitialized(op);
|
|
||||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
|
||||||
|
|
||||||
// The compare stub expects compare condition and the input operands
|
|
||||||
// reversed for GT and LTE.
|
|
||||||
Condition condition = ComputeCompareCondition(op);
|
|
||||||
if (op == Token::GT || op == Token::LTE) {
|
|
||||||
condition = ReverseCondition(condition);
|
|
||||||
}
|
|
||||||
__ cmp(r0, Operand(0));
|
|
||||||
EmitBranch(true_block, false_block, condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoReturn(LReturn* instr) {
|
void LCodeGen::DoReturn(LReturn* instr) {
|
||||||
if (FLAG_trace) {
|
if (FLAG_trace) {
|
||||||
// Push the return value on the stack as the parameter.
|
// Push the return value on the stack as the parameter.
|
||||||
|
@ -2009,18 +2009,6 @@ void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
|
|
||||||
ASSERT(ToRegister(instr->context()).is(esi));
|
|
||||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
|
||||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
|
||||||
|
|
||||||
InstanceofStub stub(InstanceofStub::kArgsInRegisters);
|
|
||||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, CONTEXT_ADJUSTED);
|
|
||||||
__ test(eax, Operand(eax));
|
|
||||||
EmitBranch(true_block, false_block, zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
||||||
class DeferredInstanceOfKnownGlobal: public LDeferredCode {
|
class DeferredInstanceOfKnownGlobal: public LDeferredCode {
|
||||||
public:
|
public:
|
||||||
@ -2160,25 +2148,6 @@ void LCodeGen::DoCmpT(LCmpT* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
|
|
||||||
Token::Value op = instr->op();
|
|
||||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
|
||||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
|
||||||
|
|
||||||
Handle<Code> ic = CompareIC::GetUninitialized(op);
|
|
||||||
CallCode(ic, RelocInfo::CODE_TARGET, instr, RESTORE_CONTEXT);
|
|
||||||
|
|
||||||
// The compare stub expects compare condition and the input operands
|
|
||||||
// reversed for GT and LTE.
|
|
||||||
Condition condition = ComputeCompareCondition(op);
|
|
||||||
if (op == Token::GT || op == Token::LTE) {
|
|
||||||
condition = ReverseCondition(condition);
|
|
||||||
}
|
|
||||||
__ test(eax, Operand(eax));
|
|
||||||
EmitBranch(true_block, false_block, condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoReturn(LReturn* instr) {
|
void LCodeGen::DoReturn(LReturn* instr) {
|
||||||
if (FLAG_trace) {
|
if (FLAG_trace) {
|
||||||
// Preserve the return value on the stack and rely on the runtime call
|
// Preserve the return value on the stack and rely on the runtime call
|
||||||
|
@ -1051,9 +1051,9 @@ LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
|
|||||||
|
|
||||||
LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
||||||
HValue* v = instr->value();
|
HValue* v = instr->value();
|
||||||
if (!v->EmitAtUses()) {
|
if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v));
|
||||||
return new LBranch(UseRegisterAtStart(v));
|
ASSERT(!v->HasSideEffects());
|
||||||
} else if (v->IsClassOfTest()) {
|
if (v->IsClassOfTest()) {
|
||||||
HClassOfTest* compare = HClassOfTest::cast(v);
|
HClassOfTest* compare = HClassOfTest::cast(v);
|
||||||
ASSERT(compare->value()->representation().IsTagged());
|
ASSERT(compare->value()->representation().IsTagged());
|
||||||
return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
|
return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
|
||||||
@ -1061,7 +1061,6 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
TempRegister());
|
TempRegister());
|
||||||
} else if (v->IsCompare()) {
|
} else if (v->IsCompare()) {
|
||||||
HCompare* compare = HCompare::cast(v);
|
HCompare* compare = HCompare::cast(v);
|
||||||
Token::Value op = compare->token();
|
|
||||||
HValue* left = compare->left();
|
HValue* left = compare->left();
|
||||||
HValue* right = compare->right();
|
HValue* right = compare->right();
|
||||||
Representation r = compare->GetInputRepresentation();
|
Representation r = compare->GetInputRepresentation();
|
||||||
@ -1070,19 +1069,12 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
ASSERT(right->representation().IsInteger32());
|
ASSERT(right->representation().IsInteger32());
|
||||||
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
||||||
UseOrConstantAtStart(right));
|
UseOrConstantAtStart(right));
|
||||||
} else if (r.IsDouble()) {
|
} else {
|
||||||
|
ASSERT(r.IsDouble());
|
||||||
ASSERT(left->representation().IsDouble());
|
ASSERT(left->representation().IsDouble());
|
||||||
ASSERT(right->representation().IsDouble());
|
ASSERT(right->representation().IsDouble());
|
||||||
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
||||||
UseRegisterAtStart(right));
|
UseRegisterAtStart(right));
|
||||||
} else {
|
|
||||||
ASSERT(left->representation().IsTagged());
|
|
||||||
ASSERT(right->representation().IsTagged());
|
|
||||||
bool reversed = op == Token::GT || op == Token::LTE;
|
|
||||||
LOperand* left_operand = UseFixed(left, reversed ? eax : edx);
|
|
||||||
LOperand* right_operand = UseFixed(right, reversed ? edx : eax);
|
|
||||||
LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, right_operand);
|
|
||||||
return MarkAsCall(result, instr);
|
|
||||||
}
|
}
|
||||||
} else if (v->IsIsSmi()) {
|
} else if (v->IsIsSmi()) {
|
||||||
HIsSmi* compare = HIsSmi::cast(v);
|
HIsSmi* compare = HIsSmi::cast(v);
|
||||||
@ -1125,14 +1117,6 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
||||||
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||||
UseRegisterAtStart(compare->right()));
|
UseRegisterAtStart(compare->right()));
|
||||||
} else if (v->IsInstanceOf()) {
|
|
||||||
HInstanceOf* instance_of = HInstanceOf::cast(v);
|
|
||||||
LOperand* left = UseFixed(instance_of->left(), InstanceofStub::left());
|
|
||||||
LOperand* right = UseFixed(instance_of->right(), InstanceofStub::right());
|
|
||||||
LOperand* context = UseFixed(instance_of->context(), esi);
|
|
||||||
LInstanceOfAndBranch* result =
|
|
||||||
new LInstanceOfAndBranch(context, left, right);
|
|
||||||
return MarkAsCall(result, instr);
|
|
||||||
} else if (v->IsTypeofIs()) {
|
} else if (v->IsTypeofIs()) {
|
||||||
HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
||||||
return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
|
return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
|
||||||
|
@ -80,7 +80,6 @@ class LCodeGen;
|
|||||||
V(CmpSymbolEqAndBranch) \
|
V(CmpSymbolEqAndBranch) \
|
||||||
V(CmpMapAndBranch) \
|
V(CmpMapAndBranch) \
|
||||||
V(CmpT) \
|
V(CmpT) \
|
||||||
V(CmpTAndBranch) \
|
|
||||||
V(ConstantD) \
|
V(ConstantD) \
|
||||||
V(ConstantI) \
|
V(ConstantI) \
|
||||||
V(ConstantT) \
|
V(ConstantT) \
|
||||||
@ -102,7 +101,6 @@ class LCodeGen;
|
|||||||
V(HasInstanceTypeAndBranch) \
|
V(HasInstanceTypeAndBranch) \
|
||||||
V(In) \
|
V(In) \
|
||||||
V(InstanceOf) \
|
V(InstanceOf) \
|
||||||
V(InstanceOfAndBranch) \
|
|
||||||
V(InstanceOfKnownGlobal) \
|
V(InstanceOfKnownGlobal) \
|
||||||
V(InstructionGap) \
|
V(InstructionGap) \
|
||||||
V(Integer32ToDouble) \
|
V(Integer32ToDouble) \
|
||||||
@ -920,20 +918,6 @@ class LCmpT: public LTemplateInstruction<1, 2, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LCmpTAndBranch: public LControlInstruction<2, 0> {
|
|
||||||
public:
|
|
||||||
LCmpTAndBranch(LOperand* left, LOperand* right) {
|
|
||||||
inputs_[0] = left;
|
|
||||||
inputs_[1] = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
|
|
||||||
DECLARE_HYDROGEN_ACCESSOR(Compare)
|
|
||||||
|
|
||||||
Token::Value op() const { return hydrogen()->token(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOf: public LTemplateInstruction<1, 3, 0> {
|
class LInstanceOf: public LTemplateInstruction<1, 3, 0> {
|
||||||
public:
|
public:
|
||||||
LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
|
LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
|
||||||
@ -948,20 +932,6 @@ class LInstanceOf: public LTemplateInstruction<1, 3, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOfAndBranch: public LControlInstruction<3, 0> {
|
|
||||||
public:
|
|
||||||
LInstanceOfAndBranch(LOperand* context, LOperand* left, LOperand* right) {
|
|
||||||
inputs_[0] = context;
|
|
||||||
inputs_[1] = left;
|
|
||||||
inputs_[2] = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch")
|
|
||||||
|
|
||||||
LOperand* context() { return inputs_[0]; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
|
class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
|
||||||
public:
|
public:
|
||||||
LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
|
LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
|
||||||
|
@ -2014,19 +2014,6 @@ void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
|
|
||||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
|
||||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
|
||||||
|
|
||||||
InstanceofStub stub(InstanceofStub::kNoFlags);
|
|
||||||
__ push(ToRegister(instr->InputAt(0)));
|
|
||||||
__ push(ToRegister(instr->InputAt(1)));
|
|
||||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
|
||||||
__ testq(rax, rax);
|
|
||||||
EmitBranch(true_block, false_block, zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
||||||
class DeferredInstanceOfKnownGlobal: public LDeferredCode {
|
class DeferredInstanceOfKnownGlobal: public LDeferredCode {
|
||||||
public:
|
public:
|
||||||
@ -2158,25 +2145,6 @@ void LCodeGen::DoCmpT(LCmpT* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) {
|
|
||||||
Token::Value op = instr->op();
|
|
||||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
|
||||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
|
||||||
|
|
||||||
Handle<Code> ic = CompareIC::GetUninitialized(op);
|
|
||||||
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
|
||||||
|
|
||||||
// The compare stub expects compare condition and the input operands
|
|
||||||
// reversed for GT and LTE.
|
|
||||||
Condition condition = TokenToCondition(op, false);
|
|
||||||
if (op == Token::GT || op == Token::LTE) {
|
|
||||||
condition = ReverseCondition(condition);
|
|
||||||
}
|
|
||||||
__ testq(rax, rax);
|
|
||||||
EmitBranch(true_block, false_block, condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoReturn(LReturn* instr) {
|
void LCodeGen::DoReturn(LReturn* instr) {
|
||||||
if (FLAG_trace) {
|
if (FLAG_trace) {
|
||||||
// Preserve the return value on the stack and rely on the runtime
|
// Preserve the return value on the stack and rely on the runtime
|
||||||
|
@ -1051,16 +1051,15 @@ LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
|
|||||||
|
|
||||||
LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
||||||
HValue* v = instr->value();
|
HValue* v = instr->value();
|
||||||
if (!v->EmitAtUses()) {
|
if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v));
|
||||||
return new LBranch(UseRegisterAtStart(v));
|
ASSERT(!v->HasSideEffects());
|
||||||
} else if (v->IsClassOfTest()) {
|
if (v->IsClassOfTest()) {
|
||||||
HClassOfTest* compare = HClassOfTest::cast(v);
|
HClassOfTest* compare = HClassOfTest::cast(v);
|
||||||
ASSERT(compare->value()->representation().IsTagged());
|
ASSERT(compare->value()->representation().IsTagged());
|
||||||
return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
|
return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
|
||||||
TempRegister());
|
TempRegister());
|
||||||
} else if (v->IsCompare()) {
|
} else if (v->IsCompare()) {
|
||||||
HCompare* compare = HCompare::cast(v);
|
HCompare* compare = HCompare::cast(v);
|
||||||
Token::Value op = compare->token();
|
|
||||||
HValue* left = compare->left();
|
HValue* left = compare->left();
|
||||||
HValue* right = compare->right();
|
HValue* right = compare->right();
|
||||||
Representation r = compare->GetInputRepresentation();
|
Representation r = compare->GetInputRepresentation();
|
||||||
@ -1069,19 +1068,12 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
ASSERT(right->representation().IsInteger32());
|
ASSERT(right->representation().IsInteger32());
|
||||||
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
||||||
UseOrConstantAtStart(right));
|
UseOrConstantAtStart(right));
|
||||||
} else if (r.IsDouble()) {
|
} else {
|
||||||
|
ASSERT(r.IsDouble());
|
||||||
ASSERT(left->representation().IsDouble());
|
ASSERT(left->representation().IsDouble());
|
||||||
ASSERT(right->representation().IsDouble());
|
ASSERT(right->representation().IsDouble());
|
||||||
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
return new LCmpIDAndBranch(UseRegisterAtStart(left),
|
||||||
UseRegisterAtStart(right));
|
UseRegisterAtStart(right));
|
||||||
} else {
|
|
||||||
ASSERT(left->representation().IsTagged());
|
|
||||||
ASSERT(right->representation().IsTagged());
|
|
||||||
bool reversed = op == Token::GT || op == Token::LTE;
|
|
||||||
LOperand* left_operand = UseFixed(left, reversed ? rax : rdx);
|
|
||||||
LOperand* right_operand = UseFixed(right, reversed ? rdx : rax);
|
|
||||||
LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, right_operand);
|
|
||||||
return MarkAsCall(result, instr);
|
|
||||||
}
|
}
|
||||||
} else if (v->IsIsSmi()) {
|
} else if (v->IsIsSmi()) {
|
||||||
HIsSmi* compare = HIsSmi::cast(v);
|
HIsSmi* compare = HIsSmi::cast(v);
|
||||||
@ -1119,12 +1111,6 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
|||||||
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
||||||
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||||
UseRegisterAtStart(compare->right()));
|
UseRegisterAtStart(compare->right()));
|
||||||
} else if (v->IsInstanceOf()) {
|
|
||||||
HInstanceOf* instance_of = HInstanceOf::cast(v);
|
|
||||||
LInstanceOfAndBranch* result =
|
|
||||||
new LInstanceOfAndBranch(UseFixed(instance_of->left(), rax),
|
|
||||||
UseFixed(instance_of->right(), rdx));
|
|
||||||
return MarkAsCall(result, instr);
|
|
||||||
} else if (v->IsTypeofIs()) {
|
} else if (v->IsTypeofIs()) {
|
||||||
HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
HTypeofIs* typeof_is = HTypeofIs::cast(v);
|
||||||
return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
|
return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
|
||||||
|
@ -86,7 +86,6 @@ class LCodeGen;
|
|||||||
V(CmpSymbolEq) \
|
V(CmpSymbolEq) \
|
||||||
V(CmpSymbolEqAndBranch) \
|
V(CmpSymbolEqAndBranch) \
|
||||||
V(CmpT) \
|
V(CmpT) \
|
||||||
V(CmpTAndBranch) \
|
|
||||||
V(ConstantD) \
|
V(ConstantD) \
|
||||||
V(ConstantI) \
|
V(ConstantI) \
|
||||||
V(ConstantT) \
|
V(ConstantT) \
|
||||||
@ -108,7 +107,6 @@ class LCodeGen;
|
|||||||
V(HasInstanceTypeAndBranch) \
|
V(HasInstanceTypeAndBranch) \
|
||||||
V(In) \
|
V(In) \
|
||||||
V(InstanceOf) \
|
V(InstanceOf) \
|
||||||
V(InstanceOfAndBranch) \
|
|
||||||
V(InstanceOfKnownGlobal) \
|
V(InstanceOfKnownGlobal) \
|
||||||
V(InstructionGap) \
|
V(InstructionGap) \
|
||||||
V(Integer32ToDouble) \
|
V(Integer32ToDouble) \
|
||||||
@ -895,20 +893,6 @@ class LCmpT: public LTemplateInstruction<1, 2, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LCmpTAndBranch: public LControlInstruction<2, 0> {
|
|
||||||
public:
|
|
||||||
LCmpTAndBranch(LOperand* left, LOperand* right) {
|
|
||||||
inputs_[0] = left;
|
|
||||||
inputs_[1] = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
|
|
||||||
DECLARE_HYDROGEN_ACCESSOR(Compare)
|
|
||||||
|
|
||||||
Token::Value op() const { return hydrogen()->token(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LIn: public LTemplateInstruction<1, 2, 0> {
|
class LIn: public LTemplateInstruction<1, 2, 0> {
|
||||||
public:
|
public:
|
||||||
LIn(LOperand* key, LOperand* object) {
|
LIn(LOperand* key, LOperand* object) {
|
||||||
@ -934,17 +918,6 @@ class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOfAndBranch: public LControlInstruction<2, 0> {
|
|
||||||
public:
|
|
||||||
LInstanceOfAndBranch(LOperand* left, LOperand* right) {
|
|
||||||
inputs_[0] = left;
|
|
||||||
inputs_[1] = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch")
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
|
class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
|
||||||
public:
|
public:
|
||||||
LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
|
LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
|
||||||
|
Loading…
Reference in New Issue
Block a user