2016-02-10 16:38:49 +00: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_
|
|
|
|
|
2016-11-16 11:48:07 +00:00
|
|
|
#include "src/compiler/code-assembler.h"
|
2016-02-10 16:38:49 +00: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 {
|
2017-10-18 17:01:45 +00:00
|
|
|
namespace interpreter_assembler_unittest {
|
2016-02-10 16:38:49 +00:00
|
|
|
|
|
|
|
using ::testing::Matcher;
|
|
|
|
|
2016-11-16 11:48:07 +00:00
|
|
|
class InterpreterAssemblerTest;
|
|
|
|
|
|
|
|
class InterpreterAssemblerTestState : public compiler::CodeAssemblerState {
|
|
|
|
public:
|
|
|
|
InterpreterAssemblerTestState(InterpreterAssemblerTest* test,
|
|
|
|
Bytecode bytecode);
|
|
|
|
};
|
|
|
|
|
2016-02-10 16:38:49 +00:00
|
|
|
class InterpreterAssemblerTest : public TestWithIsolateAndZone {
|
|
|
|
public:
|
2018-09-13 09:22:50 +00:00
|
|
|
InterpreterAssemblerTest() = default;
|
|
|
|
~InterpreterAssemblerTest() override = default;
|
2016-02-10 16:38:49 +00:00
|
|
|
|
|
|
|
class InterpreterAssemblerForTest final : public InterpreterAssembler {
|
|
|
|
public:
|
2016-03-21 17:08:21 +00:00
|
|
|
InterpreterAssemblerForTest(
|
2016-11-16 11:48:07 +00:00
|
|
|
InterpreterAssemblerTestState* state, Bytecode bytecode,
|
2016-03-21 17:08:21 +00:00
|
|
|
OperandScale operand_scale = OperandScale::kSingle)
|
2016-11-16 11:48:07 +00:00
|
|
|
: InterpreterAssembler(state, bytecode, operand_scale) {}
|
2016-12-28 15:47:34 +00:00
|
|
|
~InterpreterAssemblerForTest();
|
2016-02-10 16:38:49 +00:00
|
|
|
|
|
|
|
Matcher<compiler::Node*> IsLoad(
|
|
|
|
const Matcher<compiler::LoadRepresentation>& rep_matcher,
|
|
|
|
const Matcher<compiler::Node*>& base_matcher,
|
2018-03-26 15:44:44 +00:00
|
|
|
const Matcher<compiler::Node*>& index_matcher,
|
|
|
|
LoadSensitivity needs_poisoning = LoadSensitivity::kSafe);
|
2016-02-10 16:38:49 +00: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);
|
|
|
|
|
2018-01-29 12:16:32 +00:00
|
|
|
Matcher<Node*> IsWordNot(const Matcher<Node*>& value_matcher);
|
|
|
|
|
2018-03-26 15:44:44 +00:00
|
|
|
Matcher<compiler::Node*> IsUnsignedByteOperand(
|
|
|
|
int offset, LoadSensitivity needs_poisoning);
|
|
|
|
Matcher<compiler::Node*> IsSignedByteOperand(
|
|
|
|
int offset, LoadSensitivity needs_poisoning);
|
|
|
|
Matcher<compiler::Node*> IsUnsignedShortOperand(
|
|
|
|
int offset, LoadSensitivity needs_poisoning);
|
|
|
|
Matcher<compiler::Node*> IsSignedShortOperand(
|
|
|
|
int offset, LoadSensitivity needs_poisoning);
|
|
|
|
Matcher<compiler::Node*> IsUnsignedQuadOperand(
|
|
|
|
int offset, LoadSensitivity needs_poisoning);
|
|
|
|
Matcher<compiler::Node*> IsSignedQuadOperand(
|
|
|
|
int offset, LoadSensitivity needs_poisoning);
|
2016-03-21 17:08:21 +00:00
|
|
|
|
2018-01-29 12:16:32 +00:00
|
|
|
Matcher<compiler::Node*> IsUnpoisonedSignedOperand(
|
2018-03-26 15:44:44 +00:00
|
|
|
int offset, OperandSize operand_size, LoadSensitivity needs_poisoning);
|
2018-01-29 12:16:32 +00:00
|
|
|
Matcher<compiler::Node*> IsUnpoisonedUnsignedOperand(
|
2018-03-26 15:44:44 +00:00
|
|
|
int offset, OperandSize operand_size, LoadSensitivity needs_poisoning);
|
2018-01-29 12:16:32 +00:00
|
|
|
|
2016-03-21 17:08:21 +00:00
|
|
|
Matcher<compiler::Node*> IsSignedOperand(int offset,
|
2018-03-26 15:44:44 +00:00
|
|
|
OperandSize operand_size,
|
|
|
|
LoadSensitivity needs_poisoning);
|
2016-03-21 17:08:21 +00:00
|
|
|
Matcher<compiler::Node*> IsUnsignedOperand(int offset,
|
2018-03-26 15:44:44 +00:00
|
|
|
OperandSize operand_size,
|
|
|
|
LoadSensitivity needs_poisoning);
|
2016-02-10 16:38:49 +00:00
|
|
|
|
2018-01-29 12:16:32 +00:00
|
|
|
Matcher<compiler::Node*> IsLoadRegisterOperand(int offset,
|
|
|
|
OperandSize operand_size);
|
|
|
|
|
2016-02-10 16:38:49 +00:00
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-10-18 17:01:45 +00:00
|
|
|
} // namespace interpreter_assembler_unittest
|
2016-02-10 16:38:49 +00:00
|
|
|
} // namespace interpreter
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_
|