1 // Copyright 2019 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_COMPILER_WRITE_BARRIER_KIND_H_ 6 #define V8_COMPILER_WRITE_BARRIER_KIND_H_ 7 8 #include <ostream> 9 10 #include "src/base/logging.h" 11 12 namespace v8 { 13 namespace internal { 14 namespace compiler { 15 16 // Write barrier kinds supported by compiler. 17 enum WriteBarrierKind : uint8_t { 18 kNoWriteBarrier, 19 kAssertNoWriteBarrier, 20 kMapWriteBarrier, 21 kPointerWriteBarrier, 22 kEphemeronKeyWriteBarrier, 23 kFullWriteBarrier 24 }; 25 hash_value(WriteBarrierKind kind)26inline size_t hash_value(WriteBarrierKind kind) { 27 return static_cast<uint8_t>(kind); 28 } 29 30 inline std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) { 31 switch (kind) { 32 case kNoWriteBarrier: 33 return os << "NoWriteBarrier"; 34 case kAssertNoWriteBarrier: 35 return os << "AssertNoWriteBarrier"; 36 case kMapWriteBarrier: 37 return os << "MapWriteBarrier"; 38 case kPointerWriteBarrier: 39 return os << "PointerWriteBarrier"; 40 case kEphemeronKeyWriteBarrier: 41 return os << "EphemeronKeyWriteBarrier"; 42 case kFullWriteBarrier: 43 return os << "FullWriteBarrier"; 44 } 45 UNREACHABLE(); 46 } 47 48 } // namespace compiler 49 } // namespace internal 50 } // namespace v8 51 52 #endif // V8_COMPILER_WRITE_BARRIER_KIND_H_ 53