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