• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "src/roots/roots.h"
6 
7 #include "src/objects/elements-kind.h"
8 #include "src/objects/objects-inl.h"
9 #include "src/objects/visitors.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 const char* RootsTable::root_names_[RootsTable::kEntriesCount] = {
15 #define ROOT_NAME(type, name, CamelName) #name,
16     ROOT_LIST(ROOT_NAME)
17 #undef ROOT_NAME
18 };
19 
one_pointer_filler_map_word()20 MapWord ReadOnlyRoots::one_pointer_filler_map_word() {
21   return MapWord::FromMap(one_pointer_filler_map());
22 }
23 
Iterate(RootVisitor * visitor)24 void ReadOnlyRoots::Iterate(RootVisitor* visitor) {
25   visitor->VisitRootPointers(Root::kReadOnlyRootList, nullptr,
26                              FullObjectSlot(read_only_roots_),
27                              FullObjectSlot(&read_only_roots_[kEntriesCount]));
28   visitor->Synchronize(VisitorSynchronization::kReadOnlyRootList);
29 }
30 
31 #ifdef DEBUG
32 #define ROOT_TYPE_CHECK(Type, name, CamelName)   \
33   bool ReadOnlyRoots::CheckType_##name() const { \
34     return unchecked_##name().Is##Type();        \
35   }
36 
37 READ_ONLY_ROOT_LIST(ROOT_TYPE_CHECK)
38 #undef ROOT_TYPE_CHECK
39 #endif
40 
41 }  // namespace internal
42 }  // namespace v8
43