| Index: src/wasm/wasm-js.cc | 
| diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc | 
| index 732751610587bfb64d23563d36f5371e2d746a69..b6883c0013b308739ab05a7488e7fb8a23efde4c 100644 | 
| --- a/src/wasm/wasm-js.cc | 
| +++ b/src/wasm/wasm-js.cc | 
| @@ -192,7 +192,7 @@ void WebAssemblyModule(const v8::FunctionCallbackInfo<v8::Value>& args) { | 
| } | 
|  | 
| MaybeLocal<Value> InstantiateModuleImpl( | 
| -    i::Isolate* i_isolate, i::Handle<i::JSObject> i_module_obj, | 
| +    i::Isolate* i_isolate, i::Handle<i::WasmModuleObject> i_module_obj, | 
| const v8::FunctionCallbackInfo<v8::Value>& args, ErrorThrower* thrower) { | 
| // It so happens that in both the WebAssembly.instantiate, as well as | 
| // WebAssembly.Instance ctor, the positions of the ffi object and memory | 
| @@ -211,6 +211,12 @@ MaybeLocal<Value> InstantiateModuleImpl( | 
| Local<Object> obj = Local<Object>::Cast(args[kFfiOffset]); | 
| ffi = i::Handle<i::JSReceiver>::cast(v8::Utils::OpenHandle(*obj)); | 
| } | 
| +  if (i_module_obj->compiled_module()->module()->num_imported_functions > 0 && | 
| +      ffi.is_null()) { | 
| +    thrower->TypeError("Argument %d must be present and must be an object", | 
| +                       kFfiOffset); | 
| +    return nothing; | 
| +  } | 
|  | 
| i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); | 
| if (args.Length() > kMemOffset && !args[kMemOffset]->IsUndefined()) { | 
| @@ -321,8 +327,8 @@ void WebAssemblyInstance(const v8::FunctionCallbackInfo<v8::Value>& args) { | 
| } | 
|  | 
| Local<Object> module_obj = Local<Object>::Cast(args[0]); | 
| -  i::Handle<i::JSObject> i_module_obj = | 
| -      i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*module_obj)); | 
| +  i::Handle<i::WasmModuleObject> i_module_obj = | 
| +      i::Handle<i::WasmModuleObject>::cast(v8::Utils::OpenHandle(*module_obj)); | 
|  | 
| MaybeLocal<Value> instance = | 
| InstantiateModuleImpl(i_isolate, i_module_obj, args, &thrower); | 
| @@ -343,7 +349,7 @@ void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) { | 
| thrower.TypeError("Argument 0 must be a buffer source"); | 
| return; | 
| } | 
| -  i::MaybeHandle<i::JSObject> module_obj = | 
| +  i::MaybeHandle<i::WasmModuleObject> module_obj = | 
| CreateModuleObject(isolate, args[0], &thrower); | 
|  | 
| Local<Context> context = isolate->GetCurrentContext(); | 
|  |