From 3c501d3a4b9cb26b66070e1d71d6f470d6d24cce Mon Sep 17 00:00:00 2001 From: "titzer@chromium.org" Date: Wed, 4 Jun 2014 14:57:51 +0000 Subject: [PATCH] Rename ReverseCondition to CommuteCondition, a more standard term. R=dcarney@chromium.org, dcarney BUG= Review URL: https://codereview.chromium.org/313083006 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21677 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/constants-arm.h | 4 ++-- src/arm/lithium-codegen-arm.cc | 6 +++--- src/arm64/constants-arm64.h | 4 ++-- src/arm64/lithium-codegen-arm64.cc | 14 +++++++------- src/ia32/assembler-ia32.h | 4 ++-- src/ia32/lithium-codegen-ia32.cc | 6 +++--- src/mips/constants-mips.h | 3 ++- src/mips/lithium-codegen-mips.cc | 6 +++--- src/x64/assembler-x64.h | 4 ++-- src/x64/lithium-codegen-x64.cc | 6 +++--- src/x87/assembler-x87.h | 4 ++-- src/x87/lithium-codegen-x87.cc | 6 +++--- 12 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/arm/constants-arm.h b/src/arm/constants-arm.h index bd63116..664e12e 100644 --- a/src/arm/constants-arm.h +++ b/src/arm/constants-arm.h @@ -89,8 +89,8 @@ inline Condition NegateCondition(Condition cond) { } -// Corresponds to transposing the operands of a comparison. -inline Condition ReverseCondition(Condition cond) { +// Commute a condition such that a cond b == b cond' b. +inline Condition CommuteCondition(Condition cond) { switch (cond) { case lo: return hi; diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 40747c8..245115f 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -2404,8 +2404,8 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { } else { __ cmp(ToRegister(right), Operand(value)); } - // We transposed the operands. Reverse the condition. - cond = ReverseCondition(cond); + // We commuted the operands, so commute the condition. + cond = CommuteCondition(cond); } else { __ cmp(ToRegister(left), ToRegister(right)); } @@ -4148,7 +4148,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { Operand index = ToOperand(instr->index()); Register length = ToRegister(instr->length()); __ cmp(length, index); - cc = ReverseCondition(cc); + cc = CommuteCondition(cc); } else { Register index = ToRegister(instr->index()); Operand length = ToOperand(instr->length()); diff --git a/src/arm64/constants-arm64.h b/src/arm64/constants-arm64.h index 4afd733..38dc328 100644 --- a/src/arm64/constants-arm64.h +++ b/src/arm64/constants-arm64.h @@ -265,8 +265,8 @@ inline Condition NegateCondition(Condition cond) { return static_cast(cond ^ 1); } -// Corresponds to transposing the operands of a comparison. -inline Condition ReverseCondition(Condition cond) { +// Commute a condition such that a cond b == b cond' b. +inline Condition CommuteCondition(Condition cond) { switch (cond) { case lo: return hi; diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index 00a8748..a235188 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -1848,7 +1848,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck *instr) { Operand index = ToOperand32I(instr->index()); Register length = ToRegister32(instr->length()); __ Cmp(length, index); - cond = ReverseCondition(cond); + cond = CommuteCondition(cond); } else { Register index = ToRegister32(instr->index()); Operand length = ToOperand32I(instr->length()); @@ -2486,10 +2486,10 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { __ Fcmp(ToDoubleRegister(left), ToDouble(LConstantOperand::cast(right))); } else if (left->IsConstantOperand()) { - // Transpose the operands and reverse the condition. + // Commute the operands and the condition. __ Fcmp(ToDoubleRegister(right), ToDouble(LConstantOperand::cast(left))); - cond = ReverseCondition(cond); + cond = CommuteCondition(cond); } else { __ Fcmp(ToDoubleRegister(left), ToDoubleRegister(right)); } @@ -2506,9 +2506,9 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { ToRegister32(left), ToOperand32I(right)); } else { - // Transpose the operands and reverse the condition. + // Commute the operands and the condition. EmitCompareAndBranch(instr, - ReverseCondition(cond), + CommuteCondition(cond), ToRegister32(right), ToOperand32I(left)); } @@ -2521,10 +2521,10 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { ToRegister(left), Operand(Smi::FromInt(value))); } else if (left->IsConstantOperand()) { - // Transpose the operands and reverse the condition. + // Commute the operands and the condition. int32_t value = ToInteger32(LConstantOperand::cast(left)); EmitCompareAndBranch(instr, - ReverseCondition(cond), + CommuteCondition(cond), ToRegister(right), Operand(Smi::FromInt(value))); } else { diff --git a/src/ia32/assembler-ia32.h b/src/ia32/assembler-ia32.h index f5bdc68..fd459fb 100644 --- a/src/ia32/assembler-ia32.h +++ b/src/ia32/assembler-ia32.h @@ -246,8 +246,8 @@ inline Condition NegateCondition(Condition cc) { } -// Corresponds to transposing the operands of a comparison. -inline Condition ReverseCondition(Condition cc) { +// Commute a condition such that a cond b == b cond' b. +inline Condition CommuteCondition(Condition cc) { switch (cc) { case below: return above; diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 57190d7..543d10e 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -2270,8 +2270,8 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { } else if (left->IsConstantOperand()) { __ cmp(ToOperand(right), ToImmediate(left, instr->hydrogen()->representation())); - // We transposed the operands. Reverse the condition. - cc = ReverseCondition(cc); + // We commuted the operands, so commute the condition. + cc = CommuteCondition(cc); } else { __ cmp(ToRegister(left), ToOperand(right)); } @@ -4064,7 +4064,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { __ cmp(ToOperand(instr->length()), ToImmediate(LConstantOperand::cast(instr->index()), instr->hydrogen()->length()->representation())); - cc = ReverseCondition(cc); + cc = CommuteCondition(cc); } else if (instr->length()->IsConstantOperand()) { __ cmp(ToOperand(instr->index()), ToImmediate(LConstantOperand::cast(instr->length()), diff --git a/src/mips/constants-mips.h b/src/mips/constants-mips.h index a05cb04..34d0742 100644 --- a/src/mips/constants-mips.h +++ b/src/mips/constants-mips.h @@ -504,7 +504,8 @@ inline Condition NegateCondition(Condition cc) { } -inline Condition ReverseCondition(Condition cc) { +// Commute a condition such that a cond b == b cond' b. +inline Condition CommuteCondition(Condition cc) { switch (cc) { case Uless: return Ugreater; diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index d961114..e2a4931 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -2324,8 +2324,8 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { cmp_left = ToRegister(right); cmp_right = Operand(value); } - // We transposed the operands. Reverse the condition. - cond = ReverseCondition(cond); + // We commuted the operands, so commute the condition. + cond = CommuteCondition(cond); } else { cmp_left = ToRegister(left); cmp_right = Operand(ToRegister(right)); @@ -4142,7 +4142,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { if (instr->index()->IsConstantOperand()) { operand = ToOperand(instr->index()); reg = ToRegister(instr->length()); - cc = ReverseCondition(cc); + cc = CommuteCondition(cc); } else { reg = ToRegister(instr->index()); operand = ToOperand(instr->length()); diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index 2b1a8d6..4e3b87c 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -326,8 +326,8 @@ inline Condition NegateCondition(Condition cc) { } -// Corresponds to transposing the operands of a comparison. -inline Condition ReverseCondition(Condition cc) { +// Commute a condition such that a cond b == b cond' b. +inline Condition CommuteCondition(Condition cc) { switch (cc) { case below: return above; diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index d8e3921..029070a 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -2276,8 +2276,8 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { } else { __ cmpl(ToOperand(right), Immediate(value)); } - // We transposed the operands. Reverse the condition. - cc = ReverseCondition(cc); + // We commuted the operands, so commute the condition. + cc = CommuteCondition(cc); } else if (instr->hydrogen_value()->representation().IsSmi()) { if (right->IsRegister()) { __ cmpp(ToRegister(left), ToRegister(right)); @@ -4118,7 +4118,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { } else { __ cmpl(index, Immediate(length)); } - cc = ReverseCondition(cc); + cc = CommuteCondition(cc); } else if (instr->index()->IsConstantOperand()) { int32_t index = ToInteger32(LConstantOperand::cast(instr->index())); if (instr->length()->IsRegister()) { diff --git a/src/x87/assembler-x87.h b/src/x87/assembler-x87.h index 8bcf134..1fd724f 100644 --- a/src/x87/assembler-x87.h +++ b/src/x87/assembler-x87.h @@ -238,8 +238,8 @@ inline Condition NegateCondition(Condition cc) { } -// Corresponds to transposing the operands of a comparison. -inline Condition ReverseCondition(Condition cc) { +// Commute a condition such that a cond b == b cond' b. +inline Condition CommuteCondition(Condition cc) { switch (cc) { case below: return above; diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 9fb1216..898df47 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -2404,8 +2404,8 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) { } else if (left->IsConstantOperand()) { __ cmp(ToOperand(right), ToImmediate(left, instr->hydrogen()->representation())); - // We transposed the operands. Reverse the condition. - cc = ReverseCondition(cc); + // We commuted the operands, so commute the condition. + cc = CommuteCondition(cc); } else { __ cmp(ToRegister(left), ToOperand(right)); } @@ -3974,7 +3974,7 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { __ cmp(ToOperand(instr->length()), ToImmediate(LConstantOperand::cast(instr->index()), instr->hydrogen()->length()->representation())); - cc = ReverseCondition(cc); + cc = CommuteCondition(cc); } else if (instr->length()->IsConstantOperand()) { __ cmp(ToOperand(instr->index()), ToImmediate(LConstantOperand::cast(instr->length()), -- 2.7.4