Chromium Code Reviews| 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..930f121f2c467c3c0fadbb5cce6459ce47e9e078 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") |
|
JF
2016/04/12 19:38:54
It's probably clearer to give it a name with unusu
Clemens Hammacher
2016/04/13 07:45:18
Done.
|
| : 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_]; |
| } |
| + |
| + void SetModuleContext() { |
| + // Set the context, such that e.g. runtime functions can be called |
| + 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 |