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

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

Issue 1353723002: [runtime] Initial step towards switching Execution::Call to callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handle sloppy mode api functions correctly. Created 5 years, 3 months 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
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 int const argc = args.length() - 2; 515 int const argc = args.length() - 2;
516 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0); 516 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0);
517 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); 517 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
518 ScopedVector<Handle<Object>> argv(argc); 518 ScopedVector<Handle<Object>> argv(argc);
519 for (int i = 0; i < argc; ++i) { 519 for (int i = 0; i < argc; ++i) {
520 argv[i] = args.at<Object>(2 + i); 520 argv[i] = args.at<Object>(2 + i);
521 } 521 }
522 Handle<Object> result; 522 Handle<Object> result;
523 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 523 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
524 isolate, result, 524 isolate, result,
525 Execution::Call(isolate, target, receiver, argc, argv.start(), true)); 525 Execution::Call(isolate, target, receiver, argc, argv.start()));
526 return *result; 526 return *result;
527 } 527 }
528 528
529 529
530 RUNTIME_FUNCTION(Runtime_Apply) { 530 RUNTIME_FUNCTION(Runtime_Apply) {
531 HandleScope scope(isolate); 531 HandleScope scope(isolate);
532 DCHECK(args.length() == 5); 532 DCHECK(args.length() == 5);
533 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0); 533 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0);
534 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); 534 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
535 CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2); 535 CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2);
(...skipping 16 matching lines...) Expand all
552 argv_large_buffer = base::SmartArrayPointer<Handle<Object> >(argv); 552 argv_large_buffer = base::SmartArrayPointer<Handle<Object> >(argv);
553 } 553 }
554 554
555 for (int i = 0; i < argc; ++i) { 555 for (int i = 0; i < argc; ++i) {
556 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 556 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
557 isolate, argv[i], Object::GetElement(isolate, arguments, offset + i)); 557 isolate, argv[i], Object::GetElement(isolate, arguments, offset + i));
558 } 558 }
559 559
560 Handle<Object> result; 560 Handle<Object> result;
561 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 561 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
562 isolate, result, 562 isolate, result, Execution::Call(isolate, fun, receiver, argc, argv));
563 Execution::Call(isolate, fun, receiver, argc, argv, true));
564 return *result; 563 return *result;
565 } 564 }
566 565
567 566
568 RUNTIME_FUNCTION(Runtime_GetFunctionDelegate) { 567 RUNTIME_FUNCTION(Runtime_GetFunctionDelegate) {
569 HandleScope scope(isolate); 568 HandleScope scope(isolate);
570 DCHECK(args.length() == 1); 569 DCHECK(args.length() == 1);
571 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 570 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
572 RUNTIME_ASSERT(!object->IsJSFunction()); 571 RUNTIME_ASSERT(!object->IsJSFunction());
573 Handle<JSFunction> result; 572 Handle<JSFunction> result;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 } 619 }
621 620
622 for (int i = 0; i < argc; ++i) { 621 for (int i = 0; i < argc; ++i) {
623 argv[i] = Handle<Object>(args[1 + i], isolate); 622 argv[i] = Handle<Object>(args[1 + i], isolate);
624 } 623 }
625 624
626 Handle<JSReceiver> hfun(fun); 625 Handle<JSReceiver> hfun(fun);
627 Handle<Object> hreceiver(receiver, isolate); 626 Handle<Object> hreceiver(receiver, isolate);
628 Handle<Object> result; 627 Handle<Object> result;
629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 628 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
630 isolate, result, 629 isolate, result, Execution::Call(isolate, hfun, hreceiver, argc, argv));
631 Execution::Call(isolate, hfun, hreceiver, argc, argv, true));
632 return *result; 630 return *result;
633 } 631 }
634 632
635 633
636 RUNTIME_FUNCTION(Runtime_IsConstructCall) { 634 RUNTIME_FUNCTION(Runtime_IsConstructCall) {
637 SealHandleScope shs(isolate); 635 SealHandleScope shs(isolate);
638 DCHECK(args.length() == 0); 636 DCHECK(args.length() == 0);
639 JavaScriptFrameIterator it(isolate); 637 JavaScriptFrameIterator it(isolate);
640 JavaScriptFrame* frame = it.frame(); 638 JavaScriptFrame* frame = it.frame();
641 return isolate->heap()->ToBoolean(frame->IsConstructor()); 639 return isolate->heap()->ToBoolean(frame->IsConstructor());
642 } 640 }
643 641
644 642
645 RUNTIME_FUNCTION(Runtime_IsFunction) { 643 RUNTIME_FUNCTION(Runtime_IsFunction) {
646 SealHandleScope shs(isolate); 644 SealHandleScope shs(isolate);
647 DCHECK(args.length() == 1); 645 DCHECK(args.length() == 1);
648 CONVERT_ARG_CHECKED(Object, obj, 0); 646 CONVERT_ARG_CHECKED(Object, obj, 0);
649 return isolate->heap()->ToBoolean(obj->IsJSFunction()); 647 return isolate->heap()->ToBoolean(obj->IsJSFunction());
650 } 648 }
651 649
652 650
653 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { 651 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) {
654 HandleScope scope(isolate); 652 HandleScope scope(isolate);
655 DCHECK(args.length() == 0); 653 DCHECK(args.length() == 0);
656 THROW_NEW_ERROR_RETURN_FAILURE(isolate, 654 THROW_NEW_ERROR_RETURN_FAILURE(isolate,
657 NewTypeError(MessageTemplate::kStrongArity)); 655 NewTypeError(MessageTemplate::kStrongArity));
658 } 656 }
659 } // namespace internal 657 } // namespace internal
660 } // namespace v8 658 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698