Improve generated code for HDoCompareObjectEqAndBranch on ia32/x64

R=mvstanton@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14324 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
danno@chromium.org 2013-04-18 09:53:49 +00:00
parent 244fa50a80
commit f85f1e0d60
4 changed files with 13 additions and 6 deletions

View File

@ -2287,11 +2287,15 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
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);
}

View File

@ -1693,7 +1693,7 @@ LInstruction* LChunkBuilder::DoCompareIDAndBranch(
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);
}

View File

@ -2055,11 +2055,14 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
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);
}

View File

@ -1610,7 +1610,7 @@ LInstruction* LChunkBuilder::DoCompareIDAndBranch(
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);
}