From 31813439584e5b49b838268592c1fe2a2556e445 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Thu, 19 Sep 2013 06:06:32 +0000 Subject: [PATCH] Turn HCompareHoleAndBranch into a HUnaryControlInstruction. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/24195009 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16805 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-arm.cc | 4 ++-- src/hydrogen-instructions.cc | 8 +------- src/hydrogen-instructions.h | 15 +++++++-------- src/ia32/lithium-ia32.cc | 4 ++-- src/x64/lithium-x64.cc | 4 ++-- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 96a323ee8f..30d7c823e6 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1756,8 +1756,8 @@ LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( LInstruction* LChunkBuilder::DoCompareHoleAndBranch( HCompareHoleAndBranch* instr) { - LOperand* object = UseRegisterAtStart(instr->object()); - return new(zone()) LCmpHoleAndBranch(object); + LOperand* value = UseRegisterAtStart(instr->value()); + return new(zone()) LCmpHoleAndBranch(value); } diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 4936a16ca3..afae2b1599 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -2857,15 +2857,9 @@ void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { } -void HCompareHoleAndBranch::PrintDataTo(StringStream* stream) { - object()->PrintNameTo(stream); - HControlInstruction::PrintDataTo(stream); -} - - void HCompareHoleAndBranch::InferRepresentation( HInferRepresentationPhase* h_infer) { - ChangeRepresentation(object()->representation()); + ChangeRepresentation(value()->representation()); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 6603e6cf4a..0177168d63 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -4035,20 +4035,21 @@ class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { }; -class HCompareHoleAndBranch V8_FINAL - : public HTemplateControlInstruction<2, 1> { +class HCompareHoleAndBranch V8_FINAL : public HUnaryControlInstruction { public: // TODO(danno): make this private when the IfBuilder properly constructs // control flow instructions. - explicit HCompareHoleAndBranch(HValue* object) { + HCompareHoleAndBranch(HValue* value, + HBasicBlock* true_target = NULL, + HBasicBlock* false_target = NULL) + : HUnaryControlInstruction(value, true_target, false_target) { SetFlag(kFlexibleRepresentation); SetFlag(kAllowUndefinedAsNaN); - SetOperandAt(0, object); } DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); - - HValue* object() { return OperandAt(0); } + DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, + HBasicBlock*, HBasicBlock*); virtual void InferRepresentation( HInferRepresentationPhase* h_infer) V8_OVERRIDE; @@ -4057,8 +4058,6 @@ class HCompareHoleAndBranch V8_FINAL return representation(); } - virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; - DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) }; diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index a47b525c46..c5cf41405c 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -1748,8 +1748,8 @@ LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( LInstruction* LChunkBuilder::DoCompareHoleAndBranch( HCompareHoleAndBranch* instr) { - LOperand* object = UseRegisterAtStart(instr->object()); - return new(zone()) LCmpHoleAndBranch(object); + LOperand* value = UseRegisterAtStart(instr->value()); + return new(zone()) LCmpHoleAndBranch(value); } diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index fcf2862da4..62dcaeb5db 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1647,8 +1647,8 @@ LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( LInstruction* LChunkBuilder::DoCompareHoleAndBranch( HCompareHoleAndBranch* instr) { - LOperand* object = UseRegisterAtStart(instr->object()); - return new(zone()) LCmpHoleAndBranch(object); + LOperand* value = UseRegisterAtStart(instr->value()); + return new(zone()) LCmpHoleAndBranch(value); }