Line data Source code
1 : // Copyright 2017 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_INTL_OBJECTS_INL_H_
10 : #define V8_OBJECTS_INTL_OBJECTS_INL_H_
11 :
12 : #include "src/objects/intl-objects.h"
13 :
14 : // Has to be the last include (doesn't have include guards):
15 : #include "src/objects/object-macros.h"
16 :
17 : #define PTR_ACCESSORS(holder, name, type, offset) \
18 : inline type* holder::name() const { \
19 : Object* obj = READ_FIELD(this, offset); \
20 : DCHECK(obj->IsSmi()); \
21 : return reinterpret_cast<type*>(obj); \
22 : } \
23 : inline void holder::set_##name(type* value) { \
24 : Object* obj = reinterpret_cast<Object*>(value); \
25 : DCHECK(obj->IsSmi()); \
26 : WRITE_FIELD(this, offset, obj); \
27 : }
28 :
29 : namespace v8 {
30 : namespace internal {
31 :
32 1724 : PTR_ACCESSORS(JSIntlDateTimeFormat, simple_date_format, icu::SimpleDateFormat,
33 : kSimpleDateFormat)
34 :
35 3368 : PTR_ACCESSORS(JSIntlNumberFormat, decimal_format, icu::DecimalFormat,
36 : kDecimalFormat)
37 :
38 157721 : PTR_ACCESSORS(JSIntlCollator, collator, icu::Collator, kCollator)
39 :
40 1154 : PTR_ACCESSORS(JSIntlV8BreakIterator, break_iterator, icu::BreakIterator,
41 : kBreakIterator)
42 252 : PTR_ACCESSORS(JSIntlV8BreakIterator, unicode_string, icu::UnicodeString,
43 : kUnicodeString)
44 :
45 : } // namespace internal
46 : } // namespace v8
47 :
48 : #undef PTR_ACCESSORS
49 :
50 : #include "src/objects/object-macros-undef.h"
51 :
52 : #endif // V8_OBJECTS_INTL_OBJECTS_INL_H_
|