From 01a8cda43ea6b71b20f08089d8a7558516d0d87a Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Tue, 21 Jun 2011 11:18:15 +0000 Subject: [PATCH] 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 --- src/arm/lithium-arm.cc | 24 +++++----------------- src/arm/lithium-arm.h | 42 +++++++++------------------------------ src/arm/lithium-codegen-arm.cc | 26 ++---------------------- src/hydrogen-instructions.cc | 2 +- src/hydrogen-instructions.h | 43 ++++------------------------------------ src/hydrogen.cc | 22 +++++++------------- src/hydrogen.h | 3 --- src/ia32/lithium-codegen-ia32.cc | 29 ++------------------------- src/ia32/lithium-ia32.cc | 24 +++++----------------- src/ia32/lithium-ia32.h | 42 +++++++++------------------------------ src/x64/lithium-codegen-x64.cc | 29 ++------------------------- src/x64/lithium-x64.cc | 24 +++++----------------- src/x64/lithium-x64.h | 42 +++++++++------------------------------ 13 files changed, 60 insertions(+), 292 deletions(-) diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index f6aa534..f530428 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -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); } diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index 67483e4..a250bed 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -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") }; diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 04712dc..46e0754 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -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()); diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 9f9becb..771770e 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -1571,7 +1571,7 @@ HType HCompare::CalculateInferredType() { } -HType HCompareJSObjectEq::CalculateInferredType() { +HType HCompareObjectEq::CalculateInferredType() { return HType::Boolean(); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index f2ca730..01898a3 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -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) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 7550809..13e0e16 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -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()); } diff --git a/src/hydrogen.h b/src/hydrogen.h index c2339e3..78490db 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -882,9 +882,6 @@ class HGraphBuilder: public AstVisitor { ZoneMapList* types, Handle name); - HCompareSymbolEq* BuildSymbolCompare(HValue* left, - HValue* right, - Token::Value op); HStringCharCodeAt* BuildStringCharCodeAt(HValue* string, HValue* index); HInstruction* BuildBinaryOperation(BinaryOperation* expr, diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 93ed553..e0c84ee 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -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()); diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 590d943..6f2f8d6 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -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); } diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index 6878d6a..41f41c7 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -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") }; diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 3a62182..6bfc212 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -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()); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 138219b..c0b4657 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -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); } diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index 182e0f5..56d04e8 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -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") }; -- 2.7.4