1// Copyright 2020 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#ifndef V8_OBJECTS_JS_SEGMENTER_INL_H_ 5#define V8_OBJECTS_JS_SEGMENTER_INL_H_ 6 7#ifndef V8_INTL_SUPPORT 8#error Internationalization is expected to be enabled. 9#endif // V8_INTL_SUPPORT 10 11#include "src/objects/js-segmenter.h" 12#include "src/objects/objects-inl.h" 13 14// Has to be the last include (doesn't have include guards): 15#include "src/objects/object-macros.h" 16 17namespace v8 { 18namespace internal { 19 20#include "torque-generated/src/objects/js-segmenter-tq-inl.inc" 21 22TQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmenter) 23 24// Base segmenter accessors. 25ACCESSORS(JSSegmenter, icu_break_iterator, Managed<icu::BreakIterator>, 26 kIcuBreakIteratorOffset) 27 28inline void JSSegmenter::set_granularity(Granularity granularity) { 29 DCHECK_GE(GranularityBits::kMax, granularity); 30 int hints = flags(); 31 hints = GranularityBits::update(hints, granularity); 32 set_flags(hints); 33} 34 35inline JSSegmenter::Granularity JSSegmenter::granularity() const { 36 return GranularityBits::decode(flags()); 37} 38 39} // namespace internal 40} // namespace v8 41 42#include "src/objects/object-macros-undef.h" 43 44#endif // V8_OBJECTS_JS_SEGMENTER_INL_H_ 45