• 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 
Iterate(RootVisitor * visitor)20 void ReadOnlyRoots::Iterate(RootVisitor* visitor) {
21   visitor->VisitRootPointers(Root::kReadOnlyRootList, nullptr,
22                              FullObjectSlot(read_only_roots_),
23                              FullObjectSlot(&read_only_roots_[kEntriesCount]));
24   visitor->Synchronize(VisitorSynchronization::kReadOnlyRootList);
25 }
26 
27 #ifdef DEBUG
28 #define ROOT_TYPE_CHECK(Type, name, CamelName)   \
29   bool ReadOnlyRoots::CheckType_##name() const { \
30     return unchecked_##name().Is##Type();        \
31   }
32 
33 READ_ONLY_ROOT_LIST(ROOT_TYPE_CHECK)
34 #undef ROOT_TYPE_CHECK
35 #endif
36 
37 }  // namespace internal
38 }  // namespace v8
39