write-barrier-kind.h 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// 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,
19
  kAssertNoWriteBarrier,
20 21 22 23 24 25 26 27 28 29 30 31 32 33
  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";
34 35
    case kAssertNoWriteBarrier:
      return os << "AssertNoWriteBarrier";
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    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_