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/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 argv[i] = args.at<Object>(2 + i); | 521 argv[i] = args.at<Object>(2 + i); |
522 } | 522 } |
523 Handle<Object> result; | 523 Handle<Object> result; |
524 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 524 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
525 isolate, result, | 525 isolate, result, |
526 Execution::Call(isolate, target, receiver, argc, argv.start())); | 526 Execution::Call(isolate, target, receiver, argc, argv.start())); |
527 return *result; | 527 return *result; |
528 } | 528 } |
529 | 529 |
530 | 530 |
| 531 RUNTIME_FUNCTION(Runtime_TailCall) { |
| 532 HandleScope scope(isolate); |
| 533 DCHECK_LE(2, args.length()); |
| 534 int const argc = args.length() - 2; |
| 535 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0); |
| 536 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); |
| 537 ScopedVector<Handle<Object>> argv(argc); |
| 538 for (int i = 0; i < argc; ++i) { |
| 539 argv[i] = args.at<Object>(2 + i); |
| 540 } |
| 541 Handle<Object> result; |
| 542 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 543 isolate, result, |
| 544 Execution::Call(isolate, target, receiver, argc, argv.start())); |
| 545 return *result; |
| 546 } |
| 547 |
| 548 |
531 RUNTIME_FUNCTION(Runtime_Apply) { | 549 RUNTIME_FUNCTION(Runtime_Apply) { |
532 HandleScope scope(isolate); | 550 HandleScope scope(isolate); |
533 DCHECK(args.length() == 5); | 551 DCHECK(args.length() == 5); |
534 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0); | 552 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0); |
535 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); | 553 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); |
536 CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2); | 554 CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2); |
537 CONVERT_INT32_ARG_CHECKED(offset, 3); | 555 CONVERT_INT32_ARG_CHECKED(offset, 3); |
538 CONVERT_INT32_ARG_CHECKED(argc, 4); | 556 CONVERT_INT32_ARG_CHECKED(argc, 4); |
539 RUNTIME_ASSERT(offset >= 0); | 557 RUNTIME_ASSERT(offset >= 0); |
540 // Loose upper bound to allow fuzzing. We'll most likely run out of | 558 // Loose upper bound to allow fuzzing. We'll most likely run out of |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 636 |
619 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 637 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
620 HandleScope scope(isolate); | 638 HandleScope scope(isolate); |
621 DCHECK(args.length() == 0); | 639 DCHECK(args.length() == 0); |
622 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 640 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
623 NewTypeError(MessageTemplate::kStrongArity)); | 641 NewTypeError(MessageTemplate::kStrongArity)); |
624 } | 642 } |
625 | 643 |
626 } // namespace internal | 644 } // namespace internal |
627 } // namespace v8 | 645 } // namespace v8 |
OLD | NEW |