| 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 HandleScope scope(isolate); | 20 HandleScope scope(isolate); |
| 21 DCHECK(args.length() == 1); | 21 DCHECK(args.length() == 1); |
| 22 | 22 |
| 23 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 23 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
| 24 Handle<Object> result; | |
| 25 if (function->IsJSBoundFunction()) { | 24 if (function->IsJSBoundFunction()) { |
| 26 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 25 RETURN_RESULT_OR_FAILURE( |
| 27 isolate, result, JSBoundFunction::GetName( | 26 isolate, JSBoundFunction::GetName( |
| 28 isolate, Handle<JSBoundFunction>::cast(function))); | 27 isolate, Handle<JSBoundFunction>::cast(function))); |
| 29 } else { | 28 } else { |
| 30 result = JSFunction::GetName(isolate, Handle<JSFunction>::cast(function)); | 29 return *JSFunction::GetName(isolate, Handle<JSFunction>::cast(function)); |
| 31 } | 30 } |
| 32 return *result; | |
| 33 } | 31 } |
| 34 | 32 |
| 35 | 33 |
| 36 RUNTIME_FUNCTION(Runtime_FunctionSetName) { | 34 RUNTIME_FUNCTION(Runtime_FunctionSetName) { |
| 37 HandleScope scope(isolate); | 35 HandleScope scope(isolate); |
| 38 DCHECK(args.length() == 2); | 36 DCHECK(args.length() == 2); |
| 39 | 37 |
| 40 CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); | 38 CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0); |
| 41 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); | 39 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); |
| 42 | 40 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 RUNTIME_FUNCTION(Runtime_Call) { | 267 RUNTIME_FUNCTION(Runtime_Call) { |
| 270 HandleScope scope(isolate); | 268 HandleScope scope(isolate); |
| 271 DCHECK_LE(2, args.length()); | 269 DCHECK_LE(2, args.length()); |
| 272 int const argc = args.length() - 2; | 270 int const argc = args.length() - 2; |
| 273 CONVERT_ARG_HANDLE_CHECKED(Object, target, 0); | 271 CONVERT_ARG_HANDLE_CHECKED(Object, target, 0); |
| 274 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); | 272 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); |
| 275 ScopedVector<Handle<Object>> argv(argc); | 273 ScopedVector<Handle<Object>> argv(argc); |
| 276 for (int i = 0; i < argc; ++i) { | 274 for (int i = 0; i < argc; ++i) { |
| 277 argv[i] = args.at<Object>(2 + i); | 275 argv[i] = args.at<Object>(2 + i); |
| 278 } | 276 } |
| 279 Handle<Object> result; | 277 RETURN_RESULT_OR_FAILURE( |
| 280 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 278 isolate, Execution::Call(isolate, target, receiver, argc, argv.start())); |
| 281 isolate, result, | |
| 282 Execution::Call(isolate, target, receiver, argc, argv.start())); | |
| 283 return *result; | |
| 284 } | 279 } |
| 285 | 280 |
| 286 | 281 |
| 287 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. | 282 // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee. |
| 288 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { | 283 RUNTIME_FUNCTION(Runtime_ConvertReceiver) { |
| 289 HandleScope scope(isolate); | 284 HandleScope scope(isolate); |
| 290 DCHECK(args.length() == 1); | 285 DCHECK(args.length() == 1); |
| 291 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | 286 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
| 292 return *Object::ConvertReceiver(isolate, receiver).ToHandleChecked(); | 287 return *Object::ConvertReceiver(isolate, receiver).ToHandleChecked(); |
| 293 } | 288 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 306 DCHECK_EQ(1, args.length()); | 301 DCHECK_EQ(1, args.length()); |
| 307 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); | 302 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
| 308 return function->IsJSBoundFunction() | 303 return function->IsJSBoundFunction() |
| 309 ? *JSBoundFunction::ToString( | 304 ? *JSBoundFunction::ToString( |
| 310 Handle<JSBoundFunction>::cast(function)) | 305 Handle<JSBoundFunction>::cast(function)) |
| 311 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); | 306 : *JSFunction::ToString(Handle<JSFunction>::cast(function)); |
| 312 } | 307 } |
| 313 | 308 |
| 314 } // namespace internal | 309 } // namespace internal |
| 315 } // namespace v8 | 310 } // namespace v8 |
| OLD | NEW |