Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index b0139a70a68e4fc4f32bdf94c4833cc233087986..7e87b28b7f5921ccce62ecc2f63dc153ee8cdffa 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -701,9 +701,17 @@ class CaptureStackTraceHelper { |
factory()->NewJSObject(isolate_->object_function()); |
if (!function_key_.is_null()) { |
- Handle<String> name = wasm::GetWasmFunctionName( |
- isolate_, handle(frame->wasm_instance(), isolate_), |
- frame->function_index()); |
+ // TODO(wasm): We should always have a wasm instance available (bug 5620). |
+ Handle<Object> instance(frame->wasm_instance(), isolate_); |
+ Handle<Object> compiled_module; |
+ if (instance->IsUndefined(isolate_)) { |
+ compiled_module = instance; // undefined |
+ } else { |
+ compiled_module = handle( |
+ wasm::GetCompiledModule(JSObject::cast(*instance)), isolate_); |
+ } |
+ Handle<String> name = wasm::GetWasmFunctionName(isolate_, compiled_module, |
+ frame->function_index()); |
JSObject::AddProperty(stack_frame, function_key_, name, NONE); |
} |
// Encode the function index as line number. |