6cac1382f4
This takes heap-inl.h out of the "Giant Include Cluster". Naturally, that means adding a bunch of explicit includes in a bunch of places that relied on transitively including them before. As of this patch, no header file outside src/heap/ includes heap-inl.h. Bug: v8:8562,v8:8499 Change-Id: I65fa763f90e66afc30d105b9277792721f05a6d4 Reviewed-on: https://chromium-review.googlesource.com/c/1459659 Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Cr-Commit-Position: refs/heads/master@{#59617}
90 lines
2.3 KiB
C++
90 lines
2.3 KiB
C++
// 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.
|
|
|
|
#include "src/roots.h"
|
|
|
|
#include "src/elements-kind.h"
|
|
#include "src/objects-inl.h"
|
|
#include "src/visitors.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
const char* RootsTable::root_names_[RootsTable::kEntriesCount] = {
|
|
#define ROOT_NAME(type, name, CamelName) #name,
|
|
ROOT_LIST(ROOT_NAME)
|
|
#undef ROOT_NAME
|
|
};
|
|
|
|
// static
|
|
RootIndex RootsTable::RootIndexForFixedTypedArray(
|
|
ExternalArrayType array_type) {
|
|
switch (array_type) {
|
|
#define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype) \
|
|
case kExternal##Type##Array: \
|
|
return RootIndex::kFixed##Type##ArrayMap;
|
|
|
|
TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
|
|
#undef ARRAY_TYPE_TO_ROOT_INDEX
|
|
}
|
|
UNREACHABLE();
|
|
}
|
|
|
|
// static
|
|
RootIndex RootsTable::RootIndexForFixedTypedArray(ElementsKind elements_kind) {
|
|
switch (elements_kind) {
|
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) \
|
|
case TYPE##_ELEMENTS: \
|
|
return RootIndex::kFixed##Type##ArrayMap;
|
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
|
default:
|
|
UNREACHABLE();
|
|
#undef TYPED_ARRAY_CASE
|
|
}
|
|
}
|
|
|
|
// static
|
|
RootIndex RootsTable::RootIndexForEmptyFixedTypedArray(
|
|
ElementsKind elements_kind) {
|
|
switch (elements_kind) {
|
|
#define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype) \
|
|
case TYPE##_ELEMENTS: \
|
|
return RootIndex::kEmptyFixed##Type##Array;
|
|
|
|
TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX)
|
|
#undef ELEMENT_KIND_TO_ROOT_INDEX
|
|
default:
|
|
UNREACHABLE();
|
|
}
|
|
}
|
|
|
|
void ReadOnlyRoots::Iterate(RootVisitor* visitor) {
|
|
visitor->VisitRootPointers(Root::kReadOnlyRootList, nullptr,
|
|
roots_table_.read_only_roots_begin(),
|
|
roots_table_.read_only_roots_end());
|
|
visitor->Synchronize(VisitorSynchronization::kReadOnlyRootList);
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
|
|
bool ReadOnlyRoots::CheckType(RootIndex index) const {
|
|
Object root(roots_table_[index]);
|
|
switch (index) {
|
|
#define CHECKTYPE(Type, name, CamelName) \
|
|
case RootIndex::k##CamelName: \
|
|
return root->Is##Type();
|
|
READ_ONLY_ROOT_LIST(CHECKTYPE)
|
|
#undef CHECKTYPE
|
|
|
|
default:
|
|
UNREACHABLE();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#endif // DEBUG
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|