Commit c645e18b authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[builtins] Remove unused MathPowTagged and MathPowInteger descriptors.

The MathPowInternal builtin is now only called directly from the
code-generator. Also, this patch takes the opportunity to cleanup the builtin
for arm and arm64 a little.

Change-Id: If53edcecd42b227ef74ee817bc5d7fbbcea8b0e2
Reviewed-on: https://chromium-review.googlesource.com/1076127Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#53442}
parent b9e8a2b4
......@@ -59,13 +59,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return r5; }
const Register ApiGetterDescriptor::HolderRegister() { return r0; }
const Register ApiGetterDescriptor::CallbackRegister() { return r3; }
const Register MathPowTaggedDescriptor::exponent() { return r2; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return r0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return r3; }
......
......@@ -59,12 +59,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return x5; }
const Register ApiGetterDescriptor::HolderRegister() { return x0; }
const Register ApiGetterDescriptor::CallbackRegister() { return x3; }
const Register MathPowTaggedDescriptor::exponent() { return x11; }
const Register MathPowIntegerDescriptor::exponent() { return x12; }
const Register GrowArrayElementsDescriptor::ObjectRegister() { return x0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return x3; }
......
......@@ -2834,20 +2834,20 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == r2);
const LowDwVfpRegister double_base = d0;
const LowDwVfpRegister double_exponent = d1;
const LowDwVfpRegister double_result = d2;
const LowDwVfpRegister double_scratch = d3;
const SwVfpRegister single_scratch = s6;
const Register scratch = r9;
const Register scratch2 = r4;
// Avoid using Registers r0-r3 as they may be needed when calling to C if the
// ABI is softfloat.
const Register integer_exponent = r4;
const Register scratch = r5;
Label call_runtime, done, int_exponent;
// Detect integer exponents stored as double.
__ TryDoubleToInt32Exact(scratch, double_exponent, double_scratch);
__ TryDoubleToInt32Exact(integer_exponent, double_exponent, double_scratch);
__ b(eq, &int_exponent);
__ push(lr);
......@@ -2864,16 +2864,13 @@ void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
// Calculate power with integer exponent.
__ bind(&int_exponent);
// Get two copies of exponent in the registers scratch and exponent.
// Exponent has previously been stored into scratch as untagged integer.
__ mov(exponent, scratch);
__ vmov(double_scratch, double_base); // Back up base.
__ vmov(double_result, Double(1.0), scratch2);
__ vmov(double_result, Double(1.0), scratch);
// Get absolute value of exponent.
__ cmp(scratch, Operand::Zero());
__ rsb(scratch, scratch, Operand::Zero(), LeaveCC, mi);
__ cmp(integer_exponent, Operand::Zero());
__ mov(scratch, integer_exponent);
__ rsb(scratch, integer_exponent, Operand::Zero(), LeaveCC, mi);
Label while_true;
__ bind(&while_true);
......@@ -2882,7 +2879,7 @@ void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
__ vmul(double_scratch, double_scratch, double_scratch, ne);
__ b(ne, &while_true);
__ cmp(exponent, Operand::Zero());
__ cmp(integer_exponent, Operand::Zero());
__ b(ge, &done);
__ vmov(double_scratch, Double(1.0), scratch);
__ vdiv(double_result, double_scratch, double_result);
......@@ -2892,7 +2889,7 @@ void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
__ b(ne, &done);
// double_exponent may not containe the exponent value if the input was a
// smi. We set it with exponent value before bailing out.
__ vmov(single_scratch, exponent);
__ vmov(single_scratch, integer_exponent);
__ vcvt_f64_s32(double_exponent, single_scratch);
// Returning or bailing out.
......
......@@ -3326,16 +3326,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
// Stack on entry:
// sp[0]: Exponent (as a tagged value).
// sp[1]: Base (as a tagged value).
//
// The (tagged) result will be returned in x0, as a heap number.
Register exponent_tagged = MathPowTaggedDescriptor::exponent();
DCHECK(exponent_tagged.is(x11));
Register exponent_integer = MathPowIntegerDescriptor::exponent();
DCHECK(exponent_integer.is(x12));
Register exponent_integer = x12;
Register saved_lr = x19;
VRegister result_double = d0;
VRegister base_double = d0;
......@@ -3345,7 +3336,7 @@ void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
VRegister scratch0_double = d7;
// A fast-path for integer exponents.
Label exponent_is_smi, exponent_is_integer;
Label exponent_is_integer;
// Allocate a heap number for the result, and return it.
Label done;
......@@ -3365,24 +3356,12 @@ void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
__ B(&done);
}
// Handle SMI exponents.
__ Bind(&exponent_is_smi);
// x10 base_tagged The tagged base (input).
// x11 exponent_tagged The tagged exponent (input).
// d1 base_double The base as a double.
__ SmiUntag(exponent_integer, exponent_tagged);
__ Bind(&exponent_is_integer);
// x10 base_tagged The tagged base (input).
// x11 exponent_tagged The tagged exponent (input).
// x12 exponent_integer The exponent as an integer.
// d1 base_double The base as a double.
// Find abs(exponent). For negative exponents, we can find the inverse later.
Register exponent_abs = x13;
__ Cmp(exponent_integer, 0);
__ Cneg(exponent_abs, exponent_integer, mi);
// x13 exponent_abs The value of abs(exponent_integer).
// Repeatedly multiply to calculate the power.
// result = 1.0;
......
......@@ -3019,8 +3019,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == eax);
const Register exponent = eax;
const Register scratch = ecx;
const XMMRegister double_result = xmm3;
const XMMRegister double_base = xmm2;
......
......@@ -2934,8 +2934,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == a2);
const Register exponent = a2;
const DoubleRegister double_base = f2;
const DoubleRegister double_exponent = f4;
const DoubleRegister double_result = f0;
......
......@@ -2953,8 +2953,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == a2);
const Register exponent = a2;
const DoubleRegister double_base = f2;
const DoubleRegister double_exponent = f4;
const DoubleRegister double_result = f0;
......
......@@ -2974,8 +2974,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == r5);
const Register exponent = r5;
const DoubleRegister double_base = d1;
const DoubleRegister double_exponent = d2;
const DoubleRegister double_result = d3;
......
......@@ -2970,8 +2970,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == r4);
const Register exponent = r4;
const DoubleRegister double_base = d1;
const DoubleRegister double_exponent = d2;
const DoubleRegister double_result = d3;
......
......@@ -2966,8 +2966,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent == rdx);
const Register exponent = rdx;
const Register scratch = rcx;
const XMMRegister double_result = xmm3;
const XMMRegister double_base = xmm2;
......
......@@ -58,13 +58,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return edi; }
const Register ApiGetterDescriptor::HolderRegister() { return ecx; }
const Register ApiGetterDescriptor::CallbackRegister() { return eax; }
const Register MathPowTaggedDescriptor::exponent() { return eax; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return eax; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return ebx; }
......
......@@ -267,18 +267,6 @@ void TypeConversionStackParameterDescriptor::InitializePlatformIndependent(
data->InitializePlatformIndependent(data->register_param_count(), 1, nullptr);
}
void MathPowTaggedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {exponent()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathPowIntegerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {exponent()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void LoadWithVectorDescriptor::InitializePlatformIndependent(
CallInterfaceDescriptorData* data) {
// kReceiver, kName, kSlot, kVector
......
......@@ -62,8 +62,6 @@ class PlatformInterfaceDescriptor;
V(ArgumentAdaptor) \
V(ApiCallback) \
V(ApiGetter) \
V(MathPowTagged) \
V(MathPowInteger) \
V(GrowArrayElements) \
V(NewArgumentsElements) \
V(InterpreterDispatch) \
......@@ -730,22 +728,6 @@ class ApiGetterDescriptor : public CallInterfaceDescriptor {
static const Register CallbackRegister();
};
class MathPowTaggedDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kExponent)
DECLARE_DESCRIPTOR(MathPowTaggedDescriptor, CallInterfaceDescriptor)
static const Register exponent();
};
class MathPowIntegerDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kExponent)
DECLARE_DESCRIPTOR(MathPowIntegerDescriptor, CallInterfaceDescriptor)
static const Register exponent();
};
// TODO(turbofan): We should probably rename this to GrowFastElementsDescriptor.
class GrowArrayElementsDescriptor : public CallInterfaceDescriptor {
public:
......
......@@ -57,13 +57,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return t1; }
const Register ApiGetterDescriptor::HolderRegister() { return a0; }
const Register ApiGetterDescriptor::CallbackRegister() { return a3; }
const Register MathPowTaggedDescriptor::exponent() { return a2; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }
......
......@@ -57,13 +57,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return a5; }
const Register ApiGetterDescriptor::HolderRegister() { return a0; }
const Register ApiGetterDescriptor::CallbackRegister() { return a3; }
const Register MathPowTaggedDescriptor::exponent() { return a2; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }
......
......@@ -57,13 +57,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return r8; }
const Register ApiGetterDescriptor::HolderRegister() { return r3; }
const Register ApiGetterDescriptor::CallbackRegister() { return r6; }
const Register MathPowTaggedDescriptor::exponent() { return r5; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return r3; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return r6; }
......
......@@ -57,12 +57,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return r7; }
const Register ApiGetterDescriptor::HolderRegister() { return r2; }
const Register ApiGetterDescriptor::CallbackRegister() { return r5; }
const Register MathPowTaggedDescriptor::exponent() { return r4; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return r2; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return r5; }
......
......@@ -58,13 +58,6 @@ const Register StoreTransitionDescriptor::MapRegister() { return r11; }
const Register ApiGetterDescriptor::HolderRegister() { return rcx; }
const Register ApiGetterDescriptor::CallbackRegister() { return rbx; }
const Register MathPowTaggedDescriptor::exponent() { return rdx; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register GrowArrayElementsDescriptor::ObjectRegister() { return rax; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return rbx; }
......
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