summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/write-barrier-kind.h
blob: 1f38049f2d7121bea23f2beb7420e1a5064a74f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2019 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_COMPILER_WRITE_BARRIER_KIND_H_
#define V8_COMPILER_WRITE_BARRIER_KIND_H_

#include <ostream>

#include "src/base/logging.h"

namespace v8 {
namespace internal {
namespace compiler {

// Write barrier kinds supported by compiler.
enum WriteBarrierKind : uint8_t {
  kNoWriteBarrier,
  kAssertNoWriteBarrier,
  kMapWriteBarrier,
  kPointerWriteBarrier,
  kEphemeronKeyWriteBarrier,
  kFullWriteBarrier
};

inline size_t hash_value(WriteBarrierKind kind) {
  return static_cast<uint8_t>(kind);
}

inline std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) {
  switch (kind) {
    case kNoWriteBarrier:
      return os << "NoWriteBarrier";
    case kAssertNoWriteBarrier:
      return os << "AssertNoWriteBarrier";
    case kMapWriteBarrier:
      return os << "MapWriteBarrier";
    case kPointerWriteBarrier:
      return os << "PointerWriteBarrier";
    case kEphemeronKeyWriteBarrier:
      return os << "EphemeronKeyWriteBarrier";
    case kFullWriteBarrier:
      return os << "FullWriteBarrier";
  }
  UNREACHABLE();
}

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_WRITE_BARRIER_KIND_H_