Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 7cd8b002c4b096e15c83a085eba72eaaf4b8739c..9c2d9e5a77c18d3c0c9939e2ee5746c9c39fb78b 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -489,6 +489,8 @@ class CaptureStackTraceHelper { |
if (options & StackTrace::kFunctionName) { |
function_key_ = factory()->InternalizeOneByteString( |
STATIC_CHAR_VECTOR("functionName")); |
+ name_key_ = |
+ factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("name")); |
} |
if (options & StackTrace::kIsEval) { |
eval_key_ = |
@@ -550,7 +552,9 @@ class CaptureStackTraceHelper { |
} |
if (!function_key_.is_null()) { |
- Handle<Object> fun_name(fun->shared()->DebugName(), isolate_); |
+ Handle<Object> fun_name = JSObject::GetDataProperty(fun, name_key_); |
+ if (!fun_name->IsString()) |
+ fun_name = Handle<Object>(fun->shared()->DebugName(), isolate_); |
JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); |
} |
@@ -581,6 +585,7 @@ class CaptureStackTraceHelper { |
Handle<String> function_key_; |
Handle<String> eval_key_; |
Handle<String> constructor_key_; |
+ Handle<String> name_key_; |
}; |