Reviewers: Paul Lind, kisg, kilvadyb, danno, Jakob,
Message:
PTAL.
Description:
MIPS: Fix Sunspider 1.0/crypto-aes.
* This makes sure that DoModI calculates correct result even when
the left register is the same as the result register.
* Microoptmization: it generates smaller code when left and result
are different registers.
TEST=benchmarks/sunspider/crypto-aes.js
BUG=
Please review this at https://codereview.chromium.org/22491002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/mips/lithium-codegen-mips.cc
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
644919741f3f0860be9b9420a056938b15be3824..34e601ccaa386a3eded1aad2b94fefccaf29bf56
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -1057,20 +1057,16 @@ void LCodeGen::DoModI(LModI* instr) {
HValue* left = hmod->left();
HValue* right = hmod->right();
if (hmod->HasPowerOf2Divisor()) {
- const Register scratch = scratch0();
const Register left_reg = ToRegister(instr->left());
- ASSERT(!left_reg.is(scratch));
const Register result_reg = ToRegister(instr->result());
// Note: The code below even works when right contains kMinInt.
int32_t divisor = Abs(right->GetInteger32Constant());
- __ mov(scratch, left_reg);
-
Label left_is_not_negative, done;
if (left->CanBeNegative()) {
- __ Branch(USE_DELAY_SLOT, &left_is_not_negative,
- ge, left_reg, Operand(zero_reg));
+ __ Branch(left_reg.is(result_reg) ? PROTECT : USE_DELAY_SLOT,
+ &left_is_not_negative, ge, left_reg, Operand(zero_reg));
__ subu(result_reg, zero_reg, left_reg);
__ And(result_reg, result_reg, divisor - 1);
if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
@@ -1081,15 +1077,13 @@ void LCodeGen::DoModI(LModI* instr) {
}
__ bind(&left_is_not_negative);
- __ And(result_reg, scratch, divisor - 1);
+ __ And(result_reg, left_reg, divisor - 1);
__ bind(&done);
} else if (hmod->fixed_right_arg().has_value) {
- const Register scratch = scratch0();
const Register left_reg = ToRegister(instr->left());
const Register result_reg = ToRegister(instr->result());
-
- Register right_reg = EmitLoadRegister(instr->right(), scratch);
+ const Register right_reg = ToRegister(instr->right());
int32_t divisor = hmod->fixed_right_arg().value;
ASSERT(IsPowerOf2(divisor));
@@ -1099,8 +1093,8 @@ void LCodeGen::DoModI(LModI* instr) {
Label left_is_not_negative, done;
if (left->CanBeNegative()) {
- __ Branch(USE_DELAY_SLOT, &left_is_not_negative,
- ge, left_reg, Operand(zero_reg));
+ __ Branch(left_reg.is(result_reg) ? PROTECT : USE_DELAY_SLOT,
+ &left_is_not_negative, ge, left_reg, Operand(zero_reg));
__ subu(result_reg, zero_reg, left_reg);
__ And(result_reg, result_reg, divisor - 1);
if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.