Refactoring only: Make it clear that MOD is special.

LArithmeticD should really be 5 different instructions... :-/

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/23800005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16745 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0020146f
......@@ -756,21 +756,20 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
ASSERT(instr->representation().IsDouble());
ASSERT(instr->left()->representation().IsDouble());
ASSERT(instr->right()->representation().IsDouble());
LOperand* left = NULL;
LOperand* right = NULL;
if (op == Token::MOD) {
left = UseFixedDouble(instr->left(), d1);
right = UseFixedDouble(instr->right(), d2);
LOperand* left = UseFixedDouble(instr->left(), d1);
LOperand* right = UseFixedDouble(instr->right(), d2);
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
// We call a C function for double modulo. It can't trigger a GC. We need
// to use fixed result register for the call.
// TODO(fschneider): Allow any register as input registers.
return MarkAsCall(DefineFixedDouble(result, d1), instr);
}
left = UseRegisterAtStart(instr->left());
right = UseRegisterAtStart(instr->right());
} else {
LOperand* left = UseRegisterAtStart(instr->left());
LOperand* right = UseRegisterAtStart(instr->right());
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
return DefineAsRegister(result);
}
}
......
......@@ -808,11 +808,17 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
ASSERT(instr->representation().IsDouble());
ASSERT(instr->left()->representation().IsDouble());
ASSERT(instr->right()->representation().IsDouble());
if (op == Token::MOD) {
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
return MarkAsCall(DefineSameAsFirst(result), instr);
} else {
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
if (op == Token::MOD) return MarkAsCall(DefineSameAsFirst(result), instr);
return DefineSameAsFirst(result);
}
}
......
......@@ -761,21 +761,20 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
ASSERT(instr->representation().IsDouble());
ASSERT(instr->left()->representation().IsDouble());
ASSERT(instr->right()->representation().IsDouble());
LOperand* left = NULL;
LOperand* right = NULL;
if (op == Token::MOD) {
left = UseFixedDouble(instr->left(), f2);
right = UseFixedDouble(instr->right(), f4);
LOperand* left = UseFixedDouble(instr->left(), f2);
LOperand* right = UseFixedDouble(instr->right(), f4);
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
// We call a C function for double modulo. It can't trigger a GC. We need
// to use fixed result register for the call.
// TODO(fschneider): Allow any register as input registers.
return MarkAsCall(DefineFixedDouble(result, f2), instr);
}
left = UseRegisterAtStart(instr->left());
right = UseRegisterAtStart(instr->right());
} else {
LOperand* left = UseRegisterAtStart(instr->left());
LOperand* right = UseRegisterAtStart(instr->right());
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
return DefineAsRegister(result);
}
}
......
......@@ -760,16 +760,17 @@ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
ASSERT(instr->representation().IsDouble());
ASSERT(instr->left()->representation().IsDouble());
ASSERT(instr->right()->representation().IsDouble());
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = NULL;
if (op == Token::MOD) {
right = UseFixedDouble(instr->BetterRightOperand(), xmm1);
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = UseFixedDouble(instr->BetterRightOperand(), xmm1);
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
return MarkAsCall(DefineSameAsFirst(result), instr);
}
right = UseRegisterAtStart(instr->BetterRightOperand());
} else {
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = UseRegisterAtStart(instr->BetterRightOperand());
LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
return DefineSameAsFirst(result);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment