roots.cc 1.09 KB
Newer Older
1 2 3 4
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
#include "src/roots/roots.h"
Dan Elphick's avatar
Dan Elphick committed
6

7
#include "src/objects/elements-kind.h"
8
#include "src/objects/objects-inl.h"
9
#include "src/objects/visitors.h"
10 11 12 13

namespace v8 {
namespace internal {

14 15 16 17 18 19
const char* RootsTable::root_names_[RootsTable::kEntriesCount] = {
#define ROOT_NAME(type, name, CamelName) #name,
    ROOT_LIST(ROOT_NAME)
#undef ROOT_NAME
};

Dan Elphick's avatar
Dan Elphick committed
20 21
void ReadOnlyRoots::Iterate(RootVisitor* visitor) {
  visitor->VisitRootPointers(Root::kReadOnlyRootList, nullptr,
22 23
                             FullObjectSlot(read_only_roots_),
                             FullObjectSlot(&read_only_roots_[kEntriesCount]));
Dan Elphick's avatar
Dan Elphick committed
24 25 26
  visitor->Synchronize(VisitorSynchronization::kReadOnlyRootList);
}

27
#ifdef DEBUG
28 29 30
#define ROOT_TYPE_CHECK(Type, name, CamelName)   \
  bool ReadOnlyRoots::CheckType_##name() const { \
    return unchecked_##name().Is##Type();        \
31 32
  }

33 34 35
READ_ONLY_ROOT_LIST(ROOT_TYPE_CHECK)
#undef ROOT_TYPE_CHECK
#endif
36

37 38
}  // namespace internal
}  // namespace v8