blob: 1ebdc77c180c5a66c0003f3fdff8aeae0c194fd8 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001// 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
3// found in the LICENSE file.
4
5#ifndef V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_
6#define V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_
7
8#include "src/compiler/machine-operator.h"
9#include "src/interpreter/interpreter-assembler.h"
10#include "test/unittests/test-utils.h"
11#include "testing/gmock-support.h"
12
13namespace v8 {
14namespace internal {
15namespace interpreter {
16
17using ::testing::Matcher;
18
19class InterpreterAssemblerTest : public TestWithIsolateAndZone {
20 public:
21 InterpreterAssemblerTest() {}
22 ~InterpreterAssemblerTest() override {}
23
24 class InterpreterAssemblerForTest final : public InterpreterAssembler {
25 public:
Ben Murdochda12d292016-06-02 14:46:10 +010026 InterpreterAssemblerForTest(
27 InterpreterAssemblerTest* test, Bytecode bytecode,
28 OperandScale operand_scale = OperandScale::kSingle)
29 : InterpreterAssembler(test->isolate(), test->zone(), bytecode,
30 operand_scale) {}
31 ~InterpreterAssemblerForTest() override;
Ben Murdoch097c5b22016-05-18 11:27:45 +010032
33 Matcher<compiler::Node*> IsLoad(
34 const Matcher<compiler::LoadRepresentation>& rep_matcher,
35 const Matcher<compiler::Node*>& base_matcher,
36 const Matcher<compiler::Node*>& index_matcher);
37 Matcher<compiler::Node*> IsStore(
38 const Matcher<compiler::StoreRepresentation>& rep_matcher,
39 const Matcher<compiler::Node*>& base_matcher,
40 const Matcher<compiler::Node*>& index_matcher,
41 const Matcher<compiler::Node*>& value_matcher);
42
Ben Murdochda12d292016-06-02 14:46:10 +010043 Matcher<compiler::Node*> IsUnsignedByteOperand(int offset);
44 Matcher<compiler::Node*> IsSignedByteOperand(int offset);
45 Matcher<compiler::Node*> IsUnsignedShortOperand(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);
Ben Murdoch097c5b22016-05-18 11:27:45 +010054
55 using InterpreterAssembler::graph;
56
57 private:
58 DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest);
59 };
60};
61
62} // namespace interpreter
63} // namespace internal
64} // namespace v8
65
66#endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_