// Copyright 2014 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/runtime/runtime-utils.h" #include "src/accessors.h" #include "src/arguments.h" #include "src/compiler.h" #include "src/isolate-inl.h" #include "src/messages.h" namespace v8 { namespace internal { RUNTIME_FUNCTION(Runtime_FunctionGetName) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); if (function->IsJSBoundFunction()) { RETURN_RESULT_OR_FAILURE( isolate, JSBoundFunction::GetName( isolate, Handle::cast(function))); } else { return *JSFunction::GetName(isolate, Handle::cast(function)); } } // TODO(5530): Remove once uses in debug.js are gone. RUNTIME_FUNCTION(Runtime_FunctionGetScript) { HandleScope scope(isolate); DCHECK_EQ(1, args.length()); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); if (function->IsJSFunction()) { Handle script( Handle::cast(function)->shared()->script(), isolate); if (script->IsScript()) { return *Script::GetWrapper(Handle