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

Unified Diff: src/objects.cc

Issue 1626423003: Support computed properties for ES2015 Function.name (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merge to trunk, disable bytecode generator class test Created 4 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 | « src/objects.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 7097ea36d2615c11308c99699f8a4ccb5afb824d..7a0e87965225e1f61e0fdc05d31ba9adb28e6141 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -13317,6 +13317,22 @@ Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) {
return JSFunction::GetName(function);
}
+void JSFunction::SetName(Handle<JSFunction> function, Handle<Name> name,
+ Handle<String> prefix) {
+ Isolate* isolate = function->GetIsolate();
+ Handle<String> function_name = Name::ToFunctionName(name).ToHandleChecked();
+ if (prefix->length() > 0) {
+ IncrementalStringBuilder builder(isolate);
+ builder.AppendString(prefix);
+ builder.AppendCharacter(' ');
+ builder.AppendString(function_name);
+ function_name = builder.Finish().ToHandleChecked();
+ }
+ JSObject::DefinePropertyOrElementIgnoreAttributes(
+ function, isolate->factory()->name_string(), function_name,
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY))
+ .ToHandleChecked();
+}
namespace {
« no previous file with comments | « src/objects.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698