// Copyright 2015 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ #define V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_ #include "src/compiler/code-assembler.h" #include "src/compiler/machine-operator.h" #include "src/interpreter/interpreter-assembler.h" #include "test/unittests/test-utils.h" #include "testing/gmock-support.h" namespace v8 { namespace internal { namespace interpreter { namespace interpreter_assembler_unittest { using ::testing::Matcher; class InterpreterAssemblerTest; class InterpreterAssemblerTestState : public compiler::CodeAssemblerState { public: InterpreterAssemblerTestState(InterpreterAssemblerTest* test, Bytecode bytecode); }; class InterpreterAssemblerTest : public TestWithIsolateAndZone { public: InterpreterAssemblerTest() : TestWithIsolateAndZone(kCompressGraphZone) {} ~InterpreterAssemblerTest() override = default; class InterpreterAssemblerForTest final : public InterpreterAssembler { public: InterpreterAssemblerForTest( InterpreterAssemblerTestState* state, Bytecode bytecode, OperandScale operand_scale = OperandScale::kSingle) : InterpreterAssembler(state, bytecode, operand_scale) {} ~InterpreterAssemblerForTest(); InterpreterAssemblerForTest(const InterpreterAssemblerForTest&) = delete; InterpreterAssemblerForTest& operator=(const InterpreterAssemblerForTest&) = delete; Matcher IsLoad( const Matcher& rep_matcher, const Matcher& base_matcher, const Matcher& index_matcher); Matcher IsLoadFromObject( const Matcher& rep_matcher, const Matcher& base_matcher, const Matcher& index_matcher); Matcher IsStore( const Matcher& rep_matcher, const Matcher& base_matcher, const Matcher& index_matcher, const Matcher& value_matcher); Matcher IsWordNot( const Matcher& value_matcher); Matcher IsUnsignedByteOperand(int offset); Matcher IsSignedByteOperand(int offset); Matcher IsUnsignedShortOperand(int offset); Matcher IsSignedShortOperand(int offset); Matcher IsUnsignedQuadOperand(int offset); Matcher IsSignedQuadOperand(int offset); Matcher IsSignedOperand(int offset, OperandSize operand_size); Matcher IsUnsignedOperand(int offset, OperandSize operand_size); Matcher IsLoadRegisterOperand(int offset, OperandSize operand_size); }; }; } // namespace interpreter_assembler_unittest } // namespace interpreter } // namespace internal } // namespace v8 #endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_