// 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. #ifndef V8_OBJECTS_OBJECTS_DEFINITIONS_H_ #define V8_OBJECTS_OBJECTS_DEFINITIONS_H_ #include "src/init/heap-symbols.h" #include "torque-generated/instance-types.h" namespace v8 { namespace internal { // All Maps have a field instance_type containing an InstanceType. // It describes the type of the instances. // // As an example, a JavaScript object is a heap object and its map // instance_type is JS_OBJECT_TYPE. // // The names of the string instance types are intended to systematically mirror // their encoding in the instance_type field of the map. The other // representations (e.g. CONS, EXTERNAL) are explicitly mentioned. Finally, // the string is either a STRING_TYPE (if it is a normal string) or an // INTERNALIZED_STRING_TYPE (if it is an internalized string). // // NOTE: The following things are some that depend on the string types having // instance_types that are less than those of all other types: // HeapObject::Size, HeapObject::IterateBody, the typeof operator, and // Object::IsString. #define INSTANCE_TYPE_LIST_BASE(V) … #define INSTANCE_TYPE_LIST(V) … // Since string types are not consecutive, this macro is used to iterate over // them. The order matters for read only heap layout. The maps are placed such // that string types map to address ranges of maps. #define STRING_TYPE_LIST(V) … // A struct is a simple object a set of object-valued fields. Including an // object type in this causes the compiler to generate most of the boilerplate // code for the class including allocation and garbage collection routines, // casts and predicates. All you need to define is the class, methods and // object verification routines. Easy, no? #define STRUCT_LIST_GENERATOR(V, _) … // Adapts one STRUCT_LIST_GENERATOR entry to the STRUCT_LIST entry #define STRUCT_LIST_ADAPTER(V, NAME, Name, name) … // Produces (NAME, Name, name) entries. #define STRUCT_LIST(V) … // Adapts one STRUCT_LIST_GENERATOR entry to the STRUCT_MAPS_LIST entry #define STRUCT_MAPS_LIST_ADAPTER(V, NAME, Name, name) … // Produces (Map, struct_name_map, StructNameMap) entries #define STRUCT_MAPS_LIST(V) … // // The following macros define list of allocation size objects and list of // their maps. // #define ALLOCATION_SITE_LIST(V, _) … // Adapts one ALLOCATION_SITE_LIST entry to the ALLOCATION_SITE_MAPS_LIST entry #define ALLOCATION_SITE_MAPS_LIST_ADAPTER(V, TYPE, Name, Size, name_size) … // Produces (Map, allocation_site_name_map, AllocationSiteNameMap) entries #define ALLOCATION_SITE_MAPS_LIST(V) … // // The following macros define list of data handler objects and list of their // maps. // #define DATA_HANDLER_LIST(V, _) … // Adapts one DATA_HANDLER_LIST entry to the DATA_HANDLER_MAPS_LIST entry. #define DATA_HANDLER_MAPS_LIST_ADAPTER(V, TYPE, Name, Size, name_size) … // Produces (Map, handler_name_map, HandlerNameMap) entries #define DATA_HANDLER_MAPS_LIST(V) … } // namespace internal } // namespace v8 #endif // V8_OBJECTS_OBJECTS_DEFINITIONS_H_