Index: src/runtime/runtime-function.cc |
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc |
index b57064f364fedf5753bbad76a39fd619849c1c68..0e2feed264b483bc2d20e47bcddc9eab66e2b0e2 100644 |
--- a/src/runtime/runtime-function.cc |
+++ b/src/runtime/runtime-function.cc |
@@ -67,13 +67,35 @@ RUNTIME_FUNCTION(Runtime_FunctionGetName) { |
} |
+static String* NameToFunctionName(Isolate* isolate, Name* name) { |
Dmitry Lomov (no reviews)
2014/10/24 08:20:47
This function shouldn't use naked pointers - use H
caitp (gmail)
2014/10/24 12:18:33
Done
|
+ String* stringName = NULL; |
Dmitry Lomov (no reviews)
2014/10/24 08:20:47
Handle<String>
|
+ |
+ // TODO(caitp): Follow proper rules in section 9.2.11 (SetFunctionName) |
Dmitry Lomov (no reviews)
2014/10/24 08:20:47
Yes, fine to do in later CL - our names for getter
|
+ if (name->IsSymbol()) { |
+ Object* symName = Symbol::cast(name)->name(); |
Dmitry Lomov (no reviews)
2014/10/24 08:20:47
Handle<Object> symName(Handle<Symbol>::cast(name)-
|
+ if (symName->IsString()) { |
+ stringName = String::cast(symName); |
+ } |
+ } else { |
+ stringName = String::cast(name); |
+ } |
+ |
+ if (stringName == NULL) { |
+ stringName = isolate->heap()->empty_string(); |
+ } |
+ |
+ return stringName; |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_FunctionSetName) { |
SealHandleScope shs(isolate); |
DCHECK(args.length() == 2); |
CONVERT_ARG_CHECKED(JSFunction, f, 0); |
- CONVERT_ARG_CHECKED(String, name, 1); |
- f->shared()->set_name(name); |
+ CONVERT_ARG_CHECKED(Name, name, 1); |
Dmitry Lomov (no reviews)
2014/10/24 08:20:47
CONVERT_ARG_HANDLE_CHECKED
In line 92 above, s/Se
|
+ |
+ f->shared()->set_name(NameToFunctionName(isolate, name)); |
return isolate->heap()->undefined_value(); |
} |