Commit da1ea060 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Remove unused kJSFunctionArityMismatchSkipAdaptor

Since JS arguments are always reversed now
(https://crrev.com/c/2466116), the logic for skipping the arguments
adapter is dead. Hence this CL removes the dead enum value and all code
handling it.

R=victorgomes@chromium.org

Bug: v8:10201
Change-Id: Ie225d14f4ef4e698b76a69cb97fd3eef616e9222
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2485074Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70621}
parent bddbdcca
......@@ -6716,11 +6716,9 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
args.begin());
break;
}
case WasmImportCallKind::kJSFunctionArityMismatchSkipAdaptor:
UNREACHABLE();
#else
// =======================================================================
// === JS Functions with arguments adapter ===============================
// === JS Functions with mismatching arity ===============================
// =======================================================================
case WasmImportCallKind::kJSFunctionArityMismatch: {
base::SmallVector<Node*, 16> args(wasm_count + 9);
......@@ -6763,47 +6761,6 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
args[pos++] = effect();
args[pos++] = control();
DCHECK_EQ(pos, args.size());
call = graph()->NewNode(mcgraph()->common()->Call(call_descriptor), pos,
args.begin());
break;
}
// =======================================================================
// === JS Functions without arguments adapter ============================
// =======================================================================
case WasmImportCallKind::kJSFunctionArityMismatchSkipAdaptor: {
base::SmallVector<Node*, 16> args(expected_arity + 7);
int pos = 0;
Node* function_context =
gasm_->Load(MachineType::TaggedPointer(), callable_node,
wasm::ObjectAccess::ContextOffsetInTaggedJSFunction());
args[pos++] = callable_node; // target callable.
// Determine receiver at runtime.
args[pos++] =
BuildReceiverNode(callable_node, native_context, undefined_node);
auto call_descriptor = Linkage::GetJSCallDescriptor(
graph()->zone(), false, expected_arity + 1,
CallDescriptor::kNoFlags);
// Convert wasm numbers to JS values.
if (expected_arity <= wasm_count) {
pos = AddArgumentNodes(VectorOf(args), pos, expected_arity, sig_);
} else {
pos = AddArgumentNodes(VectorOf(args), pos, wasm_count, sig_);
for (int i = wasm_count; i < expected_arity; ++i) {
args[pos++] = undefined_node;
}
}
args[pos++] = undefined_node; // new target
args[pos++] =
mcgraph()->Int32Constant(expected_arity); // argument count
args[pos++] = function_context;
args[pos++] = effect();
args[pos++] = control();
DCHECK_EQ(pos, args.size());
call = graph()->NewNode(mcgraph()->common()->Call(call_descriptor), pos,
args.begin());
......
......@@ -64,9 +64,6 @@ enum class WasmImportCallKind : uint8_t {
kWasmToWasm, // fast Wasm->Wasm call
kJSFunctionArityMatch, // fast Wasm->JS call
kJSFunctionArityMismatch, // Wasm->JS, needs adapter frame
kJSFunctionArityMismatchSkipAdaptor, // Wasm->JS, arity mismatch calling
// strict mode function where we don't
// need the ArgumentsAdaptorTrampoline.
// Math functions imported from JavaScript that are intrinsified
kFirstMathIntrinsic,
kF64Acos = kFirstMathIntrinsic,
......
......@@ -1081,9 +1081,7 @@ bool InstanceBuilder::ProcessImportedFunction(
// The imported function is a callable.
int expected_arity = static_cast<int>(expected_sig->parameter_count());
if (kind == compiler::WasmImportCallKind::kJSFunctionArityMismatch ||
kind == compiler::WasmImportCallKind::
kJSFunctionArityMismatchSkipAdaptor) {
if (kind == compiler::WasmImportCallKind::kJSFunctionArityMismatch) {
Handle<JSFunction> function = Handle<JSFunction>::cast(js_receiver);
SharedFunctionInfo shared = function->shared();
expected_arity = shared.internal_formal_parameter_count();
......@@ -1458,9 +1456,7 @@ void InstanceBuilder::CompileImportWrappers(
int expected_arity = static_cast<int>(sig->parameter_count());
if (resolved.first ==
compiler::WasmImportCallKind::kJSFunctionArityMismatch ||
resolved.first ==
compiler::WasmImportCallKind::kJSFunctionArityMismatchSkipAdaptor) {
compiler::WasmImportCallKind::kJSFunctionArityMismatch) {
Handle<JSFunction> function = Handle<JSFunction>::cast(resolved.second);
SharedFunctionInfo shared = function->shared();
expected_arity = shared.internal_formal_parameter_count();
......
......@@ -1508,12 +1508,9 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable(
callable = resolved.second; // Update to ultimate target.
DCHECK_NE(compiler::WasmImportCallKind::kLinkError, kind);
wasm::CompilationEnv env = native_module->CreateCompilationEnv();
// {expected_arity} should only be used if kind != kJSFunctionArityMismatch
// or kind != kJSFunctionArityMismatchSkipAdaptor.
// {expected_arity} should only be used if kind != kJSFunctionArityMismatch.
int expected_arity = -1;
if (kind == compiler::WasmImportCallKind ::kJSFunctionArityMismatch ||
kind == compiler::WasmImportCallKind ::
kJSFunctionArityMismatchSkipAdaptor) {
if (kind == compiler::WasmImportCallKind ::kJSFunctionArityMismatch) {
expected_arity = Handle<JSFunction>::cast(callable)
->shared()
.internal_formal_parameter_count();
......
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