Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index 8c11d9628bfc5a6aa75b0ae4a2be0df62c823b95..4fa1cdd2235b3b0805caf536b32640952358884b 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -2977,7 +2977,24 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower* thrower, Isolate* isolate, |
} |
buffer.Dispose(); |
+ |
if (!code.is_null()) { |
+ DCHECK(code->deoptimization_data() == nullptr || |
+ code->deoptimization_data()->length() == 0); |
+ Handle<FixedArray> deopt_data = |
+ isolate->factory()->NewFixedArray(2, TENURED); |
+ if (!module_env->instance->js_object.is_null()) { |
+ deopt_data->set(0, *module_env->instance->js_object); |
+ deopt_data->set(1, Smi::FromInt(function->func_index)); |
+ } else if (func_name.start() != nullptr) { |
+ MaybeHandle<String> maybe_name = |
+ isolate->factory()->NewStringFromUtf8(func_name); |
+ if (!maybe_name.is_null()) |
+ deopt_data->set(0, *maybe_name.ToHandleChecked()); |
+ } |
+ deopt_data->set_length(2); |
+ code->set_deoptimization_data(*deopt_data); |
+ |
RecordFunctionCompilation( |
Logger::FUNCTION_TAG, &info, "WASM_function", function->func_index, |
module_env->module->GetName(function->name_offset, |