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 ce7ccb7dc0337d656aefa34aa1d312fa1b61188c..1d0fd7110d6eff801a6e3549d3850f8ad998ef4f 100644 |
--- a/test/cctest/wasm/wasm-run-utils.h |
+++ b/test/cctest/wasm/wasm-run-utils.h |
@@ -487,13 +487,29 @@ class WasmFunctionCompiler : public HandleAndZoneScope, |
Code::ComputeFlags(Code::WASM_FUNCTION)); |
v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( |
&info, graph(), desc, &source_position_table_)); |
- Handle<Code> code = Handle<Code>::null(); |
- if (job->OptimizeGraph() == CompilationJob::SUCCEEDED && |
- job->GenerateCode() == CompilationJob::SUCCEEDED) { |
- code = info.code(); |
+ if (job->OptimizeGraph() != CompilationJob::SUCCEEDED || |
+ job->GenerateCode() != CompilationJob::SUCCEEDED) |
+ return Handle<Code>::null(); |
+ |
+ Handle<Code> code = info.code(); |
+ |
+ // Length is always 2, since usually <wasm_obj, func_index> is stored in the |
+ // deopt data. Here, we store <func_name, undef> instead. |
+ DCHECK(code->deoptimization_data() == nullptr || |
+ code->deoptimization_data()->length() == 0); |
+ Handle<FixedArray> deopt_data = |
+ isolate()->factory()->NewFixedArray(2, TENURED); |
+ if (debug_name_.start() != nullptr) { |
+ MaybeHandle<String> maybe_name = |
+ isolate()->factory()->NewStringFromUtf8(debug_name_, TENURED); |
+ if (!maybe_name.is_null()) |
+ deopt_data->set(0, *maybe_name.ToHandleChecked()); |
} |
+ deopt_data->set_length(2); |
+ code->set_deoptimization_data(*deopt_data); |
+ |
#ifdef ENABLE_DISASSEMBLER |
- if (!code.is_null() && FLAG_print_opt_code) { |
+ if (FLAG_print_opt_code) { |
OFStream os(stdout); |
code->Disassemble("wasm code", os); |
} |