11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_COMPILER_WRITE_BARRIER_KIND_H_ 61cb0ef41Sopenharmony_ci#define V8_COMPILER_WRITE_BARRIER_KIND_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <ostream> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#include "src/base/logging.h" 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cinamespace v8 { 131cb0ef41Sopenharmony_cinamespace internal { 141cb0ef41Sopenharmony_cinamespace compiler { 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci// Write barrier kinds supported by compiler. 171cb0ef41Sopenharmony_cienum WriteBarrierKind : uint8_t { 181cb0ef41Sopenharmony_ci kNoWriteBarrier, 191cb0ef41Sopenharmony_ci kAssertNoWriteBarrier, 201cb0ef41Sopenharmony_ci kMapWriteBarrier, 211cb0ef41Sopenharmony_ci kPointerWriteBarrier, 221cb0ef41Sopenharmony_ci kEphemeronKeyWriteBarrier, 231cb0ef41Sopenharmony_ci kFullWriteBarrier 241cb0ef41Sopenharmony_ci}; 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ciinline size_t hash_value(WriteBarrierKind kind) { 271cb0ef41Sopenharmony_ci return static_cast<uint8_t>(kind); 281cb0ef41Sopenharmony_ci} 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ciinline std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) { 311cb0ef41Sopenharmony_ci switch (kind) { 321cb0ef41Sopenharmony_ci case kNoWriteBarrier: 331cb0ef41Sopenharmony_ci return os << "NoWriteBarrier"; 341cb0ef41Sopenharmony_ci case kAssertNoWriteBarrier: 351cb0ef41Sopenharmony_ci return os << "AssertNoWriteBarrier"; 361cb0ef41Sopenharmony_ci case kMapWriteBarrier: 371cb0ef41Sopenharmony_ci return os << "MapWriteBarrier"; 381cb0ef41Sopenharmony_ci case kPointerWriteBarrier: 391cb0ef41Sopenharmony_ci return os << "PointerWriteBarrier"; 401cb0ef41Sopenharmony_ci case kEphemeronKeyWriteBarrier: 411cb0ef41Sopenharmony_ci return os << "EphemeronKeyWriteBarrier"; 421cb0ef41Sopenharmony_ci case kFullWriteBarrier: 431cb0ef41Sopenharmony_ci return os << "FullWriteBarrier"; 441cb0ef41Sopenharmony_ci } 451cb0ef41Sopenharmony_ci UNREACHABLE(); 461cb0ef41Sopenharmony_ci} 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci} // namespace compiler 491cb0ef41Sopenharmony_ci} // namespace internal 501cb0ef41Sopenharmony_ci} // namespace v8 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci#endif // V8_COMPILER_WRITE_BARRIER_KIND_H_ 53