Index: src/runtime/runtime-function.cc |
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc |
index c211e1895f742408281a18f4de7db6b77bcdd202..ac3973f9db9d0c8117c8cf71b928f896ca8dfd43 100644 |
--- a/src/runtime/runtime-function.cc |
+++ b/src/runtime/runtime-function.cc |
@@ -76,10 +76,10 @@ static Handle<String> NameToFunctionName(Handle<Name> name) { |
Handle<Object> description(Handle<Symbol>::cast(name)->name(), |
name->GetIsolate()); |
if (description->IsString()) { |
- stringName = Handle<String>::cast(description); |
+ return Handle<String>::cast(description); |
} |
} else { |
- stringName = Handle<String>::cast(name); |
+ return String::Flatten(Handle<String>::cast(name)); |
} |
return stringName; |
@@ -93,7 +93,10 @@ RUNTIME_FUNCTION(Runtime_FunctionSetName) { |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); |
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
- f->shared()->set_name(*NameToFunctionName(name)); |
+ // NameToFunctionName may cause allocations so we need to be careful about |
adamk
2015/04/24 16:29:07
Not sure this comment adds much, I'd tend to expec
|
+ // execution order here. |
+ name = NameToFunctionName(name); |
+ f->shared()->set_name(*name); |
return isolate->heap()->undefined_value(); |
} |