| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 343           break; | 343           break; | 
| 344         case interpreter::OperandType::kIdx8: | 344         case interpreter::OperandType::kIdx8: | 
| 345           EXPECT_THAT(m.BytecodeOperandIdx(i), m.IsBytecodeOperand(offset)); | 345           EXPECT_THAT(m.BytecodeOperandIdx(i), m.IsBytecodeOperand(offset)); | 
| 346           break; | 346           break; | 
| 347         case interpreter::OperandType::kImm8: | 347         case interpreter::OperandType::kImm8: | 
| 348           EXPECT_THAT(m.BytecodeOperandImm(i), | 348           EXPECT_THAT(m.BytecodeOperandImm(i), | 
| 349                       m.IsBytecodeOperandSignExtended(offset)); | 349                       m.IsBytecodeOperandSignExtended(offset)); | 
| 350           break; | 350           break; | 
| 351         case interpreter::OperandType::kMaybeReg8: | 351         case interpreter::OperandType::kMaybeReg8: | 
| 352         case interpreter::OperandType::kReg8: | 352         case interpreter::OperandType::kReg8: | 
|  | 353         case interpreter::OperandType::kRegPair8: | 
| 353           EXPECT_THAT(m.BytecodeOperandReg(i), | 354           EXPECT_THAT(m.BytecodeOperandReg(i), | 
| 354                       m.IsBytecodeOperandSignExtended(offset)); | 355                       m.IsBytecodeOperandSignExtended(offset)); | 
| 355           break; | 356           break; | 
| 356         case interpreter::OperandType::kCount16: | 357         case interpreter::OperandType::kCount16: | 
| 357           EXPECT_THAT(m.BytecodeOperandCount(i), | 358           EXPECT_THAT(m.BytecodeOperandCount(i), | 
| 358                       m.IsBytecodeOperandShort(offset)); | 359                       m.IsBytecodeOperandShort(offset)); | 
| 359           break; | 360           break; | 
| 360         case interpreter::OperandType::kIdx16: | 361         case interpreter::OperandType::kIdx16: | 
| 361           EXPECT_THAT(m.BytecodeOperandIdx(i), | 362           EXPECT_THAT(m.BytecodeOperandIdx(i), | 
| 362                       m.IsBytecodeOperandShort(offset)); | 363                       m.IsBytecodeOperandShort(offset)); | 
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 585     Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2); | 586     Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2); | 
| 586     EXPECT_THAT( | 587     EXPECT_THAT( | 
| 587         call_runtime, | 588         call_runtime, | 
| 588         IsCall(_, _, arg1, arg2, _, IsInt32Constant(2), | 589         IsCall(_, _, arg1, arg2, _, IsInt32Constant(2), | 
| 589                IsParameter(Linkage::kInterpreterContextParameter), _, _)); | 590                IsParameter(Linkage::kInterpreterContextParameter), _, _)); | 
| 590   } | 591   } | 
| 591 } | 592 } | 
| 592 | 593 | 
| 593 | 594 | 
| 594 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) { | 595 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) { | 
|  | 596   const int kResultSizes[] = {1, 2}; | 
| 595   TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 597   TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 
| 596     InterpreterAssemblerForTest m(this, bytecode); | 598     TRACED_FOREACH(int, result_size, kResultSizes) { | 
| 597     Callable builtin = CodeFactory::InterpreterCEntry(isolate()); | 599       InterpreterAssemblerForTest m(this, bytecode); | 
|  | 600       Callable builtin = CodeFactory::InterpreterCEntry(isolate(), result_size); | 
| 598 | 601 | 
| 599     Node* function_id = m.Int32Constant(0); | 602       Node* function_id = m.Int32Constant(0); | 
| 600     Node* first_arg = m.Int32Constant(1); | 603       Node* first_arg = m.Int32Constant(1); | 
| 601     Node* arg_count = m.Int32Constant(2); | 604       Node* arg_count = m.Int32Constant(2); | 
| 602 | 605 | 
| 603     Matcher<Node*> function_table = IsExternalConstant( | 606       Matcher<Node*> function_table = IsExternalConstant( | 
| 604         ExternalReference::runtime_function_table_address(isolate())); | 607           ExternalReference::runtime_function_table_address(isolate())); | 
| 605     Matcher<Node*> function = IsIntPtrAdd( | 608       Matcher<Node*> function = IsIntPtrAdd( | 
| 606         function_table, | 609           function_table, | 
| 607         IsInt32Mul(function_id, IsInt32Constant(sizeof(Runtime::Function)))); | 610           IsInt32Mul(function_id, IsInt32Constant(sizeof(Runtime::Function)))); | 
| 608     Matcher<Node*> function_entry = | 611       Matcher<Node*> function_entry = | 
| 609         m.IsLoad(MachineType::Pointer(), function, | 612           m.IsLoad(MachineType::Pointer(), function, | 
| 610                  IsInt32Constant(offsetof(Runtime::Function, entry))); | 613                    IsInt32Constant(offsetof(Runtime::Function, entry))); | 
| 611 | 614 | 
| 612     Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count); | 615       Node* call_runtime = | 
| 613     EXPECT_THAT( | 616           m.CallRuntime(function_id, first_arg, arg_count, result_size); | 
| 614         call_runtime, | 617       EXPECT_THAT( | 
| 615         IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, | 618           call_runtime, | 
| 616                function_entry, | 619           IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, | 
| 617                IsParameter(Linkage::kInterpreterContextParameter), _, _)); | 620                  function_entry, | 
|  | 621                  IsParameter(Linkage::kInterpreterContextParameter), _, _)); | 
|  | 622     } | 
| 618   } | 623   } | 
| 619 } | 624 } | 
| 620 | 625 | 
| 621 | 626 | 
| 622 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { | 627 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { | 
| 623   TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 628   TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 
| 624     InterpreterAssemblerForTest m(this, bytecode); | 629     InterpreterAssemblerForTest m(this, bytecode); | 
| 625     LoadWithVectorDescriptor descriptor(isolate()); | 630     LoadWithVectorDescriptor descriptor(isolate()); | 
| 626     Node* target = m.Int32Constant(1); | 631     Node* target = m.Int32Constant(1); | 
| 627     Node* arg1 = m.Int32Constant(2); | 632     Node* arg1 = m.Int32Constant(2); | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 673         feedback_vector, | 678         feedback_vector, | 
| 674         m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, | 679         m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, | 
| 675                  IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - | 680                  IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - | 
| 676                                   kHeapObjectTag))); | 681                                   kHeapObjectTag))); | 
| 677   } | 682   } | 
| 678 } | 683 } | 
| 679 | 684 | 
| 680 }  // namespace compiler | 685 }  // namespace compiler | 
| 681 }  // namespace internal | 686 }  // namespace internal | 
| 682 }  // namespace v8 | 687 }  // namespace v8 | 
| OLD | NEW | 
|---|