blob: 321c72490b05170dd1b91032e47d281d57fa5cff [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:
26 InterpreterAssemblerForTest(InterpreterAssemblerTest* test,
27 Bytecode bytecode)
28 : InterpreterAssembler(test->isolate(), test->zone(), bytecode) {}
29 ~InterpreterAssemblerForTest() override {}
30
31 Matcher<compiler::Node*> IsLoad(
32 const Matcher<compiler::LoadRepresentation>& rep_matcher,
33 const Matcher<compiler::Node*>& base_matcher,
34 const Matcher<compiler::Node*>& index_matcher);
35 Matcher<compiler::Node*> IsStore(
36 const Matcher<compiler::StoreRepresentation>& rep_matcher,
37 const Matcher<compiler::Node*>& base_matcher,
38 const Matcher<compiler::Node*>& index_matcher,
39 const Matcher<compiler::Node*>& value_matcher);
40
41 Matcher<compiler::Node*> IsBytecodeOperand(int offset);
42 Matcher<compiler::Node*> IsBytecodeOperandSignExtended(int offset);
43 Matcher<compiler::Node*> IsBytecodeOperandShort(int offset);
44 Matcher<compiler::Node*> IsBytecodeOperandShortSignExtended(int offset);
45
46 using InterpreterAssembler::graph;
47
48 private:
49 DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest);
50 };
51};
52
53} // namespace interpreter
54} // namespace internal
55} // namespace v8
56
57#endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_