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 
5 #ifndef V8_HEAP_OFF_THREAD_FACTORY_INL_H_
6 #define V8_HEAP_OFF_THREAD_FACTORY_INL_H_
7 
8 #include "src/heap/off-thread-factory.h"
9 
10 #include "src/heap/factory-base-inl.h"
11 #include "src/roots/roots-inl.h"
12 
13 namespace v8 {
14 namespace internal {
15 
16 #define ROOT_ACCESSOR(Type, name, CamelName)  \
17   Handle<Type> OffThreadFactory::name() {     \
18     return read_only_roots().name##_handle(); \
19   }
20 READ_ONLY_ROOT_LIST(ROOT_ACCESSOR)
21 #undef ROOT_ACCESSOR
22 
23 #define ACCESSOR_INFO_ACCESSOR(Type, name, CamelName)                          \
24   Handle<Type> OffThreadFactory::name() {                                      \
25     /* Do a bit of handle location magic to cast the Handle without having */  \
26     /* to pull in Type::cast. We know the type is right by construction.   */  \
27     return Handle<Type>(                                                       \
28         isolate()->isolate_->root_handle(RootIndex::k##CamelName).location()); \
29   }
30 ACCESSOR_INFO_ROOT_LIST(ACCESSOR_INFO_ACCESSOR)
31 #undef ACCESSOR_INFO_ACCESSOR
32 
33 }  // namespace internal
34 }  // namespace v8
35 
36 #endif  // V8_HEAP_OFF_THREAD_FACTORY_INL_H_
37