| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter-assembler.h" | 5 #include "src/interpreter/interpreter-assembler.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 Node* is_smi = TaggedIsSmi(function); | 536 Node* is_smi = TaggedIsSmi(function); |
| 537 Branch(is_smi, &extra_checks, &call_function); | 537 Branch(is_smi, &extra_checks, &call_function); |
| 538 | 538 |
| 539 Bind(&call_function); | 539 Bind(&call_function); |
| 540 { | 540 { |
| 541 // Increment the call count. | 541 // Increment the call count. |
| 542 IncrementCallCount(type_feedback_vector, slot_id); | 542 IncrementCallCount(type_feedback_vector, slot_id); |
| 543 | 543 |
| 544 // Call using call function builtin. | 544 // Call using call function builtin. |
| 545 Callable callable = CodeFactory::InterpreterPushArgsAndCall( | 545 Callable callable = CodeFactory::InterpreterPushArgsAndCall( |
| 546 isolate(), tail_call_mode, CallableType::kJSFunction); | 546 isolate(), tail_call_mode, InterpreterPushArgsMode::kJSFunction); |
| 547 Node* code_target = HeapConstant(callable.code()); | 547 Node* code_target = HeapConstant(callable.code()); |
| 548 Node* ret_value = CallStub(callable.descriptor(), code_target, context, | 548 Node* ret_value = CallStub(callable.descriptor(), code_target, context, |
| 549 arg_count, first_arg, function); | 549 arg_count, first_arg, function); |
| 550 return_value.Bind(ret_value); | 550 return_value.Bind(ret_value); |
| 551 Goto(&end); | 551 Goto(&end); |
| 552 } | 552 } |
| 553 | 553 |
| 554 Bind(&extra_checks); | 554 Bind(&extra_checks); |
| 555 { | 555 { |
| 556 Label check_initialized(this), mark_megamorphic(this), | 556 Label check_initialized(this), mark_megamorphic(this), |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 652 } |
| 653 | 653 |
| 654 Bind(&call); | 654 Bind(&call); |
| 655 { | 655 { |
| 656 Comment("Increment call count and call using Call builtin"); | 656 Comment("Increment call count and call using Call builtin"); |
| 657 // Increment the call count. | 657 // Increment the call count. |
| 658 IncrementCallCount(type_feedback_vector, slot_id); | 658 IncrementCallCount(type_feedback_vector, slot_id); |
| 659 | 659 |
| 660 // Call using call builtin. | 660 // Call using call builtin. |
| 661 Callable callable_call = CodeFactory::InterpreterPushArgsAndCall( | 661 Callable callable_call = CodeFactory::InterpreterPushArgsAndCall( |
| 662 isolate(), tail_call_mode, CallableType::kAny); | 662 isolate(), tail_call_mode, InterpreterPushArgsMode::kOther); |
| 663 Node* code_target_call = HeapConstant(callable_call.code()); | 663 Node* code_target_call = HeapConstant(callable_call.code()); |
| 664 Node* ret_value = CallStub(callable_call.descriptor(), code_target_call, | 664 Node* ret_value = CallStub(callable_call.descriptor(), code_target_call, |
| 665 context, arg_count, first_arg, function); | 665 context, arg_count, first_arg, function); |
| 666 return_value.Bind(ret_value); | 666 return_value.Bind(ret_value); |
| 667 Goto(&end); | 667 Goto(&end); |
| 668 } | 668 } |
| 669 | 669 |
| 670 Bind(&end); | 670 Bind(&end); |
| 671 return return_value.value(); | 671 return return_value.value(); |
| 672 } | 672 } |
| 673 | 673 |
| 674 Node* InterpreterAssembler::CallJS(Node* function, Node* context, | 674 Node* InterpreterAssembler::CallJS(Node* function, Node* context, |
| 675 Node* first_arg, Node* arg_count, | 675 Node* first_arg, Node* arg_count, |
| 676 TailCallMode tail_call_mode) { | 676 TailCallMode tail_call_mode) { |
| 677 Callable callable = CodeFactory::InterpreterPushArgsAndCall( | 677 Callable callable = CodeFactory::InterpreterPushArgsAndCall( |
| 678 isolate(), tail_call_mode, CallableType::kAny); | 678 isolate(), tail_call_mode, InterpreterPushArgsMode::kOther); |
| 679 Node* code_target = HeapConstant(callable.code()); | 679 Node* code_target = HeapConstant(callable.code()); |
| 680 | 680 |
| 681 return CallStub(callable.descriptor(), code_target, context, arg_count, | 681 return CallStub(callable.descriptor(), code_target, context, arg_count, |
| 682 first_arg, function); |
| 683 } |
| 684 |
| 685 Node* InterpreterAssembler::CallJSWithSpread(Node* function, Node* context, |
| 686 Node* first_arg, Node* arg_count) { |
| 687 Callable callable = CodeFactory::InterpreterPushArgsAndCall( |
| 688 isolate(), TailCallMode::kDisallow, |
| 689 InterpreterPushArgsMode::kWithFinalSpread); |
| 690 Node* code_target = HeapConstant(callable.code()); |
| 691 |
| 692 return CallStub(callable.descriptor(), code_target, context, arg_count, |
| 682 first_arg, function); | 693 first_arg, function); |
| 683 } | 694 } |
| 684 | 695 |
| 685 Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, | 696 Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context, |
| 686 Node* new_target, Node* first_arg, | 697 Node* new_target, Node* first_arg, |
| 687 Node* arg_count, Node* slot_id, | 698 Node* arg_count, Node* slot_id, |
| 688 Node* type_feedback_vector) { | 699 Node* type_feedback_vector) { |
| 689 Variable return_value(this, MachineRepresentation::kTagged); | 700 Variable return_value(this, MachineRepresentation::kTagged); |
| 690 Variable allocation_feedback(this, MachineRepresentation::kTagged); | 701 Variable allocation_feedback(this, MachineRepresentation::kTagged); |
| 691 Label call_construct_function(this, &allocation_feedback), | 702 Label call_construct_function(this, &allocation_feedback), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 711 Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element); | 722 Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element); |
| 712 Node* is_monomorphic = WordEqual(constructor, feedback_value); | 723 Node* is_monomorphic = WordEqual(constructor, feedback_value); |
| 713 allocation_feedback.Bind(UndefinedConstant()); | 724 allocation_feedback.Bind(UndefinedConstant()); |
| 714 Branch(is_monomorphic, &call_construct_function, &extra_checks); | 725 Branch(is_monomorphic, &call_construct_function, &extra_checks); |
| 715 | 726 |
| 716 Bind(&call_construct_function); | 727 Bind(&call_construct_function); |
| 717 { | 728 { |
| 718 Comment("call using callConstructFunction"); | 729 Comment("call using callConstructFunction"); |
| 719 IncrementCallCount(type_feedback_vector, slot_id); | 730 IncrementCallCount(type_feedback_vector, slot_id); |
| 720 Callable callable_function = CodeFactory::InterpreterPushArgsAndConstruct( | 731 Callable callable_function = CodeFactory::InterpreterPushArgsAndConstruct( |
| 721 isolate(), PushArgsConstructMode::kJSFunction); | 732 isolate(), InterpreterPushArgsMode::kJSFunction); |
| 722 return_value.Bind(CallStub(callable_function.descriptor(), | 733 return_value.Bind(CallStub(callable_function.descriptor(), |
| 723 HeapConstant(callable_function.code()), context, | 734 HeapConstant(callable_function.code()), context, |
| 724 arg_count, new_target, constructor, | 735 arg_count, new_target, constructor, |
| 725 allocation_feedback.value(), first_arg)); | 736 allocation_feedback.value(), first_arg)); |
| 726 Goto(&end); | 737 Goto(&end); |
| 727 } | 738 } |
| 728 | 739 |
| 729 Bind(&extra_checks); | 740 Bind(&extra_checks); |
| 730 { | 741 { |
| 731 Label check_allocation_site(this), check_initialized(this), | 742 Label check_allocation_site(this), check_initialized(this), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())), | 825 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())), |
| 815 SKIP_WRITE_BARRIER); | 826 SKIP_WRITE_BARRIER); |
| 816 Goto(&call_construct_function); | 827 Goto(&call_construct_function); |
| 817 } | 828 } |
| 818 } | 829 } |
| 819 | 830 |
| 820 Bind(&call_construct); | 831 Bind(&call_construct); |
| 821 { | 832 { |
| 822 Comment("call using callConstruct builtin"); | 833 Comment("call using callConstruct builtin"); |
| 823 Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( | 834 Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( |
| 824 isolate(), PushArgsConstructMode::kOther); | 835 isolate(), InterpreterPushArgsMode::kOther); |
| 825 Node* code_target = HeapConstant(callable.code()); | 836 Node* code_target = HeapConstant(callable.code()); |
| 826 return_value.Bind(CallStub(callable.descriptor(), code_target, context, | 837 return_value.Bind(CallStub(callable.descriptor(), code_target, context, |
| 827 arg_count, new_target, constructor, | 838 arg_count, new_target, constructor, |
| 828 UndefinedConstant(), first_arg)); | 839 UndefinedConstant(), first_arg)); |
| 829 Goto(&end); | 840 Goto(&end); |
| 830 } | 841 } |
| 831 | 842 |
| 832 Bind(&end); | 843 Bind(&end); |
| 833 return return_value.value(); | 844 return return_value.value(); |
| 834 } | 845 } |
| 835 | 846 |
| 836 Node* InterpreterAssembler::CallConstructWithSpread(Node* constructor, | 847 Node* InterpreterAssembler::CallConstructWithSpread(Node* constructor, |
| 837 Node* context, | 848 Node* context, |
| 838 Node* new_target, | 849 Node* new_target, |
| 839 Node* first_arg, | 850 Node* first_arg, |
| 840 Node* arg_count) { | 851 Node* arg_count) { |
| 841 Variable return_value(this, MachineRepresentation::kTagged); | 852 Variable return_value(this, MachineRepresentation::kTagged); |
| 842 Comment("call using ConstructWithSpread"); | 853 Comment("call using ConstructWithSpread"); |
| 843 Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( | 854 Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( |
| 844 isolate(), PushArgsConstructMode::kWithFinalSpread); | 855 isolate(), InterpreterPushArgsMode::kWithFinalSpread); |
| 845 Node* code_target = HeapConstant(callable.code()); | 856 Node* code_target = HeapConstant(callable.code()); |
| 846 return_value.Bind(CallStub(callable.descriptor(), code_target, context, | 857 return_value.Bind(CallStub(callable.descriptor(), code_target, context, |
| 847 arg_count, new_target, constructor, | 858 arg_count, new_target, constructor, |
| 848 UndefinedConstant(), first_arg)); | 859 UndefinedConstant(), first_arg)); |
| 849 | 860 |
| 850 return return_value.value(); | 861 return return_value.value(); |
| 851 } | 862 } |
| 852 | 863 |
| 853 Node* InterpreterAssembler::CallRuntimeN(Node* function_id, Node* context, | 864 Node* InterpreterAssembler::CallRuntimeN(Node* function_id, Node* context, |
| 854 Node* first_arg, Node* arg_count, | 865 Node* first_arg, Node* arg_count, |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 Goto(&loop); | 1331 Goto(&loop); |
| 1321 } | 1332 } |
| 1322 Bind(&done_loop); | 1333 Bind(&done_loop); |
| 1323 | 1334 |
| 1324 return array; | 1335 return array; |
| 1325 } | 1336 } |
| 1326 | 1337 |
| 1327 } // namespace interpreter | 1338 } // namespace interpreter |
| 1328 } // namespace internal | 1339 } // namespace internal |
| 1329 } // namespace v8 | 1340 } // namespace v8 |
| OLD | NEW |