[turbofan] Make {CallDescriptor} fully immutable.
This changes the way {SaveFPRegsMode} is stored in a {CallDescriptor}. The value is now encoded in the flags field, similar to all other boolean properties. It removes the last mutable field from the call descriptor, making the struct fully immutable. R=neis@chromium.org Change-Id: I6bca118c7ce0c5bc77e7aa2fcc6541439bd27b3b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1868616 Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#64512}
This commit is contained in:
parent
f30a92e6f2
commit
00937422fb
@ -2780,8 +2780,10 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
|
||||
auto call_descriptor = CallDescriptorOf(node->op());
|
||||
|
||||
if (call_descriptor->NeedsCallerSavedRegisters()) {
|
||||
Emit(kArchSaveCallerRegisters | MiscField::encode(static_cast<int>(
|
||||
call_descriptor->get_save_fp_mode())),
|
||||
SaveFPRegsMode mode = call_descriptor->NeedsCallerSavedFPRegisters()
|
||||
? kSaveFPRegs
|
||||
: kDontSaveFPRegs;
|
||||
Emit(kArchSaveCallerRegisters | MiscField::encode(static_cast<int>(mode)),
|
||||
g.NoOutput());
|
||||
}
|
||||
|
||||
@ -2862,10 +2864,12 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
|
||||
EmitPrepareResults(&(buffer.output_nodes), call_descriptor, node);
|
||||
|
||||
if (call_descriptor->NeedsCallerSavedRegisters()) {
|
||||
Emit(kArchRestoreCallerRegisters |
|
||||
MiscField::encode(
|
||||
static_cast<int>(call_descriptor->get_save_fp_mode())),
|
||||
g.NoOutput());
|
||||
SaveFPRegsMode mode = call_descriptor->NeedsCallerSavedFPRegisters()
|
||||
? kSaveFPRegs
|
||||
: kDontSaveFPRegs;
|
||||
Emit(
|
||||
kArchRestoreCallerRegisters | MiscField::encode(static_cast<int>(mode)),
|
||||
g.NoOutput());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,12 @@ class V8_EXPORT_PRIVATE CallDescriptor final
|
||||
kFixedTargetRegister = 1u << 7,
|
||||
kAllowCallThroughSlot = 1u << 8,
|
||||
kCallerSavedRegisters = 1u << 9,
|
||||
// The kCallerSavedFPRegisters only matters (and set) when the more general
|
||||
// flag for kCallerSavedRegisters above is also set.
|
||||
kCallerSavedFPRegisters = 1u << 10,
|
||||
// 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,
|
||||
kHasFunctionDescriptor = 1u << 11,
|
||||
};
|
||||
using Flags = base::Flags<Flag>;
|
||||
|
||||
@ -296,6 +299,9 @@ class V8_EXPORT_PRIVATE CallDescriptor final
|
||||
bool NeedsCallerSavedRegisters() const {
|
||||
return flags() & kCallerSavedRegisters;
|
||||
}
|
||||
bool NeedsCallerSavedFPRegisters() const {
|
||||
return flags() & kCallerSavedFPRegisters;
|
||||
}
|
||||
bool HasFunctionDescriptor() const {
|
||||
return flags() & kHasFunctionDescriptor;
|
||||
}
|
||||
@ -354,13 +360,8 @@ class V8_EXPORT_PRIVATE CallDescriptor final
|
||||
return allocatable_registers_ != 0;
|
||||
}
|
||||
|
||||
void set_save_fp_mode(SaveFPRegsMode mode) { save_fp_mode_ = mode; }
|
||||
|
||||
SaveFPRegsMode get_save_fp_mode() const { return save_fp_mode_; }
|
||||
|
||||
private:
|
||||
friend class Linkage;
|
||||
SaveFPRegsMode save_fp_mode_ = kSaveFPRegs;
|
||||
|
||||
const Kind kind_;
|
||||
const MachineType target_type_;
|
||||
|
@ -715,14 +715,14 @@ Node* CallCFunctionImpl(
|
||||
builder.AddReturn(return_type);
|
||||
for (const auto& arg : args) builder.AddParam(arg.first);
|
||||
|
||||
bool caller_saved_fp_regs = caller_saved_regs && (mode == kSaveFPRegs);
|
||||
CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
|
||||
if (caller_saved_regs) flags |= CallDescriptor::kCallerSavedRegisters;
|
||||
if (caller_saved_fp_regs) flags |= CallDescriptor::kCallerSavedFPRegisters;
|
||||
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);
|
||||
|
||||
base::SmallVector<Node*, kNumCArgs> nodes(args.size() + 1);
|
||||
nodes[0] = function;
|
||||
std::transform(
|
||||
|
Loading…
Reference in New Issue
Block a user