| 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 "test/unittests/interpreter/interpreter-assembler-unittest.h" | 5 #include "test/unittests/interpreter/interpreter-assembler-unittest.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
| 10 #include "src/interface-descriptors.h" | 10 #include "src/interface-descriptors.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 call_runtime, | 636 call_runtime, |
| 637 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, | 637 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, |
| 638 function_entry, | 638 function_entry, |
| 639 IsParameter(InterpreterDispatchDescriptor::kContextParameter), | 639 IsParameter(InterpreterDispatchDescriptor::kContextParameter), |
| 640 _, _)); | 640 _, _)); |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 } | 643 } |
| 644 | 644 |
| 645 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) { | 645 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) { |
| 646 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 646 TailCallMode tail_call_modes[] = {TailCallMode::kDisallow, |
| 647 InterpreterAssemblerForTest m(this, bytecode); | 647 TailCallMode::kAllow}; |
| 648 Callable builtin = CodeFactory::InterpreterPushArgsAndCall(isolate()); | 648 TRACED_FOREACH(TailCallMode, tail_call_mode, tail_call_modes) { |
| 649 Node* function = m.Int32Constant(0); | 649 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
| 650 Node* first_arg = m.Int32Constant(1); | 650 InterpreterAssemblerForTest m(this, bytecode); |
| 651 Node* arg_count = m.Int32Constant(2); | 651 Callable builtin = |
| 652 Node* context = | 652 CodeFactory::InterpreterPushArgsAndCall(isolate(), tail_call_mode); |
| 653 m.Parameter(InterpreterDispatchDescriptor::kContextParameter); | 653 Node* function = m.Int32Constant(0); |
| 654 Node* call_js = m.CallJS(function, context, first_arg, arg_count); | 654 Node* first_arg = m.Int32Constant(1); |
| 655 EXPECT_THAT( | 655 Node* arg_count = m.Int32Constant(2); |
| 656 call_js, | 656 Node* context = |
| 657 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, | 657 m.Parameter(InterpreterDispatchDescriptor::kContextParameter); |
| 658 function, | 658 Node* call_js = |
| 659 IsParameter(InterpreterDispatchDescriptor::kContextParameter), _, | 659 m.CallJS(function, context, first_arg, arg_count, tail_call_mode); |
| 660 _)); | 660 EXPECT_THAT( |
| 661 call_js, |
| 662 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, |
| 663 function, |
| 664 IsParameter(InterpreterDispatchDescriptor::kContextParameter), |
| 665 _, _)); |
| 666 } |
| 661 } | 667 } |
| 662 } | 668 } |
| 663 | 669 |
| 664 TARGET_TEST_F(InterpreterAssemblerTest, LoadTypeFeedbackVector) { | 670 TARGET_TEST_F(InterpreterAssemblerTest, LoadTypeFeedbackVector) { |
| 665 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 671 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
| 666 InterpreterAssemblerForTest m(this, bytecode); | 672 InterpreterAssemblerForTest m(this, bytecode); |
| 667 Node* feedback_vector = m.LoadTypeFeedbackVector(); | 673 Node* feedback_vector = m.LoadTypeFeedbackVector(); |
| 668 | 674 |
| 669 Matcher<Node*> load_function_matcher = m.IsLoad( | 675 Matcher<Node*> load_function_matcher = m.IsLoad( |
| 670 MachineType::AnyTagged(), | 676 MachineType::AnyTagged(), |
| 671 IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter), | 677 IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter), |
| 672 IsIntPtrConstant( | 678 IsIntPtrConstant( |
| 673 InterpreterFrameConstants::kFunctionFromRegisterPointer)); | 679 InterpreterFrameConstants::kFunctionFromRegisterPointer)); |
| 674 Matcher<Node*> load_shared_function_info_matcher = | 680 Matcher<Node*> load_shared_function_info_matcher = |
| 675 m.IsLoad(MachineType::AnyTagged(), load_function_matcher, | 681 m.IsLoad(MachineType::AnyTagged(), load_function_matcher, |
| 676 IsIntPtrConstant(JSFunction::kSharedFunctionInfoOffset - | 682 IsIntPtrConstant(JSFunction::kSharedFunctionInfoOffset - |
| 677 kHeapObjectTag)); | 683 kHeapObjectTag)); |
| 678 | 684 |
| 679 EXPECT_THAT( | 685 EXPECT_THAT( |
| 680 feedback_vector, | 686 feedback_vector, |
| 681 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, | 687 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, |
| 682 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - | 688 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - |
| 683 kHeapObjectTag))); | 689 kHeapObjectTag))); |
| 684 } | 690 } |
| 685 } | 691 } |
| 686 | 692 |
| 687 } // namespace interpreter | 693 } // namespace interpreter |
| 688 } // namespace internal | 694 } // namespace internal |
| 689 } // namespace v8 | 695 } // namespace v8 |
| OLD | NEW |