• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SEGMENT_ITERATOR_INL_H_
5 #define V8_OBJECTS_JS_SEGMENT_ITERATOR_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-segment-iterator.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 
17 namespace v8 {
18 namespace internal {
19 
20 #include "torque-generated/src/objects/js-segment-iterator-tq-inl.inc"
21 
22 TQ_OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator)
23 
24 // Base segment iterator accessors.
ACCESSORS(JSSegmentIterator,icu_break_iterator,Managed<icu::BreakIterator>,kIcuBreakIteratorOffset)25 ACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>,
26           kIcuBreakIteratorOffset)
27 ACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>,
28           kUnicodeStringOffset)
29 
30 inline void JSSegmentIterator::set_granularity(
31     JSSegmenter::Granularity granularity) {
32   DCHECK_GE(GranularityBits::kMax, granularity);
33   int hints = flags();
34   hints = GranularityBits::update(hints, granularity);
35   set_flags(hints);
36 }
37 
granularity()38 inline JSSegmenter::Granularity JSSegmentIterator::granularity() const {
39   return GranularityBits::decode(flags());
40 }
41 
42 }  // namespace internal
43 }  // namespace v8
44 
45 #include "src/objects/object-macros-undef.h"
46 
47 #endif  // V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
48