Commit 3cb521fe authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

Revert "[wasm-gc][cleanup] Remove wasm signature from CallDescriptor"

This reverts commit 538f2bc9.

Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20no-concurrent-marking/9377/overview

Original change's description:
> [wasm-gc][cleanup] Remove wasm signature from CallDescriptor
>
> This field is no longer used, as the functionality it supported has been
> subsumed by wasm-gc typed-based optimizations.
>
> Bug: v8:7748
> Change-Id: I970514bb29e5f91bb5610cafde60ec3dbcfb07aa
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3705376
> Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Maya Lekova <mslekova@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#81244}

Bug: v8:7748
Change-Id: I110f6b7943ecbaaa6b2a73c3631ea194981cdf20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3714230
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Owners-Override: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81245}
parent 538f2bc9
......@@ -538,6 +538,9 @@ CallDescriptor* Linkage::GetStubCallDescriptor(
CallDescriptor::kCanUseRoots | flags, // flags
descriptor.DebugName(), // debug name
descriptor.GetStackArgumentOrder(), // stack order
#if V8_ENABLE_WEBASSEMBLY
nullptr, // wasm function signature
#endif
allocatable_registers);
}
......
......@@ -265,6 +265,9 @@ class V8_EXPORT_PRIVATE CallDescriptor final
DoubleRegList callee_saved_fp_registers, Flags flags,
const char* debug_name = "",
StackArgumentOrder stack_order = StackArgumentOrder::kDefault,
#if V8_ENABLE_WEBASSEMBLY
const wasm::FunctionSig* wasm_sig = nullptr,
#endif
const RegList allocatable_registers = {},
size_t return_slot_count = 0)
: kind_(kind),
......@@ -279,7 +282,11 @@ class V8_EXPORT_PRIVATE CallDescriptor final
allocatable_registers_(allocatable_registers),
flags_(flags),
stack_order_(stack_order),
debug_name_(debug_name) {}
#if V8_ENABLE_WEBASSEMBLY
wasm_sig_(wasm_sig),
#endif
debug_name_(debug_name) {
}
CallDescriptor(const CallDescriptor&) = delete;
CallDescriptor& operator=(const CallDescriptor&) = delete;
......@@ -302,6 +309,9 @@ class V8_EXPORT_PRIVATE CallDescriptor final
// Returns {true} if this descriptor is a call to a Wasm C API function.
bool IsWasmCapiFunction() const { return kind_ == kCallWasmCapiFunction; }
// Returns the wasm signature for this call based on the real parameter types.
const wasm::FunctionSig* wasm_sig() const { return wasm_sig_; }
#endif // V8_ENABLE_WEBASSEMBLY
bool RequiresFrameAsIncoming() const {
......@@ -468,6 +478,9 @@ class V8_EXPORT_PRIVATE CallDescriptor final
const RegList allocatable_registers_;
const Flags flags_;
const StackArgumentOrder stack_order_;
#if V8_ENABLE_WEBASSEMBLY
const wasm::FunctionSig* wasm_sig_;
#endif
const char* const debug_name_;
mutable base::Optional<size_t> gp_param_count_;
......
This diff is collapsed.
......@@ -343,22 +343,25 @@ class WasmGraphBuilder {
// In all six call-related public functions, we pass a signature based on the
// real arguments for this call. This signature gets stored in the Call node
// and will later help us generate better code if this call gets inlined.
Node* CallDirect(uint32_t index, base::Vector<Node*> args,
base::Vector<Node*> rets, wasm::WasmCodePosition position);
Node* CallDirect(uint32_t index, wasm::FunctionSig* real_sig,
base::Vector<Node*> args, base::Vector<Node*> rets,
wasm::WasmCodePosition position);
Node* CallIndirect(uint32_t table_index, uint32_t sig_index,
base::Vector<Node*> args, base::Vector<Node*> rets,
wasm::WasmCodePosition position);
Node* CallRef(const wasm::FunctionSig* sig, base::Vector<Node*> args,
wasm::FunctionSig* real_sig, base::Vector<Node*> args,
base::Vector<Node*> rets, wasm::WasmCodePosition position);
Node* CallRef(const wasm::FunctionSig* real_sig, base::Vector<Node*> args,
base::Vector<Node*> rets, CheckForNull null_check,
wasm::WasmCodePosition position);
Node* ReturnCall(uint32_t index, base::Vector<Node*> args,
wasm::WasmCodePosition position);
Node* ReturnCall(uint32_t index, const wasm::FunctionSig* real_sig,
base::Vector<Node*> args, wasm::WasmCodePosition position);
Node* ReturnCallIndirect(uint32_t table_index, uint32_t sig_index,
wasm::FunctionSig* real_sig,
base::Vector<Node*> args,
wasm::WasmCodePosition position);
Node* ReturnCallRef(const wasm::FunctionSig* sig, base::Vector<Node*> args,
CheckForNull null_check, wasm::WasmCodePosition position);
Node* ReturnCallRef(const wasm::FunctionSig* real_sig,
base::Vector<Node*> args, CheckForNull null_check,
wasm::WasmCodePosition position);
void CompareToInternalFunctionAtIndex(Node* func_ref, uint32_t function_index,
Node** success_control,
......@@ -586,6 +589,9 @@ class WasmGraphBuilder {
void RemoveBytecodePositionDecorator();
static const wasm::FunctionSig* Int64LoweredSig(Zone* zone,
const wasm::FunctionSig* sig);
void StoreCallCount(Node* call, int count);
void ReserveCallCounts(size_t num_call_instructions);
......@@ -641,7 +647,8 @@ class WasmGraphBuilder {
Node** ift_sig_ids, Node** ift_targets,
Node** ift_instances);
Node* BuildIndirectCall(uint32_t table_index, uint32_t sig_index,
base::Vector<Node*> args, base::Vector<Node*> rets,
wasm::FunctionSig* real_sig, base::Vector<Node*> args,
base::Vector<Node*> rets,
wasm::WasmCodePosition position,
IsReturnCall continuation);
Node* BuildWasmCall(const wasm::FunctionSig* sig, base::Vector<Node*> args,
......@@ -659,9 +666,9 @@ class WasmGraphBuilder {
base::Vector<Node*> rets,
wasm::WasmCodePosition position, Node* func_index,
IsReturnCall continuation);
Node* BuildCallRef(const wasm::FunctionSig* sig, base::Vector<Node*> args,
base::Vector<Node*> rets, CheckForNull null_check,
IsReturnCall continuation,
Node* BuildCallRef(const wasm::FunctionSig* real_sig,
base::Vector<Node*> args, base::Vector<Node*> rets,
CheckForNull null_check, IsReturnCall continuation,
wasm::WasmCodePosition position);
Node* BuildF32CopySign(Node* left, Node* right);
......
......@@ -1903,6 +1903,18 @@ class WasmGraphBuildingInterface {
const Value args[], Value returns[]) {
size_t param_count = sig->parameter_count();
size_t return_count = sig->return_count();
// Construct a function signature based on the real function parameters.
FunctionSig::Builder real_sig_builder(builder_->graph_zone(), return_count,
param_count);
for (size_t i = 0; i < param_count; i++) {
real_sig_builder.AddParam(args[i].type);
}
for (size_t i = 0; i < return_count; i++) {
real_sig_builder.AddReturn(sig->GetReturn(i));
}
FunctionSig* real_sig = real_sig_builder.Build();
NodeVector arg_nodes(param_count + 1);
base::SmallVector<TFNode*, 1> return_nodes(return_count);
arg_nodes[0] = (call_info.call_mode() == CallInfo::kCallDirect)
......@@ -1917,12 +1929,12 @@ class WasmGraphBuildingInterface {
CheckForException(
decoder, builder_->CallIndirect(
call_info.table_index(), call_info.sig_index(),
base::VectorOf(arg_nodes),
real_sig, base::VectorOf(arg_nodes),
base::VectorOf(return_nodes), decoder->position()));
break;
case CallInfo::kCallDirect: {
TFNode* call = builder_->CallDirect(
call_info.callee_index(), base::VectorOf(arg_nodes),
call_info.callee_index(), real_sig, base::VectorOf(arg_nodes),
base::VectorOf(return_nodes), decoder->position());
builder_->StoreCallCount(call, call_info.call_count());
CheckForException(decoder, call);
......@@ -1931,7 +1943,7 @@ class WasmGraphBuildingInterface {
case CallInfo::kCallRef:
CheckForException(
decoder,
builder_->CallRef(sig, base::VectorOf(arg_nodes),
builder_->CallRef(real_sig, base::VectorOf(arg_nodes),
base::VectorOf(return_nodes),
call_info.null_check(), decoder->position()));
break;
......@@ -1950,6 +1962,17 @@ class WasmGraphBuildingInterface {
const FunctionSig* sig, const Value args[]) {
size_t arg_count = sig->parameter_count();
// Construct a function signature based on the real function parameters.
FunctionSig::Builder real_sig_builder(builder_->graph_zone(),
sig->return_count(), arg_count);
for (size_t i = 0; i < arg_count; i++) {
real_sig_builder.AddParam(args[i].type);
}
for (size_t i = 0; i < sig->return_count(); i++) {
real_sig_builder.AddReturn(sig->GetReturn(i));
}
FunctionSig* real_sig = real_sig_builder.Build();
ValueVector arg_values(arg_count + 1);
if (call_info.call_mode() == CallInfo::kCallDirect) {
arg_values[0].node = nullptr;
......@@ -1973,18 +1996,18 @@ class WasmGraphBuildingInterface {
switch (call_info.call_mode()) {
case CallInfo::kCallIndirect:
builder_->ReturnCallIndirect(
call_info.table_index(), call_info.sig_index(),
call_info.table_index(), call_info.sig_index(), real_sig,
base::VectorOf(arg_nodes), decoder->position());
break;
case CallInfo::kCallDirect: {
TFNode* call = builder_->ReturnCall(call_info.callee_index(),
TFNode* call = builder_->ReturnCall(call_info.callee_index(), real_sig,
base::VectorOf(arg_nodes),
decoder->position());
builder_->StoreCallCount(call, call_info.call_count());
break;
}
case CallInfo::kCallRef:
builder_->ReturnCallRef(sig, base::VectorOf(arg_nodes),
builder_->ReturnCallRef(real_sig, base::VectorOf(arg_nodes),
call_info.null_check(), decoder->position());
break;
}
......
......@@ -42,12 +42,15 @@ class LinkageTailCall : public TestWithZone {
LinkageLocation::ForAnyRegister(MachineType::Pointer()),
locations, // location_sig
stack_arguments,
Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved
kNoCalleeSavedFp, // callee-saved fp
CallDescriptor::kNoFlags, // flags,
"", StackArgumentOrder::kDefault, // --
RegList{}, // allocatable_registers
Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved
kNoCalleeSavedFp, // callee-saved fp
CallDescriptor::kNoFlags, // flags,
"", StackArgumentOrder::kDefault,
#if V8_ENABLE_WEBASSEMBLY
nullptr, // wasm function sig
#endif
RegList{}, // allocatable_registers
stack_returns);
}
......
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