Line data Source code
1 : // Copyright 2018 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_INTL_SUPPORT
6 : #error Internationalization is expected to be enabled.
7 : #endif // V8_INTL_SUPPORT
8 :
9 : #ifndef V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
10 : #define V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
11 :
12 : #include "src/objects-inl.h"
13 : #include "src/objects/js-segment-iterator.h"
14 :
15 : // Has to be the last include (doesn't have include guards):
16 : #include "src/objects/object-macros.h"
17 :
18 : namespace v8 {
19 : namespace internal {
20 :
21 : OBJECT_CONSTRUCTORS_IMPL(JSSegmentIterator, JSObject)
22 :
23 : // Base segment iterator accessors.
24 211824 : ACCESSORS(JSSegmentIterator, icu_break_iterator, Managed<icu::BreakIterator>,
25 : kICUBreakIteratorOffset)
26 30780 : ACCESSORS(JSSegmentIterator, unicode_string, Managed<icu::UnicodeString>,
27 : kUnicodeStringOffset)
28 :
29 241650 : BIT_FIELD_ACCESSORS(JSSegmentIterator, flags, is_break_type_set,
30 : JSSegmentIterator::BreakTypeSetBits)
31 :
32 158319 : SMI_ACCESSORS(JSSegmentIterator, flags, kFlagsOffset)
33 :
34 : CAST_ACCESSOR(JSSegmentIterator)
35 :
36 2772 : inline void JSSegmentIterator::set_granularity(
37 : JSSegmenter::Granularity granularity) {
38 : DCHECK_GT(JSSegmenter::Granularity::COUNT, granularity);
39 : int hints = flags();
40 5544 : hints = GranularityBits::update(hints, granularity);
41 : set_flags(hints);
42 2772 : }
43 :
44 : inline JSSegmenter::Granularity JSSegmentIterator::granularity() const {
45 52578 : return GranularityBits::decode(flags());
46 : }
47 :
48 : } // namespace internal
49 : } // namespace v8
50 :
51 : #include "src/objects/object-macros-undef.h"
52 :
53 : #endif // V8_OBJECTS_JS_SEGMENT_ITERATOR_INL_H_
|