2016-04-07 14:06:55 -07:00
|
|
|
// 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_
|
|
|
|
|
2017-03-21 10:16:54 +01:00
|
|
|
#include "src/compiler/code-assembler.h"
|
2016-04-07 14:06:55 -07:00
|
|
|
#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 {
|
2018-01-24 20:16:06 +01:00
|
|
|
namespace interpreter_assembler_unittest {
|
2016-04-07 14:06:55 -07:00
|
|
|
|
|
|
|
using ::testing::Matcher;
|
|
|
|
|
2017-03-21 10:16:54 +01:00
|
|
|
class InterpreterAssemblerTest;
|
|
|
|
|
|
|
|
class InterpreterAssemblerTestState : public compiler::CodeAssemblerState {
|
|
|
|
public:
|
|
|
|
InterpreterAssemblerTestState(InterpreterAssemblerTest* test,
|
|
|
|
Bytecode bytecode);
|
|
|
|
};
|
|
|
|
|
2016-04-07 14:06:55 -07:00
|
|
|
class InterpreterAssemblerTest : public TestWithIsolateAndZone {
|
|
|
|
public:
|
2020-10-15 20:17:08 +02:00
|
|
|
InterpreterAssemblerTest() : TestWithIsolateAndZone(kCompressGraphZone) {}
|
2018-12-04 08:20:37 +01:00
|
|
|
~InterpreterAssemblerTest() override = default;
|
2016-04-07 14:06:55 -07:00
|
|
|
|
|
|
|
class InterpreterAssemblerForTest final : public InterpreterAssembler {
|
|
|
|
public:
|
2016-05-27 16:37:42 +02:00
|
|
|
InterpreterAssemblerForTest(
|
2017-03-21 10:16:54 +01:00
|
|
|
InterpreterAssemblerTestState* state, Bytecode bytecode,
|
2016-05-27 16:37:42 +02:00
|
|
|
OperandScale operand_scale = OperandScale::kSingle)
|
2017-03-21 10:16:54 +01:00
|
|
|
: InterpreterAssembler(state, bytecode, operand_scale) {}
|
|
|
|
~InterpreterAssemblerForTest();
|
2021-02-11 19:03:35 +01:00
|
|
|
InterpreterAssemblerForTest(const InterpreterAssemblerForTest&) = delete;
|
|
|
|
InterpreterAssemblerForTest& operator=(const InterpreterAssemblerForTest&) =
|
|
|
|
delete;
|
2016-04-07 14:06:55 -07:00
|
|
|
|
|
|
|
Matcher<compiler::Node*> IsLoad(
|
|
|
|
const Matcher<compiler::LoadRepresentation>& rep_matcher,
|
|
|
|
const Matcher<compiler::Node*>& base_matcher,
|
2021-10-10 11:10:43 +02:00
|
|
|
const Matcher<compiler::Node*>& index_matcher);
|
2019-08-16 11:32:46 +02:00
|
|
|
Matcher<compiler::Node*> IsLoadFromObject(
|
|
|
|
const Matcher<compiler::LoadRepresentation>& rep_matcher,
|
|
|
|
const Matcher<compiler::Node*>& base_matcher,
|
|
|
|
const Matcher<compiler::Node*>& index_matcher);
|
2016-04-07 14:06:55 -07:00
|
|
|
Matcher<compiler::Node*> IsStore(
|
|
|
|
const Matcher<compiler::StoreRepresentation>& rep_matcher,
|
|
|
|
const Matcher<compiler::Node*>& base_matcher,
|
|
|
|
const Matcher<compiler::Node*>& index_matcher,
|
|
|
|
const Matcher<compiler::Node*>& value_matcher);
|
|
|
|
|
2021-06-08 14:04:59 +02:00
|
|
|
Matcher<compiler::Node*> IsWordNot(
|
|
|
|
const Matcher<compiler::Node*>& value_matcher);
|
2018-04-10 21:39:51 -04:00
|
|
|
|
2021-10-10 11:10:43 +02:00
|
|
|
Matcher<compiler::Node*> IsUnsignedByteOperand(int offset);
|
|
|
|
Matcher<compiler::Node*> IsSignedByteOperand(int offset);
|
|
|
|
Matcher<compiler::Node*> IsUnsignedShortOperand(int offset);
|
|
|
|
Matcher<compiler::Node*> IsSignedShortOperand(int offset);
|
|
|
|
Matcher<compiler::Node*> IsUnsignedQuadOperand(int offset);
|
|
|
|
Matcher<compiler::Node*> IsSignedQuadOperand(int offset);
|
2018-04-10 21:39:51 -04:00
|
|
|
|
2016-05-27 16:37:42 +02:00
|
|
|
Matcher<compiler::Node*> IsSignedOperand(int offset,
|
2021-10-10 11:10:43 +02:00
|
|
|
OperandSize operand_size);
|
2016-05-27 16:37:42 +02:00
|
|
|
Matcher<compiler::Node*> IsUnsignedOperand(int offset,
|
2021-10-10 11:10:43 +02:00
|
|
|
OperandSize operand_size);
|
2016-04-07 14:06:55 -07:00
|
|
|
|
2018-04-10 21:39:51 -04:00
|
|
|
Matcher<compiler::Node*> IsLoadRegisterOperand(int offset,
|
|
|
|
OperandSize operand_size);
|
2016-04-07 14:06:55 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-01-24 20:16:06 +01:00
|
|
|
} // namespace interpreter_assembler_unittest
|
2016-04-07 14:06:55 -07:00
|
|
|
} // namespace interpreter
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_
|