Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 0ef31d7dfeb0cafa977142906b61615a761e5180..8f96fc9c16acc796c5097a739e8225c6e7608dc2 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -694,13 +694,9 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { |
__ ldm(ia_w, sp, kCallerSaved | pc.bit()); // Also pop pc to get Ret(0). |
} |
- |
void MathPowStub::Generate(MacroAssembler* masm) { |
- const Register base = r1; |
const Register exponent = MathPowTaggedDescriptor::exponent(); |
DCHECK(exponent.is(r2)); |
- const Register heapnumbermap = r5; |
- const Register heapnumber = r0; |
const DwVfpRegister double_base = d0; |
const DwVfpRegister double_exponent = d1; |
const DwVfpRegister double_result = d2; |
@@ -710,37 +706,7 @@ void MathPowStub::Generate(MacroAssembler* masm) { |
const Register scratch2 = r4; |
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. |
- __ ldr(base, MemOperand(sp, 1 * kPointerSize)); |
- __ ldr(exponent, MemOperand(sp, 0 * kPointerSize)); |
- |
- __ LoadRoot(heapnumbermap, Heap::kHeapNumberMapRootIndex); |
- |
- __ UntagAndJumpIfSmi(scratch, base, &base_is_smi); |
- __ ldr(scratch, FieldMemOperand(base, JSObject::kMapOffset)); |
- __ cmp(scratch, heapnumbermap); |
- __ b(ne, &call_runtime); |
- |
- __ vldr(double_base, FieldMemOperand(base, HeapNumber::kValueOffset)); |
- __ jmp(&unpack_exponent); |
- |
- __ bind(&base_is_smi); |
- __ vmov(single_scratch, scratch); |
- __ vcvt_f64_s32(double_base, single_scratch); |
- __ bind(&unpack_exponent); |
- |
- __ UntagAndJumpIfSmi(scratch, exponent, &int_exponent); |
- |
- __ ldr(scratch, FieldMemOperand(exponent, JSObject::kMapOffset)); |
- __ cmp(scratch, heapnumbermap); |
- __ b(ne, &call_runtime); |
- __ vldr(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); |
@@ -758,57 +724,13 @@ void MathPowStub::Generate(MacroAssembler* masm) { |
__ VFPCompareAndSetFlags(double_scratch, double_exponent); |
__ b(eq, &int_exponent_convert); |
- 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. |
- __ vmov(double_scratch, 0.5, scratch); |
- __ VFPCompareAndSetFlags(double_exponent, double_scratch); |
- __ b(ne, ¬_plus_half); |
- |
- // Calculates square root of base. Check for the special case of |
- // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). |
- __ vmov(double_scratch, -V8_INFINITY, scratch); |
- __ VFPCompareAndSetFlags(double_base, double_scratch); |
- __ vneg(double_result, double_scratch, eq); |
- __ b(eq, &done); |
- |
- // Add +0 to convert -0 to +0. |
- __ vadd(double_scratch, double_base, kDoubleRegZero); |
- __ vsqrt(double_result, double_scratch); |
- __ jmp(&done); |
- |
- __ bind(¬_plus_half); |
- __ vmov(double_scratch, -0.5, scratch); |
- __ VFPCompareAndSetFlags(double_exponent, double_scratch); |
- __ b(ne, &call_runtime); |
- |
- // Calculates square root of base. Check for the special case of |
- // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). |
- __ vmov(double_scratch, -V8_INFINITY, scratch); |
- __ VFPCompareAndSetFlags(double_base, double_scratch); |
- __ vmov(double_result, kDoubleRegZero, eq); |
- __ b(eq, &done); |
- |
- // Add +0 to convert -0 to +0. |
- __ vadd(double_scratch, double_base, kDoubleRegZero); |
- __ vmov(double_result, 1.0, scratch); |
- __ vsqrt(double_scratch, double_scratch); |
- __ vdiv(double_result, double_result, double_scratch); |
- __ jmp(&done); |
- } |
- |
__ push(lr); |
{ |
AllowExternalCallThatCantCauseGC scope(masm); |
__ PrepareCallCFunction(0, 2, scratch); |
__ MovToFloatParameters(double_base, double_exponent); |
__ CallCFunction( |
- ExternalReference::power_double_double_function(isolate()), |
- 0, 2); |
+ ExternalReference::power_double_double_function(isolate()), 0, 2); |
} |
__ pop(lr); |
__ MovFromFloatResult(double_result); |
@@ -858,38 +780,20 @@ void MathPowStub::Generate(MacroAssembler* masm) { |
__ vcvt_f64_s32(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); |
- __ vstr(double_result, |
- FieldMemOperand(heapnumber, HeapNumber::kValueOffset)); |
- DCHECK(heapnumber.is(r0)); |
- __ Ret(2); |
- } else { |
- __ push(lr); |
- { |
- AllowExternalCallThatCantCauseGC scope(masm); |
- __ PrepareCallCFunction(0, 2, scratch); |
- __ MovToFloatParameters(double_base, double_exponent); |
- __ CallCFunction( |
- ExternalReference::power_double_double_function(isolate()), |
- 0, 2); |
- } |
- __ pop(lr); |
- __ MovFromFloatResult(double_result); |
- |
- __ bind(&done); |
- __ Ret(); |
+ __ push(lr); |
+ { |
+ AllowExternalCallThatCantCauseGC scope(masm); |
+ __ PrepareCallCFunction(0, 2, scratch); |
+ __ MovToFloatParameters(double_base, double_exponent); |
+ __ CallCFunction(ExternalReference::power_double_double_function(isolate()), |
+ 0, 2); |
} |
-} |
+ __ pop(lr); |
+ __ MovFromFloatResult(double_result); |
+ __ bind(&done); |
+ __ Ret(); |
+} |
bool CEntryStub::NeedsImmovableCode() { |
return true; |