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/compiler/interpreter-assembler-unittest.h" | 5 #include "test/unittests/compiler/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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count); | 612 Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count); |
613 EXPECT_THAT( | 613 EXPECT_THAT( |
614 call_runtime, | 614 call_runtime, |
615 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, | 615 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, |
616 function_entry, | 616 function_entry, |
617 IsParameter(Linkage::kInterpreterContextParameter), _, _)); | 617 IsParameter(Linkage::kInterpreterContextParameter), _, _)); |
618 } | 618 } |
619 } | 619 } |
620 | 620 |
621 | 621 |
| 622 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntimePair) { |
| 623 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
| 624 InterpreterAssemblerForTest m(this, bytecode); |
| 625 Callable builtin = CodeFactory::InterpreterCEntryPair(isolate()); |
| 626 |
| 627 Node* function_id = m.Int32Constant(0); |
| 628 Node* first_arg = m.Int32Constant(1); |
| 629 Node* arg_count = m.Int32Constant(2); |
| 630 |
| 631 Matcher<Node*> function_table = IsExternalConstant( |
| 632 ExternalReference::runtime_function_table_address(isolate())); |
| 633 Matcher<Node*> function = IsIntPtrAdd( |
| 634 function_table, |
| 635 IsInt32Mul(function_id, IsInt32Constant(sizeof(Runtime::Function)))); |
| 636 Matcher<Node*> function_entry = |
| 637 m.IsLoad(MachineType::Pointer(), function, |
| 638 IsInt32Constant(offsetof(Runtime::Function, entry))); |
| 639 |
| 640 Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count); |
| 641 EXPECT_THAT( |
| 642 call_runtime, |
| 643 IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, |
| 644 function_entry, |
| 645 IsParameter(Linkage::kInterpreterContextParameter), _, _)); |
| 646 } |
| 647 } |
| 648 |
| 649 |
622 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { | 650 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { |
623 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 651 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
624 InterpreterAssemblerForTest m(this, bytecode); | 652 InterpreterAssemblerForTest m(this, bytecode); |
625 LoadWithVectorDescriptor descriptor(isolate()); | 653 LoadWithVectorDescriptor descriptor(isolate()); |
626 Node* target = m.Int32Constant(1); | 654 Node* target = m.Int32Constant(1); |
627 Node* arg1 = m.Int32Constant(2); | 655 Node* arg1 = m.Int32Constant(2); |
628 Node* arg2 = m.Int32Constant(3); | 656 Node* arg2 = m.Int32Constant(3); |
629 Node* arg3 = m.Int32Constant(4); | 657 Node* arg3 = m.Int32Constant(4); |
630 Node* arg4 = m.Int32Constant(5); | 658 Node* arg4 = m.Int32Constant(5); |
631 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); | 659 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 feedback_vector, | 701 feedback_vector, |
674 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, | 702 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, |
675 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - | 703 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - |
676 kHeapObjectTag))); | 704 kHeapObjectTag))); |
677 } | 705 } |
678 } | 706 } |
679 | 707 |
680 } // namespace compiler | 708 } // namespace compiler |
681 } // namespace internal | 709 } // namespace internal |
682 } // namespace v8 | 710 } // namespace v8 |
OLD | NEW |