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 { ...@@ -6716,11 +6716,9 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
args.begin()); args.begin());
break; break;
} }
case WasmImportCallKind::kJSFunctionArityMismatchSkipAdaptor:
UNREACHABLE();
#else #else
// ======================================================================= // =======================================================================
// === JS Functions with arguments adapter =============================== // === JS Functions with mismatching arity ===============================
// ======================================================================= // =======================================================================
case WasmImportCallKind::kJSFunctionArityMismatch: { case WasmImportCallKind::kJSFunctionArityMismatch: {
base::SmallVector<Node*, 16> args(wasm_count + 9); base::SmallVector<Node*, 16> args(wasm_count + 9);
...@@ -6763,47 +6761,6 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -6763,47 +6761,6 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
args[pos++] = effect(); args[pos++] = effect();
args[pos++] = control(); 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()); DCHECK_EQ(pos, args.size());
call = graph()->NewNode(mcgraph()->common()->Call(call_descriptor), pos, call = graph()->NewNode(mcgraph()->common()->Call(call_descriptor), pos,
args.begin()); args.begin());
......
...@@ -58,15 +58,12 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation( ...@@ -58,15 +58,12 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
// type of the target function/callable and whether the signature matches the // type of the target function/callable and whether the signature matches the
// argument arity. // argument arity.
enum class WasmImportCallKind : uint8_t { enum class WasmImportCallKind : uint8_t {
kLinkError, // static Wasm->Wasm type error kLinkError, // static Wasm->Wasm type error
kRuntimeTypeError, // runtime Wasm->JS type error kRuntimeTypeError, // runtime Wasm->JS type error
kWasmToCapi, // fast Wasm->C-API call kWasmToCapi, // fast Wasm->C-API call
kWasmToWasm, // fast Wasm->Wasm call kWasmToWasm, // fast Wasm->Wasm call
kJSFunctionArityMatch, // fast Wasm->JS call kJSFunctionArityMatch, // fast Wasm->JS call
kJSFunctionArityMismatch, // Wasm->JS, needs adapter frame 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 // Math functions imported from JavaScript that are intrinsified
kFirstMathIntrinsic, kFirstMathIntrinsic,
kF64Acos = kFirstMathIntrinsic, kF64Acos = kFirstMathIntrinsic,
......
...@@ -1081,9 +1081,7 @@ bool InstanceBuilder::ProcessImportedFunction( ...@@ -1081,9 +1081,7 @@ bool InstanceBuilder::ProcessImportedFunction(
// The imported function is a callable. // The imported function is a callable.
int expected_arity = static_cast<int>(expected_sig->parameter_count()); int expected_arity = static_cast<int>(expected_sig->parameter_count());
if (kind == compiler::WasmImportCallKind::kJSFunctionArityMismatch || if (kind == compiler::WasmImportCallKind::kJSFunctionArityMismatch) {
kind == compiler::WasmImportCallKind::
kJSFunctionArityMismatchSkipAdaptor) {
Handle<JSFunction> function = Handle<JSFunction>::cast(js_receiver); Handle<JSFunction> function = Handle<JSFunction>::cast(js_receiver);
SharedFunctionInfo shared = function->shared(); SharedFunctionInfo shared = function->shared();
expected_arity = shared.internal_formal_parameter_count(); expected_arity = shared.internal_formal_parameter_count();
...@@ -1458,9 +1456,7 @@ void InstanceBuilder::CompileImportWrappers( ...@@ -1458,9 +1456,7 @@ void InstanceBuilder::CompileImportWrappers(
int expected_arity = static_cast<int>(sig->parameter_count()); int expected_arity = static_cast<int>(sig->parameter_count());
if (resolved.first == if (resolved.first ==
compiler::WasmImportCallKind::kJSFunctionArityMismatch || compiler::WasmImportCallKind::kJSFunctionArityMismatch) {
resolved.first ==
compiler::WasmImportCallKind::kJSFunctionArityMismatchSkipAdaptor) {
Handle<JSFunction> function = Handle<JSFunction>::cast(resolved.second); Handle<JSFunction> function = Handle<JSFunction>::cast(resolved.second);
SharedFunctionInfo shared = function->shared(); SharedFunctionInfo shared = function->shared();
expected_arity = shared.internal_formal_parameter_count(); expected_arity = shared.internal_formal_parameter_count();
......
...@@ -1508,12 +1508,9 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable( ...@@ -1508,12 +1508,9 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable(
callable = resolved.second; // Update to ultimate target. callable = resolved.second; // Update to ultimate target.
DCHECK_NE(compiler::WasmImportCallKind::kLinkError, kind); DCHECK_NE(compiler::WasmImportCallKind::kLinkError, kind);
wasm::CompilationEnv env = native_module->CreateCompilationEnv(); wasm::CompilationEnv env = native_module->CreateCompilationEnv();
// {expected_arity} should only be used if kind != kJSFunctionArityMismatch // {expected_arity} should only be used if kind != kJSFunctionArityMismatch.
// or kind != kJSFunctionArityMismatchSkipAdaptor.
int expected_arity = -1; int expected_arity = -1;
if (kind == compiler::WasmImportCallKind ::kJSFunctionArityMismatch || if (kind == compiler::WasmImportCallKind ::kJSFunctionArityMismatch) {
kind == compiler::WasmImportCallKind ::
kJSFunctionArityMismatchSkipAdaptor) {
expected_arity = Handle<JSFunction>::cast(callable) expected_arity = Handle<JSFunction>::cast(callable)
->shared() ->shared()
.internal_formal_parameter_count(); .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