| 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 #include "src/wasm/wasm-module.h" | 14 #include "src/wasm/wasm-module.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 | 18 |
| 19 RUNTIME_FUNCTION(Runtime_FunctionGetName) { | 19 RUNTIME_FUNCTION(Runtime_FunctionGetName) { |
| 20 SealHandleScope shs(isolate); | 20 HandleScope scope(isolate); |
| 21 DCHECK(args.length() == 1); | 21 DCHECK(args.length() == 1); |
| 22 | 22 |
| 23 CONVERT_ARG_CHECKED(JSFunction, f, 0); | 23 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
| 24 return f->shared()->name(); | 24 Handle<Object> result; |
| 25 if (function->IsJSBoundFunction()) { |
| 26 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 27 isolate, result, JSBoundFunction::GetName( |
| 28 isolate, Handle<JSBoundFunction>::cast(function))); |
| 29 } else { |
| 30 result = JSFunction::GetName(isolate, Handle<JSFunction>::cast(function)); |
| 31 } |
| 32 return *result; |
| 25 } | 33 } |
| 26 | 34 |
| 27 | 35 |
| 28 RUNTIME_FUNCTION(Runtime_FunctionSetName) { | 36 RUNTIME_FUNCTION(Runtime_FunctionSetName) { |
| 29 HandleScope scope(isolate); | 37 HandleScope scope(isolate); |
| 30 DCHECK(args.length() == 2); | 38 DCHECK(args.length() == 2); |
| 31 | 39 |
| 32 CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); | 40 CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); |
| 33 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); | 41 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); |
| 34 | 42 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 DCHECK_EQ(2, args.length()); | 316 DCHECK_EQ(2, args.length()); |
| 309 | 317 |
| 310 CONVERT_ARG_HANDLE_CHECKED(JSObject, wasm, 0); | 318 CONVERT_ARG_HANDLE_CHECKED(JSObject, wasm, 0); |
| 311 CONVERT_SMI_ARG_CHECKED(func_index, 1); | 319 CONVERT_SMI_ARG_CHECKED(func_index, 1); |
| 312 | 320 |
| 313 return *wasm::GetWasmFunctionName(wasm, func_index); | 321 return *wasm::GetWasmFunctionName(wasm, func_index); |
| 314 } | 322 } |
| 315 | 323 |
| 316 } // namespace internal | 324 } // namespace internal |
| 317 } // namespace v8 | 325 } // namespace v8 |
| OLD | NEW |