Commit 041257e5 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Support Smi in CompareIDAndBranch

Port r14842 (1c8d7430)

BUG=

Review URL: https://codereview.chromium.org/15917012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14863 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cbdf760e
......@@ -2047,11 +2047,23 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
Operand cmp_right = Operand(0);
if (right->IsConstantOperand()) {
cmp_left = ToRegister(left);
cmp_right = Operand(ToInteger32(LConstantOperand::cast(right)));
int32_t value = ToInteger32(LConstantOperand::cast(right));
if (instr->hydrogen_value()->representation().IsSmi()) {
cmp_left = ToRegister(left);
cmp_right = Operand(Smi::FromInt(value));
} else {
cmp_left = ToRegister(left);
cmp_right = Operand(value);
}
} else if (left->IsConstantOperand()) {
cmp_left = ToRegister(right);
cmp_right = Operand(ToInteger32(LConstantOperand::cast(left)));
int32_t value = ToInteger32(LConstantOperand::cast(left));
if (instr->hydrogen_value()->representation().IsSmi()) {
cmp_left = ToRegister(right);
cmp_right = Operand(Smi::FromInt(value));
} else {
cmp_left = ToRegister(right);
cmp_right = Operand(value);
}
// We transposed the operands. Reverse the condition.
cond = ReverseCondition(cond);
} else {
......
......@@ -1554,9 +1554,10 @@ LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
LInstruction* LChunkBuilder::DoCompareIDAndBranch(
HCompareIDAndBranch* instr) {
Representation r = instr->representation();
if (r.IsInteger32()) {
ASSERT(instr->left()->representation().IsInteger32());
ASSERT(instr->right()->representation().IsInteger32());
if (r.IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().IsSmiOrInteger32());
ASSERT(instr->left()->representation().Equals(
instr->right()->representation()));
LOperand* left = UseRegisterOrConstantAtStart(instr->left());
LOperand* right = UseRegisterOrConstantAtStart(instr->right());
return new(zone()) LCmpIDAndBranch(left, right);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment