Chromium Code Reviews| Index: src/runtime/runtime-function.cc |
| diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc |
| index b57064f364fedf5753bbad76a39fd619849c1c68..4861eafbd29c28934b2da15738cc15d5c68308e7 100644 |
| --- a/src/runtime/runtime-function.cc |
| +++ b/src/runtime/runtime-function.cc |
| @@ -67,13 +67,32 @@ RUNTIME_FUNCTION(Runtime_FunctionGetName) { |
| } |
| +static Handle<String> NameToFunctionName(Handle<Name> name) { |
| + Handle<String> stringName(name->GetHeap()->empty_string()); |
| + |
| + // TODO(caitp): Follow proper rules in section 9.2.11 (SetFunctionName) |
| + if (name->IsSymbol()) { |
| + Handle<Object> description(Handle<Symbol>::cast(name)->name(), |
| + name->GetIsolate()); |
| + if (description->IsString()) { |
| + stringName = Handle<String>::cast(description); |
| + } |
| + } else { |
| + stringName = Handle<String>::cast(name); |
| + } |
| + |
| + return stringName; |
| +} |
| + |
| + |
| RUNTIME_FUNCTION(Runtime_FunctionSetName) { |
| - SealHandleScope shs(isolate); |
| + HandleScope shs(isolate); |
|
Dmitry Lomov (no reviews)
2014/10/24 12:38:55
nit: s/shs/scope/
|
| DCHECK(args.length() == 2); |
| - CONVERT_ARG_CHECKED(JSFunction, f, 0); |
| - CONVERT_ARG_CHECKED(String, name, 1); |
| - f->shared()->set_name(name); |
| + CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); |
| + CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| + |
| + f->shared()->set_name(*NameToFunctionName(name)); |
| return isolate->heap()->undefined_value(); |
| } |