v8/test/unittests/interpreter/interpreter-assembler-unittest.h
Tobias Tebbi 1ef6c4374e [turbofan] unify interpreter and JIT speculation poisoning
This CL changes the poisoning in the interpreter to use the
infrastructure used in the JIT.

This does not change the original flag semantics:

--branch-load-poisoning enables JIT mitigations as before.

--untrusted-code-mitigation enables the interpreter mitigations
  (now realized using the compiler back-end), but does not enable
  the back-end based mitigations for the Javascript JIT. So in effect
  --untrusted-code-mitigation makes the CSA pipeline for bytecode handlers
  use the same mechanics (including changed register allocation) that
  --branch-load-poisoning enables for the JIT.

Bug: chromium:798964
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: If7f6852ae44e32e6e0ad508e9237f24dec7e5b27
Reviewed-on: https://chromium-review.googlesource.com/928881
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52243}
2018-03-27 12:55:28 +00:00

94 lines
3.6 KiB
C++

// 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() {}
~InterpreterAssemblerTest() override {}
class InterpreterAssemblerForTest final : public InterpreterAssembler {
public:
InterpreterAssemblerForTest(
InterpreterAssemblerTestState* state, Bytecode bytecode,
OperandScale operand_scale = OperandScale::kSingle)
: InterpreterAssembler(state, bytecode, operand_scale) {}
~InterpreterAssemblerForTest();
Matcher<compiler::Node*> IsLoad(
const Matcher<compiler::LoadRepresentation>& rep_matcher,
const Matcher<compiler::Node*>& base_matcher,
const Matcher<compiler::Node*>& index_matcher,
LoadSensitivity needs_poisoning = LoadSensitivity::kSafe);
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);
Matcher<Node*> IsWordNot(const Matcher<Node*>& value_matcher);
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);
Matcher<compiler::Node*> IsUnpoisonedSignedOperand(
int offset, OperandSize operand_size, LoadSensitivity needs_poisoning);
Matcher<compiler::Node*> IsUnpoisonedUnsignedOperand(
int offset, OperandSize operand_size, LoadSensitivity needs_poisoning);
Matcher<compiler::Node*> IsSignedOperand(int offset,
OperandSize operand_size,
LoadSensitivity needs_poisoning);
Matcher<compiler::Node*> IsUnsignedOperand(int offset,
OperandSize operand_size,
LoadSensitivity needs_poisoning);
Matcher<compiler::Node*> IsLoadRegisterOperand(int offset,
OperandSize operand_size);
private:
DISALLOW_COPY_AND_ASSIGN(InterpreterAssemblerForTest);
};
};
} // namespace interpreter_assembler_unittest
} // namespace interpreter
} // namespace internal
} // namespace v8
#endif // V8_UNITTESTS_INTERPRETER_INTERPRETER_ASSEMBLER_UNITTEST_H_