Index: src/mips64/code-stubs-mips64.cc |
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc |
index 89eff90d12665acdc2384b8600aa5756bc68714e..824721d1e35dd359dbfe66e5b270c78cb44e339a 100644 |
--- a/src/mips64/code-stubs-mips64.cc |
+++ b/src/mips64/code-stubs-mips64.cc |
@@ -757,11 +757,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 = a5; |
- const Register heapnumber = v0; |
const DoubleRegister double_base = f2; |
const DoubleRegister double_exponent = f4; |
const DoubleRegister double_result = f0; |
@@ -771,35 +768,7 @@ void MathPowStub::Generate(MacroAssembler* masm) { |
const Register scratch2 = a7; |
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. |
- __ ld(base, MemOperand(sp, 1 * kPointerSize)); |
- __ ld(exponent, MemOperand(sp, 0 * kPointerSize)); |
- |
- __ LoadRoot(heapnumbermap, Heap::kHeapNumberMapRootIndex); |
- |
- __ UntagAndJumpIfSmi(scratch, base, &base_is_smi); |
- __ ld(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); |
- |
- __ ld(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); |
@@ -820,55 +789,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); |
@@ -936,38 +856,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; |