Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: src/isolate.cc

Issue 917743002: [V8] Use Function.name for stack frames in v8::StackTrace (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 37020da1559b70828dfceedf5eb75cb32391817b..a0c5dcbbf14bcae1ee5cc3198e096049b3c5e7a2 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -491,6 +491,8 @@ class CaptureStackTraceHelper {
STATIC_CHAR_VECTOR("scriptNameOrSourceURL"));
}
if (options & StackTrace::kFunctionName) {
+ display_name_ = factory()->InternalizeOneByteString(
+ STATIC_CHAR_VECTOR("displayName"));
function_key_ = factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("functionName"));
}
@@ -554,8 +556,14 @@ class CaptureStackTraceHelper {
}
if (!function_key_.is_null()) {
- Handle<Object> fun_name(fun->shared()->DebugName(), isolate_);
- JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE);
+ Handle<Object> display_name =
+ JSObject::GetDataProperty(fun, display_name_);
+ if (display_name->IsString()) {
+ JSObject::AddProperty(stack_frame, function_key_, display_name, NONE);
Yang 2015/02/12 14:25:36 Why are we storing this in a separate property, an
kozy 2015/02/12 14:46:13 In output stack frame we store display name or fun
+ } else {
+ Handle<Object> fun_name(fun->shared()->DebugName(), isolate_);
+ JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE);
+ }
}
if (!eval_key_.is_null()) {
@@ -585,6 +593,7 @@ class CaptureStackTraceHelper {
Handle<String> function_key_;
Handle<String> eval_key_;
Handle<String> constructor_key_;
+ Handle<String> display_name_;
};
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698