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" | |
14 #include "src/wasm/wasm-module.h" | 13 #include "src/wasm/wasm-module.h" |
15 | 14 |
16 namespace v8 { | 15 namespace v8 { |
17 namespace internal { | 16 namespace internal { |
18 | 17 |
19 RUNTIME_FUNCTION(Runtime_FunctionGetName) { | 18 RUNTIME_FUNCTION(Runtime_FunctionGetName) { |
20 HandleScope scope(isolate); | 19 HandleScope scope(isolate); |
21 DCHECK(args.length() == 1); | 20 DCHECK(args.length() == 1); |
22 | 21 |
23 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 22 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 DCHECK(target->next_function_link()->IsUndefined(isolate)); | 207 DCHECK(target->next_function_link()->IsUndefined(isolate)); |
209 | 208 |
210 Handle<Context> context(source->context()); | 209 Handle<Context> context(source->context()); |
211 target->set_context(*context); | 210 target->set_context(*context); |
212 | 211 |
213 // Make sure we get a fresh copy of the literal vector to avoid cross | 212 // Make sure we get a fresh copy of the literal vector to avoid cross |
214 // context contamination, and that the literal vector makes it's way into | 213 // context contamination, and that the literal vector makes it's way into |
215 // the target_shared optimized code map. | 214 // the target_shared optimized code map. |
216 JSFunction::EnsureLiterals(target); | 215 JSFunction::EnsureLiterals(target); |
217 | 216 |
218 if (isolate->logger()->is_logging_code_events() || | 217 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { |
219 isolate->cpu_profiler()->is_profiling()) { | |
220 isolate->logger()->LogExistingFunction( | 218 isolate->logger()->LogExistingFunction( |
221 source_shared, Handle<AbstractCode>(source_shared->abstract_code())); | 219 source_shared, Handle<AbstractCode>(source_shared->abstract_code())); |
222 } | 220 } |
223 | 221 |
224 return *target; | 222 return *target; |
225 } | 223 } |
226 | 224 |
227 | 225 |
228 // Set the native flag on the function. | 226 // Set the native flag on the function. |
229 // This is used to decide if we should transform null and undefined | 227 // This is used to decide if we should transform null and undefined |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 DCHECK_EQ(1, args.length()); | 297 DCHECK_EQ(1, args.length()); |
300 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 298 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
301 return function->IsJSBoundFunction() | 299 return function->IsJSBoundFunction() |
302 ? *JSBoundFunction::ToString( | 300 ? *JSBoundFunction::ToString( |
303 Handle<JSBoundFunction>::cast(function)) | 301 Handle<JSBoundFunction>::cast(function)) |
304 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); | 302 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); |
305 } | 303 } |
306 | 304 |
307 } // namespace internal | 305 } // namespace internal |
308 } // namespace v8 | 306 } // namespace v8 |
OLD | NEW |