| 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 #ifndef V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ | 5 #ifndef V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ |
| 6 #define V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ | 6 #define V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ |
| 7 | 7 |
| 8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
| 9 #include "src/interpreter/interpreter-assembler.h" | 9 #include "src/interpreter/interpreter-assembler.h" |
| 10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
| 11 #include "testing/gmock-support.h" | 11 #include "testing/gmock-support.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 namespace interpreter { | 15 namespace interpreter { |
| 16 | 16 |
| 17 using ::testing::Matcher; | 17 using ::testing::Matcher; |
| 18 | 18 |
| 19 class InterpreterAssemblerTest : public TestWithIsolateAndZone { | 19 class InterpreterAssemblerTest : public TestWithIsolateAndZone { |
| 20 public: | 20 public: |
| 21 InterpreterAssemblerTest() {} | 21 InterpreterAssemblerTest() {} |
| 22 ~InterpreterAssemblerTest() override {} | 22 ~InterpreterAssemblerTest() override {} |
| 23 | 23 |
| 24 class InterpreterAssemblerForTest final : public InterpreterAssembler { | 24 class InterpreterAssemblerForTest final : public InterpreterAssembler { |
| 25 public: | 25 public: |
| 26 InterpreterAssemblerForTest(InterpreterAssemblerTest* test, | 26 InterpreterAssemblerForTest( |
| 27 Bytecode bytecode) | 27 InterpreterAssemblerTest* test, Bytecode bytecode, |
| 28 : InterpreterAssembler(test->isolate(), test->zone(), bytecode) {} | 28 OperandScale operand_scale = OperandScale::kSingle) |
| 29 : InterpreterAssembler(test->isolate(), test->zone(), bytecode, |
| 30 operand_scale) {} |
| 29 ~InterpreterAssemblerForTest() override {} | 31 ~InterpreterAssemblerForTest() override {} |
| 30 | 32 |
| 31 Matcher<compiler::Node*> IsLoad( | 33 Matcher<compiler::Node*> IsLoad( |
| 32 const Matcher<compiler::LoadRepresentation>& rep_matcher, | 34 const Matcher<compiler::LoadRepresentation>& rep_matcher, |
| 33 const Matcher<compiler::Node*>& base_matcher, | 35 const Matcher<compiler::Node*>& base_matcher, |
| 34 const Matcher<compiler::Node*>& index_matcher); | 36 const Matcher<compiler::Node*>& index_matcher); |
| 35 Matcher<compiler::Node*> IsStore( | 37 Matcher<compiler::Node*> IsStore( |
| 36 const Matcher<compiler::StoreRepresentation>& rep_matcher, | 38 const Matcher<compiler::StoreRepresentation>& rep_matcher, |
| 37 const Matcher<compiler::Node*>& base_matcher, | 39 const Matcher<compiler::Node*>& base_matcher, |
| 38 const Matcher<compiler::Node*>& index_matcher, | 40 const Matcher<compiler::Node*>& index_matcher, |
| 39 const Matcher<compiler::Node*>& value_matcher); | 41 const Matcher<compiler::Node*>& value_matcher); |
| 40 | 42 |
| 41 Matcher<compiler::Node*> IsBytecodeOperand(int offset); | 43 Matcher<compiler::Node*> IsUnsignedByteOperand(int offset); |
| 42 Matcher<compiler::Node*> IsBytecodeOperandSignExtended(int offset); | 44 Matcher<compiler::Node*> IsSignedByteOperand(int offset); |
| 43 Matcher<compiler::Node*> IsBytecodeOperandShort(int offset); | 45 Matcher<compiler::Node*> IsUnsignedShortOperand(int offset); |
| 44 Matcher<compiler::Node*> IsBytecodeOperandShortSignExtended(int offset); | 46 Matcher<compiler::Node*> IsSignedShortOperand(int offset); |
| 47 Matcher<compiler::Node*> IsUnsignedQuadOperand(int offset); |
| 48 Matcher<compiler::Node*> IsSignedQuadOperand(int offset); |
| 49 |
| 50 Matcher<compiler::Node*> IsSignedOperand(int offset, |
| 51 OperandSize operand_size); |
| 52 Matcher<compiler::Node*> IsUnsignedOperand(int offset, |
| 53 OperandSize operand_size); |
| 45 | 54 |
| 46 using InterpreterAssembler::graph; | 55 using InterpreterAssembler::graph; |
| 47 | 56 |
| 48 private: | 57 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest); | 58 DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest); |
| 50 }; | 59 }; |
| 51 }; | 60 }; |
| 52 | 61 |
| 53 } // namespace interpreter | 62 } // namespace interpreter |
| 54 } // namespace internal | 63 } // namespace internal |
| 55 } // namespace v8 | 64 } // namespace v8 |
| 56 | 65 |
| 57 #endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ | 66 #endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ |
| OLD | NEW |