| Index: src/wasm/wasm-module.cc
|
| diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
|
| index 9ec439d4b5192229dea9573907e2236830cc3135..55bb7d973cf297f3a23da000fb6c135a5462174a 100644
|
| --- a/src/wasm/wasm-module.cc
|
| +++ b/src/wasm/wasm-module.cc
|
| @@ -553,9 +553,9 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
|
|
|
| WasmName str = GetName(func.name_offset, func.name_length);
|
| WasmName str_null = {nullptr, 0};
|
| - Handle<String> name = factory->InternalizeUtf8String(str);
|
| Handle<Code> code = Handle<Code>::null();
|
| Handle<JSFunction> function = Handle<JSFunction>::null();
|
| + Handle<String> functionName;
|
| if (func.external) {
|
| // Lookup external function in FFI object.
|
| MaybeHandle<JSFunction> function =
|
| @@ -578,8 +578,9 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
|
| return MaybeHandle<JSObject>();
|
| }
|
| if (func.exported) {
|
| + functionName = factory->InternalizeUtf8String(str);
|
| function = compiler::CompileJSToWasmWrapper(
|
| - isolate, &module_env, name, code, instance.js_object, i);
|
| + isolate, &module_env, functionName, code, instance.js_object, i);
|
| record_code_size(function->code());
|
| }
|
| }
|
| @@ -589,12 +590,13 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
|
| code_table->set(i, *code);
|
| record_code_size(*code);
|
| }
|
| - if (func.exported) {
|
| + if (!function.is_null()) {
|
| // Exported functions are installed as read-only properties on the
|
| // module.
|
| desc.set_value(function);
|
| Maybe<bool> status = JSReceiver::DefineOwnProperty(
|
| - isolate, instance.js_object, name, &desc, Object::THROW_ON_ERROR);
|
| + isolate, instance.js_object, functionName, &desc,
|
| + Object::THROW_ON_ERROR);
|
| if (!status.IsJust())
|
| thrower.Error("export of %.*s failed.", str.length(), str.start());
|
| }
|
|
|