Commit 5e7de6aa authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[turbofan][ppc] Simplify {CallDescriptor::HasFunctionDescriptor}.

R=neis@chromium.org,miladfar@ca.ibm.com
BUG=v8:9872

Change-Id: Ia8b0da9a6026f7933503ecd9e735d7fc3fdff364
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1869190Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64507}
parent dec3de8a
......@@ -400,7 +400,6 @@ enum TypeofMode : int { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
// Enums used by CEntry.
enum SaveFPRegsMode { kDontSaveFPRegs, kSaveFPRegs };
enum ArgvMode { kArgvOnStack, kArgvInRegister };
enum FunctionDescriptorMode { kNoFunctionDescriptor, kHasFunctionDescriptor };
// This constant is used as an undefined value when passing source positions.
constexpr int kNoSourcePosition = -1;
......
......@@ -211,7 +211,10 @@ class V8_EXPORT_PRIVATE CallDescriptor final
// indirect target address when calling.
kFixedTargetRegister = 1u << 7,
kAllowCallThroughSlot = 1u << 8,
kCallerSavedRegisters = 1u << 9
kCallerSavedRegisters = 1u << 9,
// AIX has a function descriptor which we will set to true by default
// for all CFunction calls (only used for Kind::kCallAddress).
kHasFunctionDescriptor = 1u << 10,
};
using Flags = base::Flags<Flag>;
......@@ -293,6 +296,9 @@ class V8_EXPORT_PRIVATE CallDescriptor final
bool NeedsCallerSavedRegisters() const {
return flags() & kCallerSavedRegisters;
}
bool HasFunctionDescriptor() const {
return flags() & kHasFunctionDescriptor;
}
LinkageLocation GetReturnLocation(size_t index) const {
return location_sig_->GetReturn(index);
......@@ -352,18 +358,9 @@ class V8_EXPORT_PRIVATE CallDescriptor final
SaveFPRegsMode get_save_fp_mode() const { return save_fp_mode_; }
void set_has_function_descriptor(bool has_function_descriptor) {
has_function_descriptor_ = has_function_descriptor;
}
bool HasFunctionDescriptor() const { return has_function_descriptor_; }
private:
friend class Linkage;
SaveFPRegsMode save_fp_mode_ = kSaveFPRegs;
// AIX has a function descriptor which we will set to true by default
// for all CFunction Calls.
bool has_function_descriptor_ = kHasFunctionDescriptor;
const Kind kind_;
const MachineType target_type_;
......
......@@ -702,26 +702,27 @@ void RawMachineAssembler::TailCallN(CallDescriptor* call_descriptor,
namespace {
enum FunctionDescriptorMode { kNoFunctionDescriptor, kHasFunctionDescriptor };
Node* CallCFunctionImpl(
RawMachineAssembler* rasm, Node* function, MachineType return_type,
std::initializer_list<RawMachineAssembler::CFunctionArg> args,
bool caller_saved_regs, SaveFPRegsMode mode,
bool has_function_descriptor = kHasFunctionDescriptor) {
FunctionDescriptorMode has_function_descriptor) {
static constexpr std::size_t kNumCArgs = 10;
MachineSignature::Builder builder(rasm->zone(), 1, args.size());
builder.AddReturn(return_type);
for (const auto& arg : args) builder.AddParam(arg.first);
auto call_descriptor = Linkage::GetSimplifiedCDescriptor(
rasm->zone(), builder.Build(),
caller_saved_regs ? CallDescriptor::kCallerSavedRegisters
: CallDescriptor::kNoFlags);
CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
if (caller_saved_regs) flags |= CallDescriptor::kCallerSavedRegisters;
if (has_function_descriptor) flags |= CallDescriptor::kHasFunctionDescriptor;
auto call_descriptor =
Linkage::GetSimplifiedCDescriptor(rasm->zone(), builder.Build(), flags);
if (caller_saved_regs) call_descriptor->set_save_fp_mode(mode);
call_descriptor->set_has_function_descriptor(has_function_descriptor);
base::SmallVector<Node*, kNumCArgs> nodes(args.size() + 1);
nodes[0] = function;
std::transform(
......@@ -739,7 +740,7 @@ Node* RawMachineAssembler::CallCFunction(
Node* function, MachineType return_type,
std::initializer_list<RawMachineAssembler::CFunctionArg> args) {
return CallCFunctionImpl(this, function, return_type, args, false,
kDontSaveFPRegs);
kDontSaveFPRegs, kHasFunctionDescriptor);
}
Node* RawMachineAssembler::CallCFunctionWithoutFunctionDescriptor(
......@@ -752,7 +753,8 @@ Node* RawMachineAssembler::CallCFunctionWithoutFunctionDescriptor(
Node* RawMachineAssembler::CallCFunctionWithCallerSavedRegisters(
Node* function, MachineType return_type, SaveFPRegsMode mode,
std::initializer_list<RawMachineAssembler::CFunctionArg> args) {
return CallCFunctionImpl(this, function, return_type, args, true, mode);
return CallCFunctionImpl(this, function, return_type, args, true, mode,
kHasFunctionDescriptor);
}
BasicBlock* RawMachineAssembler::Use(RawMachineLabel* label) {
......
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