diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc index 4c678e6ef0..bf1c0fe3b6 100644 --- a/src/wasm/wasm-interpreter.cc +++ b/src/wasm/wasm-interpreter.cc @@ -2128,8 +2128,16 @@ class ThreadImpl { signature->GetParam(i))); } - MaybeHandle maybe_retval = Execution::Call( - isolate, target, isolate->global_proxy(), num_args, args.data()); + // The receiver is the global proxy if in sloppy mode (default), undefined + // if in strict mode. + Handle receiver = isolate->global_proxy(); + if (target->IsJSFunction() && + is_strict(JSFunction::cast(*target)->shared()->language_mode())) { + receiver = isolate->factory()->undefined_value(); + } + + MaybeHandle maybe_retval = + Execution::Call(isolate, target, receiver, num_args, args.data()); if (maybe_retval.is_null()) return TryHandleException(isolate); Handle retval = maybe_retval.ToHandleChecked();