diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc index 404fea5431..d3470d80f7 100644 --- a/src/wasm/wasm-module.cc +++ b/src/wasm/wasm-module.cc @@ -1220,7 +1220,7 @@ MaybeHandle WasmModule::Instantiate(Isolate* isolate, // There is already an owner, clone everything. owner = Handle(JSObject::cast(tmp->value()), isolate); // Insert the latest clone in front. - compiled_module = original->Clone(isolate); + compiled_module = WasmCompiledModule::Clone(isolate, original); // Replace the strong reference to point to the new instance here. // This allows any of the other instances, including the original, // to be collected. diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h index 80cd98fa82..8cf5501efb 100644 --- a/src/wasm/wasm-module.h +++ b/src/wasm/wasm-module.h @@ -442,13 +442,14 @@ class WasmCompiledModule : public FixedArray { return handle(WasmCompiledModule::cast(*ret)); } - Handle Clone(Isolate* isolate) { - Handle ret = handle(WasmCompiledModule::cast( - *isolate->factory()->CopyFixedArray(handle(this)))); + static Handle Clone(Isolate* isolate, + Handle module) { + Handle ret = Handle::cast( + isolate->factory()->CopyFixedArray(module)); Handle number = isolate->factory()->NewHeapNumber(0.0, MUTABLE, TENURED); ret->set(kID_mem_size, *number); - ret->set_mem_size(mem_size()); + ret->set_mem_size(module->mem_size()); return ret; }