| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| 11 #include "src/isolate-inl.h" | 11 #include "src/isolate-inl.h" |
| 12 #include "src/messages.h" | 12 #include "src/messages.h" |
| 13 #include "src/profiler/cpu-profiler.h" | 13 #include "src/profiler/cpu-profiler.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 RUNTIME_FUNCTION(Runtime_FunctionGetName) { | 18 RUNTIME_FUNCTION(Runtime_FunctionGetName) { |
| 19 SealHandleScope shs(isolate); | 19 HandleScope scope(isolate); |
| 20 DCHECK(args.length() == 1); | 20 DCHECK(args.length() == 1); |
| 21 | 21 |
| 22 CONVERT_ARG_CHECKED(JSFunction, f, 0); | 22 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
| 23 return f->shared()->name(); | 23 Handle<Object> result; |
| 24 if (function->IsJSBoundFunction()) { |
| 25 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 26 isolate, result, JSBoundFunction::GetName( |
| 27 isolate, Handle<JSBoundFunction>::cast(function))); |
| 28 } else { |
| 29 result = JSFunction::GetName(isolate, Handle<JSFunction>::cast(function)); |
| 30 } |
| 31 return *result; |
| 24 } | 32 } |
| 25 | 33 |
| 26 | 34 |
| 27 RUNTIME_FUNCTION(Runtime_FunctionSetName) { | 35 RUNTIME_FUNCTION(Runtime_FunctionSetName) { |
| 28 HandleScope scope(isolate); | 36 HandleScope scope(isolate); |
| 29 DCHECK(args.length() == 2); | 37 DCHECK(args.length() == 2); |
| 30 | 38 |
| 31 CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); | 39 CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); |
| 32 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); | 40 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); |
| 33 | 41 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 DCHECK_EQ(1, args.length()); | 308 DCHECK_EQ(1, args.length()); |
| 301 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 309 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
| 302 return function->IsJSBoundFunction() | 310 return function->IsJSBoundFunction() |
| 303 ? *JSBoundFunction::ToString( | 311 ? *JSBoundFunction::ToString( |
| 304 Handle<JSBoundFunction>::cast(function)) | 312 Handle<JSBoundFunction>::cast(function)) |
| 305 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); | 313 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); |
| 306 } | 314 } |
| 307 | 315 |
| 308 } // namespace internal | 316 } // namespace internal |
| 309 } // namespace v8 | 317 } // namespace v8 |
| OLD | NEW |