Commit 2eba67c8 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[cleanup] Introduce ALLOCATION_SITE_MAPS_LIST and DATA_HANDLER_MAPS_LIST

... which are generated from ALLOCATION_SITE_LIST and DATA_HANDLER_LIST respectively.

Bug: v8:8015
Change-Id: Ib729628e6b65ad98ff50234572f8edf2854f83ad
Reviewed-on: https://chromium-review.googlesource.com/1238517
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56143}
parent d4df8a89
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, CamelName) \
Handle<type> Factory::name() { \ Handle<type> Factory::name() { \
return Handle<type>(bit_cast<type**>( \ return Handle<type>(bit_cast<type**>( \
&isolate()->heap()->roots_[RootIndex::k##camel_name])); \ &isolate()->heap()->roots_[RootIndex::k##CamelName])); \
} }
ROOT_LIST(ROOT_ACCESSOR) ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
Handle<Map> Factory::name##_map() { \ Handle<Map> Factory::name##_map() { \
...@@ -32,21 +31,9 @@ ROOT_LIST(ROOT_ACCESSOR) ...@@ -32,21 +31,9 @@ ROOT_LIST(ROOT_ACCESSOR)
STRUCT_LIST(STRUCT_MAP_ACCESSOR) STRUCT_LIST(STRUCT_MAP_ACCESSOR)
#undef STRUCT_MAP_ACCESSOR #undef STRUCT_MAP_ACCESSOR
#define ALLOCATION_SITE_MAP_ACCESSOR(NAME, Name, Size, name) \ ALLOCATION_SITE_MAPS_LIST(ROOT_ACCESSOR)
Handle<Map> Factory::name##_map() { \ DATA_HANDLER_MAPS_LIST(ROOT_ACCESSOR)
return Handle<Map>(bit_cast<Map**>( \ #undef ROOT_ACCESSOR
&isolate()->heap()->roots_[RootIndex::k##Name##Size##Map])); \
}
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_ACCESSOR)
#undef ALLOCATION_SITE_MAP_ACCESSOR
#define DATA_HANDLER_MAP_ACCESSOR(NAME, Name, Size, name) \
Handle<Map> Factory::name##_map() { \
return Handle<Map>(bit_cast<Map**>( \
&isolate()->heap()->roots_[RootIndex::k##Name##Size##Map])); \
}
DATA_HANDLER_LIST(DATA_HANDLER_MAP_ACCESSOR)
#undef DATA_HANDLER_MAP_ACCESSOR
#define STRING_ACCESSOR(name, str) \ #define STRING_ACCESSOR(name, str) \
Handle<String> Factory::name() { \ Handle<String> Factory::name() { \
......
...@@ -825,23 +825,16 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -825,23 +825,16 @@ class V8_EXPORT_PRIVATE Factory {
inline Handle<String> Uint32ToString(uint32_t value, bool check_cache = true); inline Handle<String> Uint32ToString(uint32_t value, bool check_cache = true);
#define ROOT_ACCESSOR(type, name, camel_name) inline Handle<type> name(); #define ROOT_ACCESSOR(type, name, CamelName) inline Handle<type> name();
ROOT_LIST(ROOT_ACCESSOR) ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) inline Handle<Map> name##_map(); #define STRUCT_MAP_ACCESSOR(NAME, Name, name) inline Handle<Map> name##_map();
STRUCT_LIST(STRUCT_MAP_ACCESSOR) STRUCT_LIST(STRUCT_MAP_ACCESSOR)
#undef STRUCT_MAP_ACCESSOR #undef STRUCT_MAP_ACCESSOR
#define ALLOCATION_SITE_MAP_ACCESSOR(NAME, Name, Size, name) \ ALLOCATION_SITE_MAPS_LIST(ROOT_ACCESSOR)
inline Handle<Map> name##_map(); DATA_HANDLER_MAPS_LIST(ROOT_ACCESSOR)
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_ACCESSOR) #undef ROOT_ACCESSOR
#undef ALLOCATION_SITE_MAP_ACCESSOR
#define DATA_HANDLER_MAP_ACCESSOR(NAME, Name, Size, name) \
inline Handle<Map> name##_map();
DATA_HANDLER_LIST(DATA_HANDLER_MAP_ACCESSOR)
#undef DATA_HANDLER_MAP_ACCESSOR
#define STRING_ACCESSOR(name, str) inline Handle<String> name(); #define STRING_ACCESSOR(name, str) inline Handle<String> name();
INTERNALIZED_STRING_LIST(STRING_ACCESSOR) INTERNALIZED_STRING_LIST(STRING_ACCESSOR)
......
...@@ -55,17 +55,12 @@ HeapObject* AllocationResult::ToObjectChecked() { ...@@ -55,17 +55,12 @@ HeapObject* AllocationResult::ToObjectChecked() {
return HeapObject::cast(object_); return HeapObject::cast(object_);
} }
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, CamelName) \
type* Heap::name() { return type::cast(roots_[RootIndex::k##camel_name]); } type* Heap::name() { return type::cast(roots_[RootIndex::k##CamelName]); }
MUTABLE_ROOT_LIST(ROOT_ACCESSOR) MUTABLE_ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define DATA_HANDLER_MAP_ACCESSOR(NAME, Name, Size, name) \ DATA_HANDLER_MAPS_LIST(ROOT_ACCESSOR)
Map* Heap::name##_map() { \ #undef ROOT_ACCESSOR
return Map::cast(roots_[RootIndex::k##Name##Size##Map]); \
}
DATA_HANDLER_LIST(DATA_HANDLER_MAP_ACCESSOR)
#undef DATA_HANDLER_MAP_ACCESSOR
#define ACCESSOR_INFO_ACCESSOR(accessor_name, AccessorName, ...) \ #define ACCESSOR_INFO_ACCESSOR(accessor_name, AccessorName, ...) \
AccessorInfo* Heap::accessor_name##_accessor() { \ AccessorInfo* Heap::accessor_name##_accessor() { \
...@@ -74,16 +69,15 @@ DATA_HANDLER_LIST(DATA_HANDLER_MAP_ACCESSOR) ...@@ -74,16 +69,15 @@ DATA_HANDLER_LIST(DATA_HANDLER_MAP_ACCESSOR)
ACCESSOR_INFO_LIST(ACCESSOR_INFO_ACCESSOR) ACCESSOR_INFO_LIST(ACCESSOR_INFO_ACCESSOR)
#undef ACCESSOR_INFO_ACCESSOR #undef ACCESSOR_INFO_ACCESSOR
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, CamelName) \
void Heap::set_##name(type* value) { \ void Heap::set_##name(type* value) { \
/* The deserializer makes use of the fact that these common roots are */ \ /* The deserializer makes use of the fact that these common roots are */ \
/* never in new space and never on a page that is being compacted. */ \ /* never in new space and never on a page that is being compacted. */ \
DCHECK(!deserialization_complete() || \ DCHECK(!deserialization_complete() || \
RootCanBeWrittenAfterInitialization(RootIndex::k##camel_name)); \ RootCanBeWrittenAfterInitialization(RootIndex::k##CamelName)); \
DCHECK_IMPLIES( \ DCHECK_IMPLIES(static_cast<int>(RootIndex::k##CamelName) < kOldSpaceRoots, \
static_cast<int>(RootIndex::k##camel_name) < kOldSpaceRoots, \ !InNewSpace(value)); \
!InNewSpace(value)); \ roots_[RootIndex::k##CamelName] = value; \
roots_[RootIndex::k##camel_name] = value; \
} }
ROOT_LIST(ROOT_ACCESSOR) ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR #undef ROOT_ACCESSOR
......
...@@ -767,14 +767,11 @@ class Heap { ...@@ -767,14 +767,11 @@ class Heap {
public: public:
// Heap root getters. // Heap root getters.
#define ROOT_ACCESSOR(type, name, camel_name) inline type* name(); #define ROOT_ACCESSOR(type, name, CamelName) inline type* name();
MUTABLE_ROOT_LIST(ROOT_ACCESSOR) MUTABLE_ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define DATA_HANDLER_MAP_ACCESSOR(NAME, Name, Size, name) \ DATA_HANDLER_MAPS_LIST(ROOT_ACCESSOR)
inline Map* name##_map(); #undef ROOT_ACCESSOR
DATA_HANDLER_LIST(DATA_HANDLER_MAP_ACCESSOR)
#undef DATA_HANDLER_MAP_ACCESSOR
#define ACCESSOR_INFO_ACCESSOR(accessor_name, ...) \ #define ACCESSOR_INFO_ACCESSOR(accessor_name, ...) \
inline AccessorInfo* accessor_name##_accessor(); inline AccessorInfo* accessor_name##_accessor();
...@@ -1564,7 +1561,7 @@ class Heap { ...@@ -1564,7 +1561,7 @@ class Heap {
return 0; return 0;
} }
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, CamelName) \
inline void set_##name(type* value); inline void set_##name(type* value);
ROOT_LIST(ROOT_ACCESSOR) ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR #undef ROOT_ACCESSOR
......
...@@ -57,8 +57,8 @@ bool Heap::CreateHeapObjects() { ...@@ -57,8 +57,8 @@ bool Heap::CreateHeapObjects() {
} }
const Heap::StringTypeTable Heap::string_type_table[] = { const Heap::StringTypeTable Heap::string_type_table[] = {
#define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ #define STRING_TYPE_ELEMENT(type, size, name, CamelName) \
{type, size, RootIndex::k##camel_name##Map}, {type, size, RootIndex::k##CamelName##Map},
STRING_TYPE_LIST(STRING_TYPE_ELEMENT) STRING_TYPE_LIST(STRING_TYPE_ELEMENT)
#undef STRING_TYPE_ELEMENT #undef STRING_TYPE_ELEMENT
}; };
...@@ -76,14 +76,14 @@ const Heap::StructTable Heap::struct_table[] = { ...@@ -76,14 +76,14 @@ const Heap::StructTable Heap::struct_table[] = {
STRUCT_LIST(STRUCT_TABLE_ELEMENT) STRUCT_LIST(STRUCT_TABLE_ELEMENT)
#undef STRUCT_TABLE_ELEMENT #undef STRUCT_TABLE_ELEMENT
#define ALLOCATION_SITE_ELEMENT(NAME, Name, Size, name) \ #define ALLOCATION_SITE_ELEMENT(_, NAME, Name, Size, name) \
{NAME##_TYPE, Name::kSize##Size, RootIndex::k##Name##Size##Map}, {NAME##_TYPE, Name::kSize##Size, RootIndex::k##Name##Size##Map},
ALLOCATION_SITE_LIST(ALLOCATION_SITE_ELEMENT) ALLOCATION_SITE_LIST(ALLOCATION_SITE_ELEMENT, /* not used */)
#undef ALLOCATION_SITE_ELEMENT #undef ALLOCATION_SITE_ELEMENT
#define DATA_HANDLER_ELEMENT(NAME, Name, Size, name) \ #define DATA_HANDLER_ELEMENT(_, NAME, Name, Size, name) \
{NAME##_TYPE, Name::kSizeWithData##Size, RootIndex::k##Name##Size##Map}, {NAME##_TYPE, Name::kSizeWithData##Size, RootIndex::k##Name##Size##Map},
DATA_HANDLER_LIST(DATA_HANDLER_ELEMENT) DATA_HANDLER_LIST(DATA_HANDLER_ELEMENT, /* not used */)
#undef DATA_HANDLER_ELEMENT #undef DATA_HANDLER_ELEMENT
}; };
......
...@@ -121,7 +121,7 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) { ...@@ -121,7 +121,7 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
CHECK(map()->IsMap()); CHECK(map()->IsMap());
switch (map()->instance_type()) { switch (map()->instance_type()) {
#define STRING_TYPE_CASE(TYPE, size, name, camel_name) case TYPE: #define STRING_TYPE_CASE(TYPE, size, name, CamelName) case TYPE:
STRING_TYPE_LIST(STRING_TYPE_CASE) STRING_TYPE_LIST(STRING_TYPE_CASE)
#undef STRING_TYPE_CASE #undef STRING_TYPE_CASE
String::cast(this)->StringVerify(isolate); String::cast(this)->StringVerify(isolate);
......
...@@ -334,19 +334,43 @@ namespace internal { ...@@ -334,19 +334,43 @@ namespace internal {
promise_resolve_thenable_job_task) \ promise_resolve_thenable_job_task) \
V(MICROTASK_QUEUE, MicrotaskQueue, microtask_queue) V(MICROTASK_QUEUE, MicrotaskQueue, microtask_queue)
#define ALLOCATION_SITE_LIST(V) \ //
V(ALLOCATION_SITE, AllocationSite, WithWeakNext, allocation_site) \ // The following macros define list of allocation size objects and list of
V(ALLOCATION_SITE, AllocationSite, WithoutWeakNext, \ // their maps.
//
#define ALLOCATION_SITE_LIST(V, _) \
V(_, ALLOCATION_SITE, AllocationSite, WithWeakNext, allocation_site) \
V(_, ALLOCATION_SITE, AllocationSite, WithoutWeakNext, \
allocation_site_without_weaknext) allocation_site_without_weaknext)
#define DATA_HANDLER_LIST(V) \ // Adapts one ALLOCATION_SITE_LIST entry to the ALLOCATION_SITE_MAPS_LIST entry
V(LOAD_HANDLER, LoadHandler, 1, load_handler1) \ #define ALLOCATION_SITE_MAPS_LIST_ADAPTER(_, NAME, Name, Size, name_size) \
V(LOAD_HANDLER, LoadHandler, 2, load_handler2) \ _(Map, name_size##_map, Name##Size##Map)
V(LOAD_HANDLER, LoadHandler, 3, load_handler3) \
V(STORE_HANDLER, StoreHandler, 0, store_handler0) \ // Produces (Map, allocation_site_name_map, AllocationSiteNameMap) entries
V(STORE_HANDLER, StoreHandler, 1, store_handler1) \ #define ALLOCATION_SITE_MAPS_LIST(V) \
V(STORE_HANDLER, StoreHandler, 2, store_handler2) \ ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAPS_LIST_ADAPTER, V)
V(STORE_HANDLER, StoreHandler, 3, store_handler3)
//
// The following macros define list of data handler objects and list of their
// maps.
//
#define DATA_HANDLER_LIST(V, _) \
V(_, LOAD_HANDLER, LoadHandler, 1, load_handler1) \
V(_, LOAD_HANDLER, LoadHandler, 2, load_handler2) \
V(_, LOAD_HANDLER, LoadHandler, 3, load_handler3) \
V(_, STORE_HANDLER, StoreHandler, 0, store_handler0) \
V(_, STORE_HANDLER, StoreHandler, 1, store_handler1) \
V(_, STORE_HANDLER, StoreHandler, 2, store_handler2) \
V(_, STORE_HANDLER, StoreHandler, 3, store_handler3)
// Adapts one DATA_HANDLER_LIST entry to the DATA_HANDLER_MAPS_LIST entry.
#define DATA_HANDLER_MAPS_LIST_ADAPTER(_, NAME, Name, Size, name_size) \
_(Map, name_size##_map, Name##Size##Map)
// Produces (Map, handler_name_map, HandlerNameMap) entries
#define DATA_HANDLER_MAPS_LIST(V) \
DATA_HANDLER_LIST(DATA_HANDLER_MAPS_LIST_ADAPTER, V)
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -1856,21 +1856,20 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) { ...@@ -1856,21 +1856,20 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) {
#define NAME_ENTRY(name) strong_gc_subroot_names_.emplace(heap_->name(), #name); #define NAME_ENTRY(name) strong_gc_subroot_names_.emplace(heap_->name(), #name);
#define RO_NAME_ENTRY(name) \ #define RO_NAME_ENTRY(name) \
strong_gc_subroot_names_.emplace(roots.name(), #name); strong_gc_subroot_names_.emplace(roots.name(), #name);
#define ROOT_NAME(type, name, camel_name) NAME_ENTRY(name) #define ROOT_NAME(type, name, CamelName) NAME_ENTRY(name)
STRONG_MUTABLE_ROOT_LIST(ROOT_NAME) STRONG_MUTABLE_ROOT_LIST(ROOT_NAME)
#undef ROOT_NAME #undef ROOT_NAME
#define ROOT_NAME(type, name, camel_name) RO_NAME_ENTRY(name) #define ROOT_NAME(type, name, CamelName) RO_NAME_ENTRY(name)
STRONG_READ_ONLY_ROOT_LIST(ROOT_NAME) STRONG_READ_ONLY_ROOT_LIST(ROOT_NAME)
#undef ROOT_NAME #undef ROOT_NAME
#define STRUCT_MAP_NAME(NAME, Name, name) RO_NAME_ENTRY(name##_map) #define STRUCT_MAP_NAME(NAME, Name, name) RO_NAME_ENTRY(name##_map)
STRUCT_LIST(STRUCT_MAP_NAME) STRUCT_LIST(STRUCT_MAP_NAME)
#undef STRUCT_MAP_NAME #undef STRUCT_MAP_NAME
#define ALLOCATION_SITE_MAP_NAME(NAME, Name, Size, name) \ #define ALLOCATION_SITE_MAP_NAME(type, name, CamelName) RO_NAME_ENTRY(name)
RO_NAME_ENTRY(name##_map) ALLOCATION_SITE_MAPS_LIST(ALLOCATION_SITE_MAP_NAME)
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_NAME)
#undef ALLOCATION_SITE_MAP_NAME #undef ALLOCATION_SITE_MAP_NAME
#define DATA_HANDLER_MAP_NAME(NAME, Name, Size, name) NAME_ENTRY(name##_map) #define DATA_HANDLER_MAP_NAME(type, name, CamelName) NAME_ENTRY(name)
DATA_HANDLER_LIST(DATA_HANDLER_MAP_NAME) DATA_HANDLER_MAPS_LIST(DATA_HANDLER_MAP_NAME)
#undef DATA_HANDLER_MAP_NAME #undef DATA_HANDLER_MAP_NAME
#define STRING_NAME(name, str) RO_NAME_ENTRY(name) #define STRING_NAME(name, str) RO_NAME_ENTRY(name)
INTERNALIZED_STRING_LIST(STRING_NAME) INTERNALIZED_STRING_LIST(STRING_NAME)
......
...@@ -16,16 +16,15 @@ namespace internal { ...@@ -16,16 +16,15 @@ namespace internal {
ReadOnlyRoots::ReadOnlyRoots(Isolate* isolate) : heap_(isolate->heap()) {} ReadOnlyRoots::ReadOnlyRoots(Isolate* isolate) : heap_(isolate->heap()) {}
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, CamelName) \
type* ReadOnlyRoots::name() { \ type* ReadOnlyRoots::name() { \
return type::cast(heap_->roots_[RootIndex::k##camel_name]); \ return type::cast(heap_->roots_[RootIndex::k##CamelName]); \
} \ } \
Handle<type> ReadOnlyRoots::name##_handle() { \ Handle<type> ReadOnlyRoots::name##_handle() { \
return Handle<type>( \ return Handle<type>( \
bit_cast<type**>(&heap_->roots_[RootIndex::k##camel_name])); \ bit_cast<type**>(&heap_->roots_[RootIndex::k##CamelName])); \
} }
STRONG_READ_ONLY_ROOT_LIST(ROOT_ACCESSOR) STRONG_READ_ONLY_ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define STRING_ACCESSOR(name, str) \ #define STRING_ACCESSOR(name, str) \
String* ReadOnlyRoots::name() { \ String* ReadOnlyRoots::name() { \
...@@ -72,16 +71,8 @@ WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR) ...@@ -72,16 +71,8 @@ WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
STRUCT_LIST(STRUCT_MAP_ACCESSOR) STRUCT_LIST(STRUCT_MAP_ACCESSOR)
#undef STRUCT_MAP_ACCESSOR #undef STRUCT_MAP_ACCESSOR
#define ALLOCATION_SITE_MAP_ACCESSOR(NAME, Name, Size, name) \ ALLOCATION_SITE_MAPS_LIST(ROOT_ACCESSOR)
Map* ReadOnlyRoots::name##_map() { \ #undef ROOT_ACCESSOR
return Map::cast(heap_->roots_[RootIndex::k##Name##Size##Map]); \
} \
Handle<Map> ReadOnlyRoots::name##_map_handle() { \
return Handle<Map>( \
bit_cast<Map**>(&heap_->roots_[RootIndex::k##Name##Size##Map])); \
}
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_ACCESSOR)
#undef ALLOCATION_SITE_MAP_ACCESSOR
FixedTypedArrayBase* ReadOnlyRoots::EmptyFixedTypedArrayForMap(const Map* map) { FixedTypedArrayBase* ReadOnlyRoots::EmptyFixedTypedArrayForMap(const Map* map) {
// TODO(delphick): All of these empty fixed type arrays are in RO_SPACE so // TODO(delphick): All of these empty fixed type arrays are in RO_SPACE so
......
...@@ -290,7 +290,7 @@ namespace internal { ...@@ -290,7 +290,7 @@ namespace internal {
// Declare all the root indices. This defines the root list order. // Declare all the root indices. This defines the root list order.
// clang-format off // clang-format off
enum class RootIndex { enum class RootIndex {
#define DECL(type, name, camel_name) k##camel_name, #define DECL(type, name, CamelName) k##CamelName,
STRONG_ROOT_LIST(DECL) STRONG_ROOT_LIST(DECL)
#undef DECL #undef DECL
...@@ -315,17 +315,14 @@ enum class RootIndex { ...@@ -315,17 +315,14 @@ enum class RootIndex {
STRUCT_LIST(DECL) STRUCT_LIST(DECL)
#undef DECL #undef DECL
#define DECL(NAME, Name, Size, name) k##Name##Size##Map, #define DECL(type, name, CamelName) k##CamelName,
ALLOCATION_SITE_LIST(DECL) ALLOCATION_SITE_MAPS_LIST(DECL)
#undef DECL DATA_HANDLER_MAPS_LIST(DECL)
#define DECL(NAME, Name, Size, name) k##Name##Size##Map,
DATA_HANDLER_LIST(DECL)
#undef DECL #undef DECL
kStringTable, kStringTable,
#define DECL(type, name, camel_name) k##camel_name, #define DECL(type, name, CamelName) k##CamelName,
SMI_ROOT_LIST(DECL) SMI_ROOT_LIST(DECL)
#undef DECL #undef DECL
...@@ -393,11 +390,10 @@ class ReadOnlyRoots { ...@@ -393,11 +390,10 @@ class ReadOnlyRoots {
explicit ReadOnlyRoots(Heap* heap) : heap_(heap) {} explicit ReadOnlyRoots(Heap* heap) : heap_(heap) {}
inline explicit ReadOnlyRoots(Isolate* isolate); inline explicit ReadOnlyRoots(Isolate* isolate);
#define ROOT_ACCESSOR(type, name, camel_name) \ #define ROOT_ACCESSOR(type, name, CamelName) \
inline class type* name(); \ inline class type* name(); \
inline Handle<type> name##_handle(); inline Handle<type> name##_handle();
STRONG_READ_ONLY_ROOT_LIST(ROOT_ACCESSOR) STRONG_READ_ONLY_ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR
#define STRING_ACCESSOR(name, str) \ #define STRING_ACCESSOR(name, str) \
inline String* name(); \ inline String* name(); \
...@@ -425,11 +421,8 @@ class ReadOnlyRoots { ...@@ -425,11 +421,8 @@ class ReadOnlyRoots {
STRUCT_LIST(STRUCT_MAP_ACCESSOR) STRUCT_LIST(STRUCT_MAP_ACCESSOR)
#undef STRUCT_MAP_ACCESSOR #undef STRUCT_MAP_ACCESSOR
#define ALLOCATION_SITE_MAP_ACCESSOR(NAME, Name, Size, name) \ ALLOCATION_SITE_MAPS_LIST(ROOT_ACCESSOR)
inline Map* name##_map(); \ #undef ROOT_ACCESSOR
inline class Handle<Map> name##_map_handle();
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_ACCESSOR)
#undef ALLOCATION_SITE_MAP_ACCESSOR
inline FixedTypedArrayBase* EmptyFixedTypedArrayForMap(const Map* map); inline FixedTypedArrayBase* EmptyFixedTypedArrayForMap(const Map* map);
......
...@@ -27,7 +27,7 @@ AllocationSpace GetSpaceFromObject(Object* object) { ...@@ -27,7 +27,7 @@ AllocationSpace GetSpaceFromObject(Object* object) {
TEST(TestStrongReadOnlyRoots) { TEST(TestStrongReadOnlyRoots) {
ReadOnlyRoots roots(CcTest::i_isolate()); ReadOnlyRoots roots(CcTest::i_isolate());
#define TEST_ROOT(type, name, camel_name) CHECK_IN_RO_SPACE(name) #define TEST_ROOT(type, name, CamelName) CHECK_IN_RO_SPACE(name)
STRONG_READ_ONLY_ROOT_LIST(TEST_ROOT) STRONG_READ_ONLY_ROOT_LIST(TEST_ROOT)
#undef TEST_ROOT #undef TEST_ROOT
} }
...@@ -66,8 +66,8 @@ TEST(TestStructMaps) { ...@@ -66,8 +66,8 @@ TEST(TestStructMaps) {
TEST(TestAllocationSiteMaps) { TEST(TestAllocationSiteMaps) {
ReadOnlyRoots roots(CcTest::i_isolate()); ReadOnlyRoots roots(CcTest::i_isolate());
#define TEST_ROOT(NAME, Name, Size, name) CHECK_IN_RO_SPACE(name##_map) #define TEST_ROOT(type, name, CamelName) CHECK_IN_RO_SPACE(name)
ALLOCATION_SITE_LIST(TEST_ROOT) ALLOCATION_SITE_MAPS_LIST(TEST_ROOT)
#undef TEST_ROOT #undef TEST_ROOT
} }
...@@ -114,7 +114,7 @@ TEST(TestHeapRootsNotReadOnly) { ...@@ -114,7 +114,7 @@ TEST(TestHeapRootsNotReadOnly) {
Factory* factory = CcTest::i_isolate()->factory(); Factory* factory = CcTest::i_isolate()->factory();
Heap* heap = CcTest::i_isolate()->heap(); Heap* heap = CcTest::i_isolate()->heap();
#define TEST_ROOT(type, name, camel_name) CHECK_NOT_IN_RO_SPACE(name) #define TEST_ROOT(type, name, CamelName) CHECK_NOT_IN_RO_SPACE(name)
MUTABLE_ROOT_LIST(TEST_ROOT) MUTABLE_ROOT_LIST(TEST_ROOT)
#undef TEST_ROOT #undef TEST_ROOT
} }
......
...@@ -41,14 +41,12 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator { ...@@ -41,14 +41,12 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
void Free(void* p, size_t) override {} void Free(void* p, size_t) override {}
}; };
#define RO_ROOT_LIST_CASE(type, name, camel_name) \ #define RO_ROOT_LIST_CASE(type, name, CamelName) \
if (n == NULL && o == roots.name()) n = #camel_name; if (n == NULL && o == roots.name()) n = #CamelName;
#define ROOT_LIST_CASE(type, name, camel_name) \ #define ROOT_LIST_CASE(type, name, CamelName) \
if (n == NULL && o == space->heap()->name()) n = #camel_name; if (n == NULL && o == space->heap()->name()) n = #CamelName;
#define STRUCT_LIST_CASE(upper_name, camel_name, name) \ #define STRUCT_LIST_CASE(upper_name, CamelName, name) \
if (n == NULL && o == roots.name##_map()) n = #camel_name "Map"; if (n == NULL && o == roots.name##_map()) n = #CamelName "Map";
#define ALLOCATION_SITE_LIST_CASE(upper_name, camel_name, size, name) \
if (n == NULL && o == roots.name##_map()) n = #camel_name "Map";
static void DumpMaps(i::PagedSpace* space) { static void DumpMaps(i::PagedSpace* space) {
i::HeapObjectIterator it(space); i::HeapObjectIterator it(space);
i::ReadOnlyRoots roots(space->heap()); i::ReadOnlyRoots roots(space->heap());
...@@ -61,14 +59,13 @@ static void DumpMaps(i::PagedSpace* space) { ...@@ -61,14 +59,13 @@ static void DumpMaps(i::PagedSpace* space) {
STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE) STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE)
MUTABLE_ROOT_LIST(ROOT_LIST_CASE) MUTABLE_ROOT_LIST(ROOT_LIST_CASE)
STRUCT_LIST(STRUCT_LIST_CASE) STRUCT_LIST(STRUCT_LIST_CASE)
ALLOCATION_SITE_LIST(ALLOCATION_SITE_LIST_CASE) ALLOCATION_SITE_MAPS_LIST(RO_ROOT_LIST_CASE)
if (n == nullptr) continue; if (n == nullptr) continue;
const char* sname = space->name(); const char* sname = space->name();
i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): (%d, \"%s\"),\n", sname, p, t, i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): (%d, \"%s\"),\n", sname, p, t,
n); n);
} }
} }
#undef ALLOCATION_SITE_LIST_CASE
#undef STRUCT_LIST_CASE #undef STRUCT_LIST_CASE
#undef ROOT_LIST_CASE #undef ROOT_LIST_CASE
#undef RO_ROOT_LIST_CASE #undef RO_ROOT_LIST_CASE
...@@ -103,15 +100,15 @@ static int DumpHeapConstants(const char* argv0) { ...@@ -103,15 +100,15 @@ static int DumpHeapConstants(const char* argv0) {
// Dump the KNOWN_OBJECTS table to the console. // Dump the KNOWN_OBJECTS table to the console.
i::PrintF("\n# List of known V8 objects.\n"); i::PrintF("\n# List of known V8 objects.\n");
#define RO_ROOT_LIST_CASE(type, name, camel_name) \ #define RO_ROOT_LIST_CASE(type, name, CamelName) \
if (n == NULL && o == roots.name()) { \ if (n == NULL && o == roots.name()) { \
n = #camel_name; \ n = #CamelName; \
i = i::RootIndex::k##camel_name; \ i = i::RootIndex::k##CamelName; \
} }
#define ROOT_LIST_CASE(type, name, camel_name) \ #define ROOT_LIST_CASE(type, name, CamelName) \
if (n == NULL && o == heap->name()) { \ if (n == NULL && o == heap->name()) { \
n = #camel_name; \ n = #CamelName; \
i = i::RootIndex::k##camel_name; \ i = i::RootIndex::k##CamelName; \
} }
i::PagedSpaces spit(heap, i::PagedSpaces::SpacesSpecifier::kAllPagedSpaces); i::PagedSpaces spit(heap, i::PagedSpaces::SpacesSpecifier::kAllPagedSpaces);
i::PrintF("KNOWN_OBJECTS = {\n"); i::PrintF("KNOWN_OBJECTS = {\n");
......
...@@ -314,8 +314,8 @@ KNOWN_MAPS = { ...@@ -314,8 +314,8 @@ KNOWN_MAPS = {
("RO_SPACE", 0x093d1): (178, "PromiseFulfillReactionJobTaskMap"), ("RO_SPACE", 0x093d1): (178, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x09421): (179, "PromiseRejectReactionJobTaskMap"), ("RO_SPACE", 0x09421): (179, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x09471): (180, "PromiseResolveThenableJobTaskMap"), ("RO_SPACE", 0x09471): (180, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x094c1): (182, "AllocationSiteMap"), ("RO_SPACE", 0x094c1): (182, "AllocationSiteWithWeakNextMap"),
("RO_SPACE", 0x09511): (182, "AllocationSiteMap"), ("RO_SPACE", 0x09511): (182, "AllocationSiteWithoutWeakNextMap"),
("MAP_SPACE", 0x02201): (1057, "ExternalMap"), ("MAP_SPACE", 0x02201): (1057, "ExternalMap"),
("MAP_SPACE", 0x02251): (1072, "JSMessageObjectMap"), ("MAP_SPACE", 0x02251): (1072, "JSMessageObjectMap"),
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment