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

Unified Diff: src/accessors.cc

Issue 1377603006: [es6] Function constructor-created functions should be named "anonymous" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 3 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 | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index b89917f73ecd7cc63b9e00e59c3789e2e95e5e52..653fdc6a8c71741f0fe2cffa514b817b117be3e8 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -1074,7 +1074,12 @@ void Accessors::FunctionNameGetter(
HandleScope scope(isolate);
Handle<JSFunction> function =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
- Handle<Object> result(function->shared()->name(), isolate);
+ Handle<Object> result;
+ if (function->shared()->name_should_print_as_anonymous()) {
+ result = isolate->factory()->anonymous_string();
+ } else {
+ result = handle(function->shared()->name(), isolate);
+ }
info.GetReturnValue().Set(Utils::ToLocal(result));
}
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698