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/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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())); | 525 Execution::Call(isolate, target, receiver, argc, argv.start(), true)); |
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 Loading... |
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, Execution::Call(isolate, fun, receiver, argc, argv)); | 562 isolate, result, |
| 563 Execution::Call(isolate, fun, receiver, argc, argv, true)); |
563 return *result; | 564 return *result; |
564 } | 565 } |
565 | 566 |
566 | 567 |
567 RUNTIME_FUNCTION(Runtime_GetFunctionDelegate) { | 568 RUNTIME_FUNCTION(Runtime_GetFunctionDelegate) { |
568 HandleScope scope(isolate); | 569 HandleScope scope(isolate); |
569 DCHECK(args.length() == 1); | 570 DCHECK(args.length() == 1); |
570 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 571 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
571 RUNTIME_ASSERT(!object->IsJSFunction()); | 572 RUNTIME_ASSERT(!object->IsJSFunction()); |
572 Handle<JSFunction> result; | 573 Handle<JSFunction> result; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 } | 620 } |
620 | 621 |
621 for (int i = 0; i < argc; ++i) { | 622 for (int i = 0; i < argc; ++i) { |
622 argv[i] = Handle<Object>(args[1 + i], isolate); | 623 argv[i] = Handle<Object>(args[1 + i], isolate); |
623 } | 624 } |
624 | 625 |
625 Handle<JSReceiver> hfun(fun); | 626 Handle<JSReceiver> hfun(fun); |
626 Handle<Object> hreceiver(receiver, isolate); | 627 Handle<Object> hreceiver(receiver, isolate); |
627 Handle<Object> result; | 628 Handle<Object> result; |
628 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
629 isolate, result, Execution::Call(isolate, hfun, hreceiver, argc, argv)); | 630 isolate, result, |
| 631 Execution::Call(isolate, hfun, hreceiver, argc, argv, true)); |
630 return *result; | 632 return *result; |
631 } | 633 } |
632 | 634 |
633 | 635 |
634 RUNTIME_FUNCTION(Runtime_IsConstructCall) { | 636 RUNTIME_FUNCTION(Runtime_IsConstructCall) { |
635 SealHandleScope shs(isolate); | 637 SealHandleScope shs(isolate); |
636 DCHECK(args.length() == 0); | 638 DCHECK(args.length() == 0); |
637 JavaScriptFrameIterator it(isolate); | 639 JavaScriptFrameIterator it(isolate); |
638 JavaScriptFrame* frame = it.frame(); | 640 JavaScriptFrame* frame = it.frame(); |
639 return isolate->heap()->ToBoolean(frame->IsConstructor()); | 641 return isolate->heap()->ToBoolean(frame->IsConstructor()); |
640 } | 642 } |
641 | 643 |
642 | 644 |
643 RUNTIME_FUNCTION(Runtime_IsFunction) { | 645 RUNTIME_FUNCTION(Runtime_IsFunction) { |
644 SealHandleScope shs(isolate); | 646 SealHandleScope shs(isolate); |
645 DCHECK(args.length() == 1); | 647 DCHECK(args.length() == 1); |
646 CONVERT_ARG_CHECKED(Object, obj, 0); | 648 CONVERT_ARG_CHECKED(Object, obj, 0); |
647 return isolate->heap()->ToBoolean(obj->IsJSFunction()); | 649 return isolate->heap()->ToBoolean(obj->IsJSFunction()); |
648 } | 650 } |
649 | 651 |
650 | 652 |
651 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { | 653 RUNTIME_FUNCTION(Runtime_ThrowStrongModeTooFewArguments) { |
652 HandleScope scope(isolate); | 654 HandleScope scope(isolate); |
653 DCHECK(args.length() == 0); | 655 DCHECK(args.length() == 0); |
654 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 656 THROW_NEW_ERROR_RETURN_FAILURE(isolate, |
655 NewTypeError(MessageTemplate::kStrongArity)); | 657 NewTypeError(MessageTemplate::kStrongArity)); |
656 } | 658 } |
657 } // namespace internal | 659 } // namespace internal |
658 } // namespace v8 | 660 } // namespace v8 |
OLD | NEW |