| 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 adca30e545c3107ac9119d69390db880afd49b3c..ea3e8ba2d4f381a9e96a3c6d13b1650eac65e904 100644
|
| --- a/test/cctest/wasm/wasm-run-utils.h
|
| +++ b/test/cctest/wasm/wasm-run-utils.h
|
| @@ -410,13 +410,15 @@ class WasmFunctionWrapper : public HandleAndZoneScope,
|
| class WasmFunctionCompiler : public HandleAndZoneScope,
|
| private GraphAndBuilders {
|
| public:
|
| - explicit WasmFunctionCompiler(FunctionSig* sig, TestingModule* module)
|
| + explicit WasmFunctionCompiler(FunctionSig* sig, TestingModule* module,
|
| + const char* debug_name = "<WASM UNNAMED>")
|
| : GraphAndBuilders(main_zone()),
|
| jsgraph(this->isolate(), this->graph(), this->common(), nullptr,
|
| nullptr, this->machine()),
|
| sig(sig),
|
| descriptor_(nullptr),
|
| - testing_module_(module) {
|
| + testing_module_(module),
|
| + debug_name_(debug_name) {
|
| if (module) {
|
| // Get a new function from the testing module.
|
| function_ = nullptr;
|
| @@ -438,6 +440,7 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
|
| // The call descriptor is initialized when the function is compiled.
|
| CallDescriptor* descriptor_;
|
| TestingModule* testing_module_;
|
| + const char* debug_name_;
|
| WasmFunction* function_;
|
| int function_index_;
|
| LocalDeclEncoder local_decls;
|
| @@ -474,7 +477,7 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
|
| if (kPointerSize == 4) {
|
| desc = testing_module_->GetI32WasmCallDescriptor(this->zone(), desc);
|
| }
|
| - CompilationInfo info("wasm compile", this->isolate(), this->zone(),
|
| + CompilationInfo info(debug_name_, this->isolate(), this->zone(),
|
| Code::ComputeFlags(Code::WASM_FUNCTION));
|
| Handle<Code> result =
|
| Pipeline::GenerateCodeForTesting(&info, desc, this->graph());
|
| @@ -500,6 +503,16 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
|
| if (function_) return function_;
|
| return &testing_module_->module->functions[function_index_];
|
| }
|
| +
|
| + // Set the context, such that e.g. runtime functions can be called.
|
| + void SetModuleContext() {
|
| + if (!testing_module_->instance->context.is_null()) {
|
| + CHECK(testing_module_->instance->context.is_identical_to(
|
| + main_isolate()->native_context()));
|
| + return;
|
| + }
|
| + testing_module_->instance->context = main_isolate()->native_context();
|
| + }
|
| };
|
|
|
| // A helper class to build graphs from Wasm bytecode, generate machine
|
|
|