| Index: src/mips/code-stubs-mips.cc
|
| diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
|
| index 3213677f6209a1251c8c3c23b921ef4bb4224eb7..a4dfbb6d7cfd54f9aaaee76b1cba7da13bbdf65b 100644
|
| --- a/src/mips/code-stubs-mips.cc
|
| +++ b/src/mips/code-stubs-mips.cc
|
| @@ -760,11 +760,8 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) {
|
|
|
|
|
| void MathPowStub::Generate(MacroAssembler* masm) {
|
| - const Register base = a1;
|
| const Register exponent = MathPowTaggedDescriptor::exponent();
|
| DCHECK(exponent.is(a2));
|
| - const Register heapnumbermap = t1;
|
| - const Register heapnumber = v0;
|
| const DoubleRegister double_base = f2;
|
| const DoubleRegister double_exponent = f4;
|
| const DoubleRegister double_result = f0;
|
| @@ -774,35 +771,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
|
| const Register scratch2 = t3;
|
|
|
| Label call_runtime, done, int_exponent;
|
| - if (exponent_type() == ON_STACK) {
|
| - Label base_is_smi, unpack_exponent;
|
| - // The exponent and base are supplied as arguments on the stack.
|
| - // This can only happen if the stub is called from non-optimized code.
|
| - // Load input parameters from stack to double registers.
|
| - __ lw(base, MemOperand(sp, 1 * kPointerSize));
|
| - __ lw(exponent, MemOperand(sp, 0 * kPointerSize));
|
| -
|
| - __ LoadRoot(heapnumbermap, Heap::kHeapNumberMapRootIndex);
|
| -
|
| - __ UntagAndJumpIfSmi(scratch, base, &base_is_smi);
|
| - __ lw(scratch, FieldMemOperand(base, JSObject::kMapOffset));
|
| - __ Branch(&call_runtime, ne, scratch, Operand(heapnumbermap));
|
| -
|
| - __ ldc1(double_base, FieldMemOperand(base, HeapNumber::kValueOffset));
|
| - __ jmp(&unpack_exponent);
|
| -
|
| - __ bind(&base_is_smi);
|
| - __ mtc1(scratch, single_scratch);
|
| - __ cvt_d_w(double_base, single_scratch);
|
| - __ bind(&unpack_exponent);
|
| -
|
| - __ UntagAndJumpIfSmi(scratch, exponent, &int_exponent);
|
| -
|
| - __ lw(scratch, FieldMemOperand(exponent, JSObject::kMapOffset));
|
| - __ Branch(&call_runtime, ne, scratch, Operand(heapnumbermap));
|
| - __ ldc1(double_exponent,
|
| - FieldMemOperand(exponent, HeapNumber::kValueOffset));
|
| - } else if (exponent_type() == TAGGED) {
|
| + if (exponent_type() == TAGGED) {
|
| // Base is already in double_base.
|
| __ UntagAndJumpIfSmi(scratch, exponent, &int_exponent);
|
|
|
| @@ -823,54 +792,6 @@ void MathPowStub::Generate(MacroAssembler* masm) {
|
| // scratch2 == 0 means there was no conversion error.
|
| __ Branch(&int_exponent_convert, eq, scratch2, Operand(zero_reg));
|
|
|
| - if (exponent_type() == ON_STACK) {
|
| - // Detect square root case. Crankshaft detects constant +/-0.5 at
|
| - // compile time and uses DoMathPowHalf instead. We then skip this check
|
| - // for non-constant cases of +/-0.5 as these hardly occur.
|
| - Label not_plus_half;
|
| - // Test for 0.5.
|
| - __ Move(double_scratch, 0.5);
|
| - __ BranchF(USE_DELAY_SLOT,
|
| - ¬_plus_half,
|
| - NULL,
|
| - ne,
|
| - double_exponent,
|
| - double_scratch);
|
| - // double_scratch can be overwritten in the delay slot.
|
| - // Calculates square root of base. Check for the special case of
|
| - // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13).
|
| - __ Move(double_scratch, static_cast<double>(-V8_INFINITY));
|
| - __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch);
|
| - __ neg_d(double_result, double_scratch);
|
| -
|
| - // Add +0 to convert -0 to +0.
|
| - __ add_d(double_scratch, double_base, kDoubleRegZero);
|
| - __ sqrt_d(double_result, double_scratch);
|
| - __ jmp(&done);
|
| -
|
| - __ bind(¬_plus_half);
|
| - __ Move(double_scratch, -0.5);
|
| - __ BranchF(USE_DELAY_SLOT,
|
| - &call_runtime,
|
| - NULL,
|
| - ne,
|
| - double_exponent,
|
| - double_scratch);
|
| - // double_scratch can be overwritten in the delay slot.
|
| - // Calculates square root of base. Check for the special case of
|
| - // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13).
|
| - __ Move(double_scratch, static_cast<double>(-V8_INFINITY));
|
| - __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch);
|
| - __ Move(double_result, kDoubleRegZero);
|
| -
|
| - // Add +0 to convert -0 to +0.
|
| - __ add_d(double_scratch, double_base, kDoubleRegZero);
|
| - __ Move(double_result, 1.);
|
| - __ sqrt_d(double_scratch, double_scratch);
|
| - __ div_d(double_result, double_result, double_scratch);
|
| - __ jmp(&done);
|
| - }
|
| -
|
| __ push(ra);
|
| {
|
| AllowExternalCallThatCantCauseGC scope(masm);
|
| @@ -938,38 +859,20 @@ void MathPowStub::Generate(MacroAssembler* masm) {
|
| __ cvt_d_w(double_exponent, single_scratch);
|
|
|
| // Returning or bailing out.
|
| - if (exponent_type() == ON_STACK) {
|
| - // The arguments are still on the stack.
|
| - __ bind(&call_runtime);
|
| - __ TailCallRuntime(Runtime::kMathPowRT);
|
| -
|
| - // The stub is called from non-optimized code, which expects the result
|
| - // as heap number in exponent.
|
| - __ bind(&done);
|
| - __ AllocateHeapNumber(
|
| - heapnumber, scratch, scratch2, heapnumbermap, &call_runtime);
|
| - __ sdc1(double_result,
|
| - FieldMemOperand(heapnumber, HeapNumber::kValueOffset));
|
| - DCHECK(heapnumber.is(v0));
|
| - __ DropAndRet(2);
|
| - } else {
|
| - __ push(ra);
|
| - {
|
| - AllowExternalCallThatCantCauseGC scope(masm);
|
| - __ PrepareCallCFunction(0, 2, scratch);
|
| - __ MovToFloatParameters(double_base, double_exponent);
|
| - __ CallCFunction(
|
| - ExternalReference::power_double_double_function(isolate()),
|
| - 0, 2);
|
| - }
|
| - __ pop(ra);
|
| - __ MovFromFloatResult(double_result);
|
| -
|
| - __ bind(&done);
|
| - __ Ret();
|
| + __ push(ra);
|
| + {
|
| + AllowExternalCallThatCantCauseGC scope(masm);
|
| + __ PrepareCallCFunction(0, 2, scratch);
|
| + __ MovToFloatParameters(double_base, double_exponent);
|
| + __ CallCFunction(ExternalReference::power_double_double_function(isolate()),
|
| + 0, 2);
|
| }
|
| -}
|
| + __ pop(ra);
|
| + __ MovFromFloatResult(double_result);
|
|
|
| + __ bind(&done);
|
| + __ Ret();
|
| +}
|
|
|
| bool CEntryStub::NeedsImmovableCode() {
|
| return true;
|
|
|