Remove redundant hydrogen- and lithium instruction for symbol comparison.
We had two instructions HCompareJsObjectEq and HCompareSymbolEq that behave exactly the same. I removed one and renamed the remaining instruction into HCompareObjectEq. Review URL: http://codereview.chromium.org/7206040 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8349 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c5a24f64c4
commit
01a8cda43e
@ -1103,13 +1103,9 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
||||
ASSERT(compare->value()->representation().IsTagged());
|
||||
LOperand* temp = TempRegister();
|
||||
return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), temp);
|
||||
} else if (v->IsCompareJSObjectEq()) {
|
||||
HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
|
||||
return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
UseRegisterAtStart(compare->right()));
|
||||
} else if (v->IsCompareSymbolEq()) {
|
||||
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
||||
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
} else if (v->IsCompareObjectEq()) {
|
||||
HCompareObjectEq* compare = HCompareObjectEq::cast(v);
|
||||
return new LCmpObjectEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
UseRegisterAtStart(compare->right()));
|
||||
} else if (v->IsCompareConstantEq()) {
|
||||
HCompareConstantEq* compare = HCompareConstantEq::cast(v);
|
||||
@ -1504,20 +1500,10 @@ LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
|
||||
}
|
||||
|
||||
|
||||
LInstruction* LChunkBuilder::DoCompareJSObjectEq(
|
||||
HCompareJSObjectEq* instr) {
|
||||
LInstruction* LChunkBuilder::DoCompareObjectEq(HCompareObjectEq* instr) {
|
||||
LOperand* left = UseRegisterAtStart(instr->left());
|
||||
LOperand* right = UseRegisterAtStart(instr->right());
|
||||
LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right);
|
||||
return DefineAsRegister(result);
|
||||
}
|
||||
|
||||
|
||||
LInstruction* LChunkBuilder::DoCompareSymbolEq(
|
||||
HCompareSymbolEq* instr) {
|
||||
LOperand* left = UseRegisterAtStart(instr->left());
|
||||
LOperand* right = UseRegisterAtStart(instr->right());
|
||||
LCmpSymbolEq* result = new LCmpSymbolEq(left, right);
|
||||
LCmpObjectEq* result = new LCmpObjectEq(left, right);
|
||||
return DefineAsRegister(result);
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,9 @@ class LCodeGen;
|
||||
V(CmpConstantEqAndBranch) \
|
||||
V(CmpID) \
|
||||
V(CmpIDAndBranch) \
|
||||
V(CmpJSObjectEq) \
|
||||
V(CmpJSObjectEqAndBranch) \
|
||||
V(CmpObjectEq) \
|
||||
V(CmpObjectEqAndBranch) \
|
||||
V(CmpMapAndBranch) \
|
||||
V(CmpSymbolEq) \
|
||||
V(CmpSymbolEqAndBranch) \
|
||||
V(CmpT) \
|
||||
V(ConstantD) \
|
||||
V(ConstantI) \
|
||||
@ -637,48 +635,26 @@ class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
|
||||
};
|
||||
|
||||
|
||||
class LCmpJSObjectEq: public LTemplateInstruction<1, 2, 0> {
|
||||
class LCmpObjectEq: public LTemplateInstruction<1, 2, 0> {
|
||||
public:
|
||||
LCmpJSObjectEq(LOperand* left, LOperand* right) {
|
||||
LCmpObjectEq(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq")
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpObjectEq, "cmp-object-eq")
|
||||
};
|
||||
|
||||
|
||||
class LCmpJSObjectEqAndBranch: public LControlInstruction<2, 0> {
|
||||
class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
|
||||
public:
|
||||
LCmpJSObjectEqAndBranch(LOperand* left, LOperand* right) {
|
||||
LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch,
|
||||
"cmp-jsobject-eq-and-branch")
|
||||
};
|
||||
|
||||
|
||||
class LCmpSymbolEq: public LTemplateInstruction<1, 2, 0> {
|
||||
public:
|
||||
LCmpSymbolEq(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpSymbolEq, "cmp-symbol-eq")
|
||||
};
|
||||
|
||||
|
||||
class LCmpSymbolEqAndBranch: public LControlInstruction<2, 0> {
|
||||
public:
|
||||
LCmpSymbolEqAndBranch(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpSymbolEqAndBranch, "cmp-symbol-eq-and-branch")
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
|
||||
"cmp-object-eq-and-branch")
|
||||
};
|
||||
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
|
||||
void LCodeGen::DoCmpObjectEq(LCmpObjectEq* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
Register result = ToRegister(instr->result());
|
||||
@ -1725,29 +1725,7 @@ void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
||||
|
||||
__ cmp(left, Operand(right));
|
||||
EmitBranch(true_block, false_block, eq);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpSymbolEq(LCmpSymbolEq* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
Register result = ToRegister(instr->result());
|
||||
|
||||
__ cmp(left, Operand(right));
|
||||
__ LoadRoot(result, Heap::kTrueValueRootIndex, eq);
|
||||
__ LoadRoot(result, Heap::kFalseValueRootIndex, ne);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpSymbolEqAndBranch(LCmpSymbolEqAndBranch* instr) {
|
||||
void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
||||
|
@ -1571,7 +1571,7 @@ HType HCompare::CalculateInferredType() {
|
||||
}
|
||||
|
||||
|
||||
HType HCompareJSObjectEq::CalculateInferredType() {
|
||||
HType HCompareObjectEq::CalculateInferredType() {
|
||||
return HType::Boolean();
|
||||
}
|
||||
|
||||
|
@ -91,9 +91,8 @@ class LChunkBuilder;
|
||||
V(ClampToUint8) \
|
||||
V(ClassOfTest) \
|
||||
V(Compare) \
|
||||
V(CompareJSObjectEq) \
|
||||
V(CompareObjectEq) \
|
||||
V(CompareMap) \
|
||||
V(CompareSymbolEq) \
|
||||
V(CompareConstantEq) \
|
||||
V(Constant) \
|
||||
V(Context) \
|
||||
@ -2555,9 +2554,9 @@ class HCompare: public HBinaryOperation {
|
||||
};
|
||||
|
||||
|
||||
class HCompareJSObjectEq: public HBinaryOperation {
|
||||
class HCompareObjectEq: public HBinaryOperation {
|
||||
public:
|
||||
HCompareJSObjectEq(HValue* left, HValue* right)
|
||||
HCompareObjectEq(HValue* left, HValue* right)
|
||||
: HBinaryOperation(left, right) {
|
||||
set_representation(Representation::Tagged());
|
||||
SetFlag(kUseGVN);
|
||||
@ -2573,47 +2572,13 @@ class HCompareJSObjectEq: public HBinaryOperation {
|
||||
}
|
||||
virtual HType CalculateInferredType();
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq)
|
||||
DECLARE_CONCRETE_INSTRUCTION(CompareObjectEq)
|
||||
|
||||
protected:
|
||||
virtual bool DataEquals(HValue* other) { return true; }
|
||||
};
|
||||
|
||||
|
||||
class HCompareSymbolEq: public HBinaryOperation {
|
||||
public:
|
||||
HCompareSymbolEq(HValue* left, HValue* right, Token::Value op)
|
||||
: HBinaryOperation(left, right), op_(op) {
|
||||
ASSERT(op == Token::EQ || op == Token::EQ_STRICT);
|
||||
set_representation(Representation::Tagged());
|
||||
SetFlag(kUseGVN);
|
||||
SetFlag(kDependsOnMaps);
|
||||
}
|
||||
|
||||
Token::Value op() const { return op_; }
|
||||
|
||||
virtual bool EmitAtUses() {
|
||||
return !HasSideEffects() && !HasMultipleUses();
|
||||
}
|
||||
|
||||
virtual Representation RequiredInputRepresentation(int index) const {
|
||||
return Representation::Tagged();
|
||||
}
|
||||
|
||||
virtual HType CalculateInferredType() { return HType::Boolean(); }
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CompareSymbolEq);
|
||||
|
||||
protected:
|
||||
virtual bool DataEquals(HValue* other) {
|
||||
return op_ == HCompareSymbolEq::cast(other)->op_;
|
||||
}
|
||||
|
||||
private:
|
||||
const Token::Value op_;
|
||||
};
|
||||
|
||||
|
||||
class HCompareConstantEq: public HUnaryOperation {
|
||||
public:
|
||||
HCompareConstantEq(HValue* left, int right, Token::Value op)
|
||||
|
@ -5237,18 +5237,6 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
||||
}
|
||||
|
||||
|
||||
HCompareSymbolEq* HGraphBuilder::BuildSymbolCompare(HValue* left,
|
||||
HValue* right,
|
||||
Token::Value op) {
|
||||
ASSERT(op == Token::EQ || op == Token::EQ_STRICT);
|
||||
AddInstruction(new(zone()) HCheckNonSmi(left));
|
||||
AddInstruction(HCheckInstanceType::NewIsSymbol(left));
|
||||
AddInstruction(new(zone()) HCheckNonSmi(right));
|
||||
AddInstruction(HCheckInstanceType::NewIsSymbol(right));
|
||||
return new(zone()) HCompareSymbolEq(left, right, op);
|
||||
}
|
||||
|
||||
|
||||
HStringCharCodeAt* HGraphBuilder::BuildStringCharCodeAt(HValue* string,
|
||||
HValue* index) {
|
||||
AddInstruction(new(zone()) HCheckNonSmi(string));
|
||||
@ -5594,7 +5582,7 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
||||
AddInstruction(HCheckInstanceType::NewIsSpecObject(left));
|
||||
AddInstruction(new(zone()) HCheckNonSmi(right));
|
||||
AddInstruction(HCheckInstanceType::NewIsSpecObject(right));
|
||||
instr = new(zone()) HCompareJSObjectEq(left, right);
|
||||
instr = new(zone()) HCompareObjectEq(left, right);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -5603,7 +5591,11 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
||||
}
|
||||
} else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) &&
|
||||
(op == Token::EQ || op == Token::EQ_STRICT)) {
|
||||
instr = BuildSymbolCompare(left, right, op);
|
||||
AddInstruction(new(zone()) HCheckNonSmi(left));
|
||||
AddInstruction(HCheckInstanceType::NewIsSymbol(left));
|
||||
AddInstruction(new(zone()) HCheckNonSmi(right));
|
||||
AddInstruction(HCheckInstanceType::NewIsSymbol(right));
|
||||
instr = new(zone()) HCompareObjectEq(left, right);
|
||||
} else {
|
||||
HCompare* compare = new(zone()) HCompare(left, right, op);
|
||||
Representation r = ToRepresentation(type_info);
|
||||
@ -5849,7 +5841,7 @@ void HGraphBuilder::GenerateObjectEquals(CallRuntime* call) {
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
|
||||
HValue* right = Pop();
|
||||
HValue* left = Pop();
|
||||
HCompareJSObjectEq* result = new(zone()) HCompareJSObjectEq(left, right);
|
||||
HCompareObjectEq* result = new(zone()) HCompareObjectEq(left, right);
|
||||
ast_context()->ReturnInstruction(result, call->id());
|
||||
}
|
||||
|
||||
|
@ -882,9 +882,6 @@ class HGraphBuilder: public AstVisitor {
|
||||
ZoneMapList* types,
|
||||
Handle<String> name);
|
||||
|
||||
HCompareSymbolEq* BuildSymbolCompare(HValue* left,
|
||||
HValue* right,
|
||||
Token::Value op);
|
||||
HStringCharCodeAt* BuildStringCharCodeAt(HValue* string,
|
||||
HValue* index);
|
||||
HInstruction* BuildBinaryOperation(BinaryOperation* expr,
|
||||
|
@ -1548,7 +1548,7 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
|
||||
void LCodeGen::DoCmpObjectEq(LCmpObjectEq* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
Register result = ToRegister(instr->result());
|
||||
@ -1562,32 +1562,7 @@ void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
||||
|
||||
__ cmp(left, Operand(right));
|
||||
EmitBranch(true_block, false_block, equal);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpSymbolEq(LCmpSymbolEq* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
Register result = ToRegister(instr->result());
|
||||
|
||||
Label done;
|
||||
__ cmp(left, Operand(right));
|
||||
__ mov(result, factory()->false_value());
|
||||
__ j(not_equal, &done, Label::kNear);
|
||||
__ mov(result, factory()->true_value());
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpSymbolEqAndBranch(LCmpSymbolEqAndBranch* instr) {
|
||||
void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
||||
|
@ -1106,13 +1106,9 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
||||
return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()),
|
||||
temp1,
|
||||
temp2);
|
||||
} else if (v->IsCompareJSObjectEq()) {
|
||||
HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
|
||||
return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
UseRegisterAtStart(compare->right()));
|
||||
} else if (v->IsCompareSymbolEq()) {
|
||||
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
||||
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
} else if (v->IsCompareObjectEq()) {
|
||||
HCompareObjectEq* compare = HCompareObjectEq::cast(v);
|
||||
return new LCmpObjectEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
UseRegisterAtStart(compare->right()));
|
||||
} else if (v->IsCompareConstantEq()) {
|
||||
HCompareConstantEq* compare = HCompareConstantEq::cast(v);
|
||||
@ -1528,20 +1524,10 @@ LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
|
||||
}
|
||||
|
||||
|
||||
LInstruction* LChunkBuilder::DoCompareJSObjectEq(
|
||||
HCompareJSObjectEq* instr) {
|
||||
LInstruction* LChunkBuilder::DoCompareObjectEq(HCompareObjectEq* instr) {
|
||||
LOperand* left = UseRegisterAtStart(instr->left());
|
||||
LOperand* right = UseRegisterAtStart(instr->right());
|
||||
LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right);
|
||||
return DefineAsRegister(result);
|
||||
}
|
||||
|
||||
|
||||
LInstruction* LChunkBuilder::DoCompareSymbolEq(
|
||||
HCompareSymbolEq* instr) {
|
||||
LOperand* left = UseRegisterAtStart(instr->left());
|
||||
LOperand* right = UseRegisterAtStart(instr->right());
|
||||
LCmpSymbolEq* result = new LCmpSymbolEq(left, right);
|
||||
LCmpObjectEq* result = new LCmpObjectEq(left, right);
|
||||
return DefineAsRegister(result);
|
||||
}
|
||||
|
||||
|
@ -75,11 +75,9 @@ class LCodeGen;
|
||||
V(ClassOfTestAndBranch) \
|
||||
V(CmpID) \
|
||||
V(CmpIDAndBranch) \
|
||||
V(CmpJSObjectEq) \
|
||||
V(CmpJSObjectEqAndBranch) \
|
||||
V(CmpObjectEq) \
|
||||
V(CmpObjectEqAndBranch) \
|
||||
V(CmpMapAndBranch) \
|
||||
V(CmpSymbolEq) \
|
||||
V(CmpSymbolEqAndBranch) \
|
||||
V(CmpT) \
|
||||
V(CmpConstantEq) \
|
||||
V(CmpConstantEqAndBranch) \
|
||||
@ -622,48 +620,26 @@ class LUnaryMathOperation: public LTemplateInstruction<1, 1, 0> {
|
||||
};
|
||||
|
||||
|
||||
class LCmpJSObjectEq: public LTemplateInstruction<1, 2, 0> {
|
||||
class LCmpObjectEq: public LTemplateInstruction<1, 2, 0> {
|
||||
public:
|
||||
LCmpJSObjectEq(LOperand* left, LOperand* right) {
|
||||
LCmpObjectEq(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq")
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpObjectEq, "cmp-object-eq")
|
||||
};
|
||||
|
||||
|
||||
class LCmpJSObjectEqAndBranch: public LControlInstruction<2, 0> {
|
||||
class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
|
||||
public:
|
||||
LCmpJSObjectEqAndBranch(LOperand* left, LOperand* right) {
|
||||
LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch,
|
||||
"cmp-jsobject-eq-and-branch")
|
||||
};
|
||||
|
||||
|
||||
class LCmpSymbolEq: public LTemplateInstruction<1, 2, 0> {
|
||||
public:
|
||||
LCmpSymbolEq(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpSymbolEq, "cmp-symbol-eq")
|
||||
};
|
||||
|
||||
|
||||
class LCmpSymbolEqAndBranch: public LControlInstruction<2, 0> {
|
||||
public:
|
||||
LCmpSymbolEqAndBranch(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpSymbolEqAndBranch, "cmp-symbol-eq-and-branch")
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
|
||||
"cmp-object-eq-and-branch")
|
||||
};
|
||||
|
||||
|
||||
|
@ -1556,7 +1556,7 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
|
||||
void LCodeGen::DoCmpObjectEq(LCmpObjectEq* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
Register result = ToRegister(instr->result());
|
||||
@ -1572,32 +1572,7 @@ void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) {
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpJSObjectEqAndBranch(LCmpJSObjectEqAndBranch* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
||||
int true_block = chunk_->LookupDestination(instr->true_block_id());
|
||||
|
||||
__ cmpq(left, right);
|
||||
EmitBranch(true_block, false_block, equal);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpSymbolEq(LCmpSymbolEq* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
Register result = ToRegister(instr->result());
|
||||
|
||||
Label done;
|
||||
__ cmpq(left, right);
|
||||
__ LoadRoot(result, Heap::kFalseValueRootIndex);
|
||||
__ j(not_equal, &done, Label::kNear);
|
||||
__ LoadRoot(result, Heap::kTrueValueRootIndex);
|
||||
__ bind(&done);
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::DoCmpSymbolEqAndBranch(LCmpSymbolEqAndBranch* instr) {
|
||||
void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
|
||||
Register left = ToRegister(instr->InputAt(0));
|
||||
Register right = ToRegister(instr->InputAt(1));
|
||||
int false_block = chunk_->LookupDestination(instr->false_block_id());
|
||||
|
@ -1100,13 +1100,9 @@ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
|
||||
HIsObject* compare = HIsObject::cast(v);
|
||||
ASSERT(compare->value()->representation().IsTagged());
|
||||
return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()));
|
||||
} else if (v->IsCompareJSObjectEq()) {
|
||||
HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
|
||||
return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
UseRegisterAtStart(compare->right()));
|
||||
} else if (v->IsCompareSymbolEq()) {
|
||||
HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
|
||||
return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
} else if (v->IsCompareObjectEq()) {
|
||||
HCompareObjectEq* compare = HCompareObjectEq::cast(v);
|
||||
return new LCmpObjectEqAndBranch(UseRegisterAtStart(compare->left()),
|
||||
UseRegisterAtStart(compare->right()));
|
||||
} else if (v->IsCompareConstantEq()) {
|
||||
HCompareConstantEq* compare = HCompareConstantEq::cast(v);
|
||||
@ -1504,20 +1500,10 @@ LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
|
||||
}
|
||||
|
||||
|
||||
LInstruction* LChunkBuilder::DoCompareJSObjectEq(
|
||||
HCompareJSObjectEq* instr) {
|
||||
LInstruction* LChunkBuilder::DoCompareObjectEq(HCompareObjectEq* instr) {
|
||||
LOperand* left = UseRegisterAtStart(instr->left());
|
||||
LOperand* right = UseRegisterAtStart(instr->right());
|
||||
LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right);
|
||||
return DefineAsRegister(result);
|
||||
}
|
||||
|
||||
|
||||
LInstruction* LChunkBuilder::DoCompareSymbolEq(
|
||||
HCompareSymbolEq* instr) {
|
||||
LOperand* left = UseRegisterAtStart(instr->left());
|
||||
LOperand* right = UseRegisterAtStart(instr->right());
|
||||
LCmpSymbolEq* result = new LCmpSymbolEq(left, right);
|
||||
LCmpObjectEq* result = new LCmpObjectEq(left, right);
|
||||
return DefineAsRegister(result);
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,9 @@ class LCodeGen;
|
||||
V(CmpConstantEqAndBranch) \
|
||||
V(CmpID) \
|
||||
V(CmpIDAndBranch) \
|
||||
V(CmpJSObjectEq) \
|
||||
V(CmpJSObjectEqAndBranch) \
|
||||
V(CmpObjectEq) \
|
||||
V(CmpObjectEqAndBranch) \
|
||||
V(CmpMapAndBranch) \
|
||||
V(CmpSymbolEq) \
|
||||
V(CmpSymbolEqAndBranch) \
|
||||
V(CmpT) \
|
||||
V(ConstantD) \
|
||||
V(ConstantI) \
|
||||
@ -620,48 +618,26 @@ class LUnaryMathOperation: public LTemplateInstruction<1, 1, 0> {
|
||||
};
|
||||
|
||||
|
||||
class LCmpJSObjectEq: public LTemplateInstruction<1, 2, 0> {
|
||||
class LCmpObjectEq: public LTemplateInstruction<1, 2, 0> {
|
||||
public:
|
||||
LCmpJSObjectEq(LOperand* left, LOperand* right) {
|
||||
LCmpObjectEq(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq")
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpObjectEq, "cmp-object-eq")
|
||||
};
|
||||
|
||||
|
||||
class LCmpJSObjectEqAndBranch: public LControlInstruction<2, 0> {
|
||||
class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
|
||||
public:
|
||||
LCmpJSObjectEqAndBranch(LOperand* left, LOperand* right) {
|
||||
LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch,
|
||||
"cmp-jsobject-eq-and-branch")
|
||||
};
|
||||
|
||||
|
||||
class LCmpSymbolEq: public LTemplateInstruction<1, 2, 0> {
|
||||
public:
|
||||
LCmpSymbolEq(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpSymbolEq, "cmp-symbol-eq")
|
||||
};
|
||||
|
||||
|
||||
class LCmpSymbolEqAndBranch: public LControlInstruction<2, 0> {
|
||||
public:
|
||||
LCmpSymbolEqAndBranch(LOperand* left, LOperand* right) {
|
||||
inputs_[0] = left;
|
||||
inputs_[1] = right;
|
||||
}
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpSymbolEqAndBranch, "cmp-symbol-eq-and-branch")
|
||||
DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
|
||||
"cmp-object-eq-and-branch")
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user