Commit a63ea2d3 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Use TempDoubleRegister.

Port r21517 (53d6507)

BUG=
R=plind44@gmail.com

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21537 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 88abd8ab
...@@ -633,6 +633,19 @@ LUnallocated* LChunkBuilder::TempRegister() { ...@@ -633,6 +633,19 @@ LUnallocated* LChunkBuilder::TempRegister() {
} }
LUnallocated* LChunkBuilder::TempDoubleRegister() {
LUnallocated* operand =
new(zone()) LUnallocated(LUnallocated::MUST_HAVE_DOUBLE_REGISTER);
int vreg = allocator_->GetVirtualRegister();
if (!allocator_->AllocationOk()) {
Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister);
vreg = 0;
}
operand->set_virtual_register(vreg);
return operand;
}
LOperand* LChunkBuilder::FixedTemp(Register reg) { LOperand* LChunkBuilder::FixedTemp(Register reg) {
LUnallocated* operand = ToUnallocated(reg); LUnallocated* operand = ToUnallocated(reg);
ASSERT(operand->HasFixedPolicy()); ASSERT(operand->HasFixedPolicy());
...@@ -1134,7 +1147,7 @@ LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { ...@@ -1134,7 +1147,7 @@ LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
LOperand* input = UseRegister(instr->value()); LOperand* input = UseRegister(instr->value());
LOperand* temp1 = TempRegister(); LOperand* temp1 = TempRegister();
LOperand* temp2 = TempRegister(); LOperand* temp2 = TempRegister();
LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll. LOperand* double_temp = TempDoubleRegister();
LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
return DefineAsRegister(result); return DefineAsRegister(result);
} }
...@@ -1143,7 +1156,7 @@ LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { ...@@ -1143,7 +1156,7 @@ LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
// Input cannot be the same as the result, see LCodeGen::DoMathPowHalf. // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf.
LOperand* input = UseFixedDouble(instr->value(), f8); LOperand* input = UseFixedDouble(instr->value(), f8);
LOperand* temp = FixedTemp(f6); LOperand* temp = TempDoubleRegister();
LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp);
return DefineFixedDouble(result, f4); return DefineFixedDouble(result, f4);
} }
...@@ -1180,7 +1193,7 @@ LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { ...@@ -1180,7 +1193,7 @@ LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
LOperand* input = UseRegister(instr->value()); LOperand* input = UseRegister(instr->value());
LOperand* temp = FixedTemp(f6); LOperand* temp = TempDoubleRegister();
LMathRound* result = new(zone()) LMathRound(input, temp); LMathRound* result = new(zone()) LMathRound(input, temp);
return AssignEnvironment(DefineAsRegister(result)); return AssignEnvironment(DefineAsRegister(result));
} }
...@@ -1842,7 +1855,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { ...@@ -1842,7 +1855,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
} else { } else {
LOperand* value = UseRegister(val); LOperand* value = UseRegister(val);
LOperand* temp1 = TempRegister(); LOperand* temp1 = TempRegister();
LOperand* temp2 = FixedTemp(f22); LOperand* temp2 = TempDoubleRegister();
LInstruction* result = LInstruction* result =
DefineSameAsFirst(new(zone()) LTaggedToI(value, temp1, temp2)); DefineSameAsFirst(new(zone()) LTaggedToI(value, temp1, temp2));
if (!val->representation().IsSmi()) result = AssignEnvironment(result); if (!val->representation().IsSmi()) result = AssignEnvironment(result);
...@@ -1954,14 +1967,14 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { ...@@ -1954,14 +1967,14 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
LOperand* reg = UseRegister(value); LOperand* reg = UseRegister(value);
if (input_rep.IsDouble()) { if (input_rep.IsDouble()) {
// Revisit this decision, here and 8 lines below. // Revisit this decision, here and 8 lines below.
return DefineAsRegister(new(zone()) LClampDToUint8(reg, FixedTemp(f22))); return DefineAsRegister(new(zone()) LClampDToUint8(reg,
TempDoubleRegister()));
} else if (input_rep.IsInteger32()) { } else if (input_rep.IsInteger32()) {
return DefineAsRegister(new(zone()) LClampIToUint8(reg)); return DefineAsRegister(new(zone()) LClampIToUint8(reg));
} else { } else {
ASSERT(input_rep.IsSmiOrTagged()); ASSERT(input_rep.IsSmiOrTagged());
// Register allocator doesn't (yet) support allocation of double LClampTToUint8* result =
// temps. Reserve f22 explicitly. new(zone()) LClampTToUint8(reg, TempDoubleRegister());
LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(f22));
return AssignEnvironment(DefineAsRegister(result)); return AssignEnvironment(DefineAsRegister(result));
} }
} }
......
...@@ -2764,6 +2764,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase { ...@@ -2764,6 +2764,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
// Temporary operand that must be in a register. // Temporary operand that must be in a register.
MUST_USE_RESULT LUnallocated* TempRegister(); MUST_USE_RESULT LUnallocated* TempRegister();
MUST_USE_RESULT LUnallocated* TempDoubleRegister();
MUST_USE_RESULT LOperand* FixedTemp(Register reg); MUST_USE_RESULT LOperand* FixedTemp(Register reg);
MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
......
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