| Index: test/cctest/wasm/wasm-run-utils.h
|
| diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h
|
| index f85f4ca3e2ccec4cd5bdde5371e9128d69c366e6..6866c1dc3fbd750011545e742c4a0035768f4de7 100644
|
| --- a/test/cctest/wasm/wasm-run-utils.h
|
| +++ b/test/cctest/wasm/wasm-run-utils.h
|
| @@ -222,14 +222,25 @@ class TestingModule : public ModuleEnv {
|
|
|
| Handle<JSFunction> WrapCode(uint32_t index) {
|
| // Wrap the code so it can be called as a JS function.
|
| - Handle<WasmInstanceObject> instance_obj(0, isolate_);
|
| Handle<Code> code = instance->function_code[index];
|
| Handle<Code> ret_code =
|
| compiler::CompileJSToWasmWrapper(isolate_, &module_, code, index);
|
| Handle<JSFunction> ret = WasmExportedFunction::New(
|
| - isolate_, instance_obj, MaybeHandle<String>(), static_cast<int>(index),
|
| + isolate_, instance_object(), MaybeHandle<String>(),
|
| + static_cast<int>(index),
|
| static_cast<int>(this->module->functions[index].sig->parameter_count()),
|
| ret_code);
|
| +
|
| + // Add weak reference to exported functions.
|
| + Handle<WasmCompiledModule> compiled_module(
|
| + instance_object()->compiled_module(), isolate_);
|
| + Handle<FixedArray> weak_exported_functions =
|
| + compiled_module->weak_exported_functions();
|
| + Handle<WeakCell> weak_fn = isolate_->factory()->NewWeakCell(ret);
|
| + FixedArray::SetAndGrow(weak_exported_functions,
|
| + weak_exported_functions->length(), weak_fn);
|
| + compiled_module->set_weak_exported_functions(weak_exported_functions);
|
| +
|
| return ret;
|
| }
|
|
|
| @@ -332,6 +343,10 @@ class TestingModule : public ModuleEnv {
|
| // If tests need more (correct) information, add it later.
|
| compiled_module->set_min_mem_pages(0);
|
| compiled_module->set_max_mem_pages(Smi::kMaxValue);
|
| + Handle<FixedArray> code_table = isolate_->factory()->NewFixedArray(0);
|
| + compiled_module->set_code_table(code_table);
|
| + Handle<FixedArray> weak_exported = isolate_->factory()->NewFixedArray(0);
|
| + compiled_module->set_weak_exported_functions(weak_exported);
|
| DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
|
| return WasmInstanceObject::New(isolate_, compiled_module);
|
| }
|
| @@ -539,6 +554,13 @@ class WasmFunctionCompiler : private GraphAndBuilders {
|
| &source_position_table_, start, end);
|
| Handle<Code> code = Compile();
|
| testing_module_->SetFunctionCode(function_index(), code);
|
| +
|
| + // Add to code table.
|
| + Handle<WasmCompiledModule> compiled_module(
|
| + testing_module_->instance_object()->compiled_module(), isolate());
|
| + Handle<FixedArray> code_table = compiled_module->code_table();
|
| + code_table = FixedArray::SetAndGrow(code_table, function_index(), code);
|
| + compiled_module->set_code_table(code_table);
|
| }
|
|
|
| byte AllocateLocal(ValueType type) {
|
|
|