void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
Register left = ToRegister(instr->left());
- Operand right = ToOperand(instr->right());
int false_block = chunk_->LookupDestination(instr->false_block_id());
int true_block = chunk_->LookupDestination(instr->true_block_id());
- __ cmp(left, Operand(right));
+ if (instr->right()->IsConstantOperand()) {
+ __ cmp(left, ToHandle(LConstantOperand::cast(instr->right())));
+ } else {
+ Operand right = ToOperand(instr->right());
+ __ cmp(left, Operand(right));
+ }
EmitBranch(true_block, false_block, equal);
}
LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
HCompareObjectEqAndBranch* instr) {
LOperand* left = UseRegisterAtStart(instr->left());
- LOperand* right = UseAtStart(instr->right());
+ LOperand* right = UseOrConstantAtStart(instr->right());
return new(zone()) LCmpObjectEqAndBranch(left, right);
}
void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
Register left = ToRegister(instr->left());
- Register right = ToRegister(instr->right());
int false_block = chunk_->LookupDestination(instr->false_block_id());
int true_block = chunk_->LookupDestination(instr->true_block_id());
- __ cmpq(left, right);
+ if (instr->right()->IsConstantOperand()) {
+ __ Cmp(left, ToHandle(LConstantOperand::cast(instr->right())));
+ } else {
+ __ cmpq(left, ToRegister(instr->right()));
+ }
EmitBranch(true_block, false_block, equal);
}
LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
HCompareObjectEqAndBranch* instr) {
LOperand* left = UseRegisterAtStart(instr->left());
- LOperand* right = UseRegisterAtStart(instr->right());
+ LOperand* right = UseRegisterOrConstantAtStart(instr->right());
return new(zone()) LCmpObjectEqAndBranch(left, right);
}