11cb0ef41Sopenharmony_ci// Copyright 2018 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#include "src/roots/roots.h"
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci#include "src/objects/elements-kind.h"
81cb0ef41Sopenharmony_ci#include "src/objects/objects-inl.h"
91cb0ef41Sopenharmony_ci#include "src/objects/visitors.h"
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cinamespace v8 {
121cb0ef41Sopenharmony_cinamespace internal {
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst char* RootsTable::root_names_[RootsTable::kEntriesCount] = {
151cb0ef41Sopenharmony_ci#define ROOT_NAME(type, name, CamelName) #name,
161cb0ef41Sopenharmony_ci    ROOT_LIST(ROOT_NAME)
171cb0ef41Sopenharmony_ci#undef ROOT_NAME
181cb0ef41Sopenharmony_ci};
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciMapWord ReadOnlyRoots::one_pointer_filler_map_word() {
211cb0ef41Sopenharmony_ci  return MapWord::FromMap(one_pointer_filler_map());
221cb0ef41Sopenharmony_ci}
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_civoid ReadOnlyRoots::Iterate(RootVisitor* visitor) {
251cb0ef41Sopenharmony_ci  visitor->VisitRootPointers(Root::kReadOnlyRootList, nullptr,
261cb0ef41Sopenharmony_ci                             FullObjectSlot(read_only_roots_),
271cb0ef41Sopenharmony_ci                             FullObjectSlot(&read_only_roots_[kEntriesCount]));
281cb0ef41Sopenharmony_ci  visitor->Synchronize(VisitorSynchronization::kReadOnlyRootList);
291cb0ef41Sopenharmony_ci}
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_ci#ifdef DEBUG
321cb0ef41Sopenharmony_ci#define ROOT_TYPE_CHECK(Type, name, CamelName)   \
331cb0ef41Sopenharmony_ci  bool ReadOnlyRoots::CheckType_##name() const { \
341cb0ef41Sopenharmony_ci    return unchecked_##name().Is##Type();        \
351cb0ef41Sopenharmony_ci  }
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ciREAD_ONLY_ROOT_LIST(ROOT_TYPE_CHECK)
381cb0ef41Sopenharmony_ci#undef ROOT_TYPE_CHECK
391cb0ef41Sopenharmony_ci#endif
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ci}  // namespace internal
421cb0ef41Sopenharmony_ci}  // namespace v8
43