Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/runtime/runtime-function.cc

Issue 1439613003: [turbofan] Better and more sane support for tail calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 626
609 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { 627 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) {
610 HandleScope scope(isolate); 628 HandleScope scope(isolate);
611 DCHECK(args.length() == 0); 629 DCHECK(args.length() == 0);
612 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 630 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
613 NewTypeError(MessageTemplate::kStrongArity)); 631 NewTypeError(MessageTemplate::kStrongArity));
614 } 632 }
615 633
616 } // namespace internal 634 } // namespace internal
617 } // namespace v8 635 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698