| Index: src/mips/lithium-mips.cc
|
| diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
|
| index 14ccfd4d93d1c7aad6ac547d91a4437b5c29bc37..ae75ec15de9a7c7f5e64d8c800df2d93af6e092b 100644
|
| --- a/src/mips/lithium-mips.cc
|
| +++ b/src/mips/lithium-mips.cc
|
| @@ -302,17 +302,6 @@ void LCallConstantFunction::PrintDataTo(StringStream* stream) {
|
| }
|
|
|
|
|
| -void LUnaryMathOperation::PrintDataTo(StringStream* stream) {
|
| - stream->Add("/%s ", hydrogen()->OpName());
|
| - value()->PrintTo(stream);
|
| -}
|
| -
|
| -
|
| -void LMathExp::PrintDataTo(StringStream* stream) {
|
| - value()->PrintTo(stream);
|
| -}
|
| -
|
| -
|
| void LLoadContextSlot::PrintDataTo(StringStream* stream) {
|
| context()->PrintTo(stream);
|
| stream->Add("[%d]", slot_index());
|
| @@ -1123,50 +1112,103 @@ LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
|
| - BuiltinFunctionId op = instr->op();
|
| - if (op == kMathLog || op == kMathSin || op == kMathCos || op == kMathTan) {
|
| - LOperand* input = UseFixedDouble(instr->value(), f4);
|
| - LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, NULL);
|
| - return MarkAsCall(DefineFixedDouble(result, f4), instr);
|
| - } else if (op == kMathExp) {
|
| - ASSERT(instr->representation().IsDouble());
|
| - ASSERT(instr->value()->representation().IsDouble());
|
| - LOperand* input = UseTempRegister(instr->value());
|
| - LOperand* temp1 = TempRegister();
|
| - LOperand* temp2 = TempRegister();
|
| - LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll.
|
| - LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
|
| - return DefineAsRegister(result);
|
| - } else if (op == kMathPowHalf) {
|
| - // Input cannot be the same as the result.
|
| - // See lithium-codegen-mips.cc::DoMathPowHalf.
|
| - LOperand* input = UseFixedDouble(instr->value(), f8);
|
| - LOperand* temp = FixedTemp(f6);
|
| - LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
|
| - return DefineFixedDouble(result, f4);
|
| - } else {
|
| - LOperand* input = UseRegister(instr->value());
|
| -
|
| - LOperand* temp = (op == kMathRound) ? FixedTemp(f6) :
|
| - (op == kMathFloor) ? TempRegister() : NULL;
|
| - LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input, temp);
|
| - switch (op) {
|
| - case kMathAbs:
|
| - return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
|
| - case kMathFloor:
|
| - return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
|
| - case kMathSqrt:
|
| - return DefineAsRegister(result);
|
| - case kMathRound:
|
| - return AssignEnvironment(DefineAsRegister(result));
|
| - default:
|
| - UNREACHABLE();
|
| - return NULL;
|
| - }
|
| + switch (instr->op()) {
|
| + case kMathFloor: return DoMathFloor(instr);
|
| + case kMathRound: return DoMathRound(instr);
|
| + case kMathAbs: return DoMathAbs(instr);
|
| + case kMathLog: return DoMathLog(instr);
|
| + case kMathSin: return DoMathSin(instr);
|
| + case kMathCos: return DoMathCos(instr);
|
| + case kMathTan: return DoMathTan(instr);
|
| + case kMathExp: return DoMathExp(instr);
|
| + case kMathSqrt: return DoMathSqrt(instr);
|
| + case kMathPowHalf: return DoMathPowHalf(instr);
|
| + default:
|
| + UNREACHABLE();
|
| + return NULL;
|
| }
|
| }
|
|
|
|
|
| +LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseFixedDouble(instr->value(), f4);
|
| + LMathLog* result = new(zone()) LMathLog(input);
|
| + return MarkAsCall(DefineFixedDouble(result, f4), instr);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseFixedDouble(instr->value(), f4);
|
| + LMathSin* result = new(zone()) LMathSin(input);
|
| + return MarkAsCall(DefineFixedDouble(result, f4), instr);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseFixedDouble(instr->value(), f4);
|
| + LMathCos* result = new(zone()) LMathCos(input);
|
| + return MarkAsCall(DefineFixedDouble(result, f4), instr);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseFixedDouble(instr->value(), f4);
|
| + LMathTan* result = new(zone()) LMathTan(input);
|
| + return MarkAsCall(DefineFixedDouble(result, f4), instr);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
|
| + ASSERT(instr->representation().IsDouble());
|
| + ASSERT(instr->value()->representation().IsDouble());
|
| + LOperand* input = UseTempRegister(instr->value());
|
| + LOperand* temp1 = TempRegister();
|
| + LOperand* temp2 = TempRegister();
|
| + LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll.
|
| + LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
|
| + return DefineAsRegister(result);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
|
| + // Input cannot be the same as the result, see LCodeGen::DoMathPowHalf.
|
| + LOperand* input = UseFixedDouble(instr->value(), f8);
|
| + LOperand* temp = FixedTemp(f6);
|
| + LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp);
|
| + return DefineFixedDouble(result, f4);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseRegister(instr->value());
|
| + LMathAbs* result = new(zone()) LMathAbs(input);
|
| + return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseRegister(instr->value());
|
| + LOperand* temp = TempRegister();
|
| + LMathFloor* result = new(zone()) LMathFloor(input, temp);
|
| + return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseRegister(instr->value());
|
| + LMathSqrt* result = new(zone()) LMathSqrt(input);
|
| + return DefineAsRegister(result);
|
| +}
|
| +
|
| +
|
| +LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
|
| + LOperand* input = UseRegister(instr->value());
|
| + LOperand* temp = FixedTemp(f6);
|
| + LMathRound* result = new(zone()) LMathRound(input, temp);
|
| + return AssignEnvironment(DefineAsRegister(result));
|
| +}
|
| +
|
| +
|
| LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
|
| ASSERT(instr->key()->representation().IsTagged());
|
| argument_count_ -= instr->argument_count();
|
|
|