[explicit isolates] Move remaining roots to ReadOnyRoots
Moves STRUCT_LIST AND ALLOCATION_SITE_LIST into roots.h and adds access to their associated maps using ReadOnlyRoots. Also corrects the location of external_map, message_object_map, empty_script, many_closures_cell, invalid_prototype_validity_cell and builtins_constants_table which are not in RO_SPACE. Finally this adds a convenience ReadOnlyRoots(Isolate*) constructor. Bug: v8:7786 Change-Id: I4982dd0cbea2062a124605678599ba48831f020f Reviewed-on: https://chromium-review.googlesource.com/1124319 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#54178}
This commit is contained in:
parent
37dd992c51
commit
f9c4d0008f
337
src/objects-definitions.h
Normal file
337
src/objects-definitions.h
Normal file
@ -0,0 +1,337 @@
|
||||
// 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_DEFINITIONS_H_
|
||||
#define V8_OBJECTS_DEFINITIONS_H_
|
||||
|
||||
#include "src/heap-symbols.h"
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace internal {
|
||||
|
||||
// All Maps have a field instance_type containing a 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 default
|
||||
// encoding is considered TWO_BYTE. It is not mentioned in the name. ONE_BYTE
|
||||
// encoding is mentioned explicitly in the name. Likewise, the default
|
||||
// representation is considered sequential. It is not mentioned in the
|
||||
// name. 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 a INTERNALIZED_STRING_TYPE (if it is a 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.
|
||||
//
|
||||
// NOTE: Everything following JS_VALUE_TYPE is considered a
|
||||
// JSObject for GC purposes. The first four entries here have typeof
|
||||
// 'object', whereas JS_FUNCTION_TYPE has typeof 'function'.
|
||||
//
|
||||
// NOTE: List had to be split into two, because of conditional item(s) from
|
||||
// INTL namespace. They can't just be appended to the end, because of the
|
||||
// checks we do in tests (expecting JS_FUNCTION_TYPE to be last).
|
||||
#define INSTANCE_TYPE_LIST_BEFORE_INTL(V) \
|
||||
V(INTERNALIZED_STRING_TYPE) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_TYPE) \
|
||||
V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \
|
||||
V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
V(STRING_TYPE) \
|
||||
V(CONS_STRING_TYPE) \
|
||||
V(EXTERNAL_STRING_TYPE) \
|
||||
V(SLICED_STRING_TYPE) \
|
||||
V(THIN_STRING_TYPE) \
|
||||
V(ONE_BYTE_STRING_TYPE) \
|
||||
V(CONS_ONE_BYTE_STRING_TYPE) \
|
||||
V(EXTERNAL_ONE_BYTE_STRING_TYPE) \
|
||||
V(SLICED_ONE_BYTE_STRING_TYPE) \
|
||||
V(THIN_ONE_BYTE_STRING_TYPE) \
|
||||
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
V(SHORT_EXTERNAL_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
\
|
||||
V(SYMBOL_TYPE) \
|
||||
V(HEAP_NUMBER_TYPE) \
|
||||
V(BIGINT_TYPE) \
|
||||
V(ODDBALL_TYPE) \
|
||||
\
|
||||
V(MAP_TYPE) \
|
||||
V(CODE_TYPE) \
|
||||
V(MUTABLE_HEAP_NUMBER_TYPE) \
|
||||
V(FOREIGN_TYPE) \
|
||||
V(BYTE_ARRAY_TYPE) \
|
||||
V(BYTECODE_ARRAY_TYPE) \
|
||||
V(FREE_SPACE_TYPE) \
|
||||
\
|
||||
V(FIXED_INT8_ARRAY_TYPE) \
|
||||
V(FIXED_UINT8_ARRAY_TYPE) \
|
||||
V(FIXED_INT16_ARRAY_TYPE) \
|
||||
V(FIXED_UINT16_ARRAY_TYPE) \
|
||||
V(FIXED_INT32_ARRAY_TYPE) \
|
||||
V(FIXED_UINT32_ARRAY_TYPE) \
|
||||
V(FIXED_FLOAT32_ARRAY_TYPE) \
|
||||
V(FIXED_FLOAT64_ARRAY_TYPE) \
|
||||
V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
|
||||
V(FIXED_BIGINT64_ARRAY_TYPE) \
|
||||
V(FIXED_BIGUINT64_ARRAY_TYPE) \
|
||||
\
|
||||
V(FIXED_DOUBLE_ARRAY_TYPE) \
|
||||
V(FEEDBACK_METADATA_TYPE) \
|
||||
V(FILLER_TYPE) \
|
||||
\
|
||||
V(ACCESS_CHECK_INFO_TYPE) \
|
||||
V(ACCESSOR_INFO_TYPE) \
|
||||
V(ACCESSOR_PAIR_TYPE) \
|
||||
V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
|
||||
V(ALLOCATION_MEMENTO_TYPE) \
|
||||
V(ASYNC_GENERATOR_REQUEST_TYPE) \
|
||||
V(DEBUG_INFO_TYPE) \
|
||||
V(FUNCTION_TEMPLATE_INFO_TYPE) \
|
||||
V(INTERCEPTOR_INFO_TYPE) \
|
||||
V(INTERPRETER_DATA_TYPE) \
|
||||
V(MODULE_INFO_ENTRY_TYPE) \
|
||||
V(MODULE_TYPE) \
|
||||
V(OBJECT_TEMPLATE_INFO_TYPE) \
|
||||
V(PROMISE_CAPABILITY_TYPE) \
|
||||
V(PROMISE_REACTION_TYPE) \
|
||||
V(PROTOTYPE_INFO_TYPE) \
|
||||
V(SCRIPT_TYPE) \
|
||||
V(STACK_FRAME_INFO_TYPE) \
|
||||
V(TUPLE2_TYPE) \
|
||||
V(TUPLE3_TYPE) \
|
||||
V(WASM_DEBUG_INFO_TYPE) \
|
||||
V(WASM_EXPORTED_FUNCTION_DATA_TYPE) \
|
||||
\
|
||||
V(CALLABLE_TASK_TYPE) \
|
||||
V(CALLBACK_TASK_TYPE) \
|
||||
V(PROMISE_FULFILL_REACTION_JOB_TASK_TYPE) \
|
||||
V(PROMISE_REJECT_REACTION_JOB_TASK_TYPE) \
|
||||
V(PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE) \
|
||||
\
|
||||
V(ALLOCATION_SITE_TYPE) \
|
||||
\
|
||||
V(FIXED_ARRAY_TYPE) \
|
||||
V(BOILERPLATE_DESCRIPTION_TYPE) \
|
||||
V(HASH_TABLE_TYPE) \
|
||||
V(ORDERED_HASH_MAP_TYPE) \
|
||||
V(ORDERED_HASH_SET_TYPE) \
|
||||
V(NAME_DICTIONARY_TYPE) \
|
||||
V(GLOBAL_DICTIONARY_TYPE) \
|
||||
V(NUMBER_DICTIONARY_TYPE) \
|
||||
V(SIMPLE_NUMBER_DICTIONARY_TYPE) \
|
||||
V(STRING_TABLE_TYPE) \
|
||||
V(EPHEMERON_HASH_TABLE_TYPE) \
|
||||
V(SCOPE_INFO_TYPE) \
|
||||
V(SCRIPT_CONTEXT_TABLE_TYPE) \
|
||||
\
|
||||
V(BLOCK_CONTEXT_TYPE) \
|
||||
V(CATCH_CONTEXT_TYPE) \
|
||||
V(DEBUG_EVALUATE_CONTEXT_TYPE) \
|
||||
V(EVAL_CONTEXT_TYPE) \
|
||||
V(FUNCTION_CONTEXT_TYPE) \
|
||||
V(MODULE_CONTEXT_TYPE) \
|
||||
V(NATIVE_CONTEXT_TYPE) \
|
||||
V(SCRIPT_CONTEXT_TYPE) \
|
||||
V(WITH_CONTEXT_TYPE) \
|
||||
\
|
||||
V(WEAK_FIXED_ARRAY_TYPE) \
|
||||
V(DESCRIPTOR_ARRAY_TYPE) \
|
||||
V(TRANSITION_ARRAY_TYPE) \
|
||||
\
|
||||
V(CALL_HANDLER_INFO_TYPE) \
|
||||
V(CELL_TYPE) \
|
||||
V(CODE_DATA_CONTAINER_TYPE) \
|
||||
V(FEEDBACK_CELL_TYPE) \
|
||||
V(FEEDBACK_VECTOR_TYPE) \
|
||||
V(LOAD_HANDLER_TYPE) \
|
||||
V(PROPERTY_ARRAY_TYPE) \
|
||||
V(PROPERTY_CELL_TYPE) \
|
||||
V(SHARED_FUNCTION_INFO_TYPE) \
|
||||
V(SMALL_ORDERED_HASH_MAP_TYPE) \
|
||||
V(SMALL_ORDERED_HASH_SET_TYPE) \
|
||||
V(STORE_HANDLER_TYPE) \
|
||||
V(WEAK_CELL_TYPE) \
|
||||
V(WEAK_ARRAY_LIST_TYPE) \
|
||||
\
|
||||
V(JS_PROXY_TYPE) \
|
||||
V(JS_GLOBAL_OBJECT_TYPE) \
|
||||
V(JS_GLOBAL_PROXY_TYPE) \
|
||||
V(JS_MODULE_NAMESPACE_TYPE) \
|
||||
V(JS_SPECIAL_API_OBJECT_TYPE) \
|
||||
V(JS_VALUE_TYPE) \
|
||||
V(JS_API_OBJECT_TYPE) \
|
||||
V(JS_OBJECT_TYPE) \
|
||||
\
|
||||
V(JS_ARGUMENTS_TYPE) \
|
||||
V(JS_ARRAY_BUFFER_TYPE) \
|
||||
V(JS_ARRAY_ITERATOR_TYPE) \
|
||||
V(JS_ARRAY_TYPE) \
|
||||
V(JS_ASYNC_FROM_SYNC_ITERATOR_TYPE) \
|
||||
V(JS_ASYNC_GENERATOR_OBJECT_TYPE) \
|
||||
V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
|
||||
V(JS_DATE_TYPE) \
|
||||
V(JS_ERROR_TYPE) \
|
||||
V(JS_GENERATOR_OBJECT_TYPE) \
|
||||
V(JS_MAP_TYPE) \
|
||||
V(JS_MAP_KEY_ITERATOR_TYPE) \
|
||||
V(JS_MAP_KEY_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_MAP_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_MESSAGE_OBJECT_TYPE) \
|
||||
V(JS_PROMISE_TYPE) \
|
||||
V(JS_REGEXP_TYPE) \
|
||||
V(JS_REGEXP_STRING_ITERATOR_TYPE) \
|
||||
V(JS_SET_TYPE) \
|
||||
V(JS_SET_KEY_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_SET_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_STRING_ITERATOR_TYPE) \
|
||||
V(JS_WEAK_MAP_TYPE) \
|
||||
V(JS_WEAK_SET_TYPE) \
|
||||
V(JS_TYPED_ARRAY_TYPE) \
|
||||
V(JS_DATA_VIEW_TYPE)
|
||||
|
||||
#define INSTANCE_TYPE_LIST_AFTER_INTL(V) \
|
||||
V(WASM_GLOBAL_TYPE) \
|
||||
V(WASM_INSTANCE_TYPE) \
|
||||
V(WASM_MEMORY_TYPE) \
|
||||
V(WASM_MODULE_TYPE) \
|
||||
V(WASM_TABLE_TYPE) \
|
||||
V(JS_BOUND_FUNCTION_TYPE) \
|
||||
V(JS_FUNCTION_TYPE)
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#define INSTANCE_TYPE_LIST(V) \
|
||||
INSTANCE_TYPE_LIST_BEFORE_INTL(V) \
|
||||
V(JS_INTL_LOCALE_TYPE) \
|
||||
INSTANCE_TYPE_LIST_AFTER_INTL(V)
|
||||
#else
|
||||
#define INSTANCE_TYPE_LIST(V) \
|
||||
INSTANCE_TYPE_LIST_BEFORE_INTL(V) \
|
||||
INSTANCE_TYPE_LIST_AFTER_INTL(V)
|
||||
#endif // V8_INTL_SUPPORT
|
||||
|
||||
// Since string types are not consecutive, this macro is used to
|
||||
// iterate over them.
|
||||
#define STRING_TYPE_LIST(V) \
|
||||
V(STRING_TYPE, kVariableSizeSentinel, string, String) \
|
||||
V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \
|
||||
OneByteString) \
|
||||
V(CONS_STRING_TYPE, ConsString::kSize, cons_string, ConsString) \
|
||||
V(CONS_ONE_BYTE_STRING_TYPE, ConsString::kSize, cons_one_byte_string, \
|
||||
ConsOneByteString) \
|
||||
V(SLICED_STRING_TYPE, SlicedString::kSize, sliced_string, SlicedString) \
|
||||
V(SLICED_ONE_BYTE_STRING_TYPE, SlicedString::kSize, sliced_one_byte_string, \
|
||||
SlicedOneByteString) \
|
||||
V(EXTERNAL_STRING_TYPE, ExternalTwoByteString::kSize, external_string, \
|
||||
ExternalString) \
|
||||
V(EXTERNAL_ONE_BYTE_STRING_TYPE, ExternalOneByteString::kSize, \
|
||||
external_one_byte_string, ExternalOneByteString) \
|
||||
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, ExternalTwoByteString::kSize, \
|
||||
external_string_with_one_byte_data, ExternalStringWithOneByteData) \
|
||||
V(SHORT_EXTERNAL_STRING_TYPE, ExternalTwoByteString::kShortSize, \
|
||||
short_external_string, ShortExternalString) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE, ExternalOneByteString::kShortSize, \
|
||||
short_external_one_byte_string, ShortExternalOneByteString) \
|
||||
V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \
|
||||
ExternalTwoByteString::kShortSize, \
|
||||
short_external_string_with_one_byte_data, \
|
||||
ShortExternalStringWithOneByteData) \
|
||||
\
|
||||
V(INTERNALIZED_STRING_TYPE, kVariableSizeSentinel, internalized_string, \
|
||||
InternalizedString) \
|
||||
V(ONE_BYTE_INTERNALIZED_STRING_TYPE, kVariableSizeSentinel, \
|
||||
one_byte_internalized_string, OneByteInternalizedString) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_TYPE, ExternalTwoByteString::kSize, \
|
||||
external_internalized_string, ExternalInternalizedString) \
|
||||
V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE, ExternalOneByteString::kSize, \
|
||||
external_one_byte_internalized_string, ExternalOneByteInternalizedString) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \
|
||||
ExternalTwoByteString::kSize, \
|
||||
external_internalized_string_with_one_byte_data, \
|
||||
ExternalInternalizedStringWithOneByteData) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE, \
|
||||
ExternalTwoByteString::kShortSize, short_external_internalized_string, \
|
||||
ShortExternalInternalizedString) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE, \
|
||||
ExternalOneByteString::kShortSize, \
|
||||
short_external_one_byte_internalized_string, \
|
||||
ShortExternalOneByteInternalizedString) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \
|
||||
ExternalTwoByteString::kShortSize, \
|
||||
short_external_internalized_string_with_one_byte_data, \
|
||||
ShortExternalInternalizedStringWithOneByteData) \
|
||||
V(THIN_STRING_TYPE, ThinString::kSize, thin_string, ThinString) \
|
||||
V(THIN_ONE_BYTE_STRING_TYPE, ThinString::kSize, thin_one_byte_string, \
|
||||
ThinOneByteString)
|
||||
|
||||
// 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?
|
||||
//
|
||||
// Note that for subtle reasons related to the ordering or numerical values of
|
||||
// type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
|
||||
// manually.
|
||||
#define STRUCT_LIST(V) \
|
||||
V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
|
||||
V(ACCESSOR_INFO, AccessorInfo, accessor_info) \
|
||||
V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
|
||||
V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \
|
||||
V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \
|
||||
V(ASYNC_GENERATOR_REQUEST, AsyncGeneratorRequest, async_generator_request) \
|
||||
V(DEBUG_INFO, DebugInfo, debug_info) \
|
||||
V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
|
||||
V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
|
||||
V(INTERPRETER_DATA, InterpreterData, interpreter_data) \
|
||||
V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \
|
||||
V(MODULE, Module, module) \
|
||||
V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
|
||||
V(PROMISE_CAPABILITY, PromiseCapability, promise_capability) \
|
||||
V(PROMISE_REACTION, PromiseReaction, promise_reaction) \
|
||||
V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
|
||||
V(SCRIPT, Script, script) \
|
||||
V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \
|
||||
V(TUPLE2, Tuple2, tuple2) \
|
||||
V(TUPLE3, Tuple3, tuple3) \
|
||||
V(WASM_DEBUG_INFO, WasmDebugInfo, wasm_debug_info) \
|
||||
V(WASM_EXPORTED_FUNCTION_DATA, WasmExportedFunctionData, \
|
||||
wasm_exported_function_data) \
|
||||
V(CALLABLE_TASK, CallableTask, callable_task) \
|
||||
V(CALLBACK_TASK, CallbackTask, callback_task) \
|
||||
V(PROMISE_FULFILL_REACTION_JOB_TASK, PromiseFulfillReactionJobTask, \
|
||||
promise_fulfill_reaction_job_task) \
|
||||
V(PROMISE_REJECT_REACTION_JOB_TASK, PromiseRejectReactionJobTask, \
|
||||
promise_reject_reaction_job_task) \
|
||||
V(PROMISE_RESOLVE_THENABLE_JOB_TASK, PromiseResolveThenableJobTask, \
|
||||
promise_resolve_thenable_job_task)
|
||||
|
||||
#define ALLOCATION_SITE_LIST(V) \
|
||||
V(ALLOCATION_SITE, AllocationSite, WithWeakNext, allocation_site) \
|
||||
V(ALLOCATION_SITE, AllocationSite, WithoutWeakNext, \
|
||||
allocation_site_without_weaknext)
|
||||
|
||||
#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)
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_OBJECTS_DEFINITIONS_H_
|
321
src/objects.h
321
src/objects.h
@ -20,6 +20,7 @@
|
||||
#include "src/field-index.h"
|
||||
#include "src/flags.h"
|
||||
#include "src/messages.h"
|
||||
#include "src/objects-definitions.h"
|
||||
#include "src/property-details.h"
|
||||
#include "src/roots.h"
|
||||
#include "src/utils.h"
|
||||
@ -300,326 +301,6 @@ const int kVariableSizeSentinel = 0;
|
||||
const int kStubMajorKeyBits = 8;
|
||||
const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
||||
|
||||
// All Maps have a field instance_type containing a 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 default
|
||||
// encoding is considered TWO_BYTE. It is not mentioned in the name. ONE_BYTE
|
||||
// encoding is mentioned explicitly in the name. Likewise, the default
|
||||
// representation is considered sequential. It is not mentioned in the
|
||||
// name. 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 a INTERNALIZED_STRING_TYPE (if it is a 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.
|
||||
//
|
||||
// NOTE: Everything following JS_VALUE_TYPE is considered a
|
||||
// JSObject for GC purposes. The first four entries here have typeof
|
||||
// 'object', whereas JS_FUNCTION_TYPE has typeof 'function'.
|
||||
//
|
||||
// NOTE: List had to be split into two, because of conditional item(s) from
|
||||
// INTL namespace. They can't just be appended to the end, because of the
|
||||
// checks we do in tests (expecting JS_FUNCTION_TYPE to be last).
|
||||
#define INSTANCE_TYPE_LIST_BEFORE_INTL(V) \
|
||||
V(INTERNALIZED_STRING_TYPE) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_TYPE) \
|
||||
V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \
|
||||
V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
V(STRING_TYPE) \
|
||||
V(CONS_STRING_TYPE) \
|
||||
V(EXTERNAL_STRING_TYPE) \
|
||||
V(SLICED_STRING_TYPE) \
|
||||
V(THIN_STRING_TYPE) \
|
||||
V(ONE_BYTE_STRING_TYPE) \
|
||||
V(CONS_ONE_BYTE_STRING_TYPE) \
|
||||
V(EXTERNAL_ONE_BYTE_STRING_TYPE) \
|
||||
V(SLICED_ONE_BYTE_STRING_TYPE) \
|
||||
V(THIN_ONE_BYTE_STRING_TYPE) \
|
||||
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
V(SHORT_EXTERNAL_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \
|
||||
V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
|
||||
\
|
||||
V(SYMBOL_TYPE) \
|
||||
V(HEAP_NUMBER_TYPE) \
|
||||
V(BIGINT_TYPE) \
|
||||
V(ODDBALL_TYPE) \
|
||||
\
|
||||
V(MAP_TYPE) \
|
||||
V(CODE_TYPE) \
|
||||
V(MUTABLE_HEAP_NUMBER_TYPE) \
|
||||
V(FOREIGN_TYPE) \
|
||||
V(BYTE_ARRAY_TYPE) \
|
||||
V(BYTECODE_ARRAY_TYPE) \
|
||||
V(FREE_SPACE_TYPE) \
|
||||
\
|
||||
V(FIXED_INT8_ARRAY_TYPE) \
|
||||
V(FIXED_UINT8_ARRAY_TYPE) \
|
||||
V(FIXED_INT16_ARRAY_TYPE) \
|
||||
V(FIXED_UINT16_ARRAY_TYPE) \
|
||||
V(FIXED_INT32_ARRAY_TYPE) \
|
||||
V(FIXED_UINT32_ARRAY_TYPE) \
|
||||
V(FIXED_FLOAT32_ARRAY_TYPE) \
|
||||
V(FIXED_FLOAT64_ARRAY_TYPE) \
|
||||
V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
|
||||
V(FIXED_BIGINT64_ARRAY_TYPE) \
|
||||
V(FIXED_BIGUINT64_ARRAY_TYPE) \
|
||||
\
|
||||
V(FIXED_DOUBLE_ARRAY_TYPE) \
|
||||
V(FEEDBACK_METADATA_TYPE) \
|
||||
V(FILLER_TYPE) \
|
||||
\
|
||||
V(ACCESS_CHECK_INFO_TYPE) \
|
||||
V(ACCESSOR_INFO_TYPE) \
|
||||
V(ACCESSOR_PAIR_TYPE) \
|
||||
V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
|
||||
V(ALLOCATION_MEMENTO_TYPE) \
|
||||
V(ASYNC_GENERATOR_REQUEST_TYPE) \
|
||||
V(DEBUG_INFO_TYPE) \
|
||||
V(FUNCTION_TEMPLATE_INFO_TYPE) \
|
||||
V(INTERCEPTOR_INFO_TYPE) \
|
||||
V(INTERPRETER_DATA_TYPE) \
|
||||
V(MODULE_INFO_ENTRY_TYPE) \
|
||||
V(MODULE_TYPE) \
|
||||
V(OBJECT_TEMPLATE_INFO_TYPE) \
|
||||
V(PROMISE_CAPABILITY_TYPE) \
|
||||
V(PROMISE_REACTION_TYPE) \
|
||||
V(PROTOTYPE_INFO_TYPE) \
|
||||
V(SCRIPT_TYPE) \
|
||||
V(STACK_FRAME_INFO_TYPE) \
|
||||
V(TUPLE2_TYPE) \
|
||||
V(TUPLE3_TYPE) \
|
||||
V(WASM_DEBUG_INFO_TYPE) \
|
||||
V(WASM_EXPORTED_FUNCTION_DATA_TYPE) \
|
||||
\
|
||||
V(CALLABLE_TASK_TYPE) \
|
||||
V(CALLBACK_TASK_TYPE) \
|
||||
V(PROMISE_FULFILL_REACTION_JOB_TASK_TYPE) \
|
||||
V(PROMISE_REJECT_REACTION_JOB_TASK_TYPE) \
|
||||
V(PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE) \
|
||||
\
|
||||
V(ALLOCATION_SITE_TYPE) \
|
||||
\
|
||||
V(FIXED_ARRAY_TYPE) \
|
||||
V(BOILERPLATE_DESCRIPTION_TYPE) \
|
||||
V(HASH_TABLE_TYPE) \
|
||||
V(ORDERED_HASH_MAP_TYPE) \
|
||||
V(ORDERED_HASH_SET_TYPE) \
|
||||
V(NAME_DICTIONARY_TYPE) \
|
||||
V(GLOBAL_DICTIONARY_TYPE) \
|
||||
V(NUMBER_DICTIONARY_TYPE) \
|
||||
V(SIMPLE_NUMBER_DICTIONARY_TYPE) \
|
||||
V(STRING_TABLE_TYPE) \
|
||||
V(EPHEMERON_HASH_TABLE_TYPE) \
|
||||
V(SCOPE_INFO_TYPE) \
|
||||
V(SCRIPT_CONTEXT_TABLE_TYPE) \
|
||||
\
|
||||
V(BLOCK_CONTEXT_TYPE) \
|
||||
V(CATCH_CONTEXT_TYPE) \
|
||||
V(DEBUG_EVALUATE_CONTEXT_TYPE) \
|
||||
V(EVAL_CONTEXT_TYPE) \
|
||||
V(FUNCTION_CONTEXT_TYPE) \
|
||||
V(MODULE_CONTEXT_TYPE) \
|
||||
V(NATIVE_CONTEXT_TYPE) \
|
||||
V(SCRIPT_CONTEXT_TYPE) \
|
||||
V(WITH_CONTEXT_TYPE) \
|
||||
\
|
||||
V(WEAK_FIXED_ARRAY_TYPE) \
|
||||
V(DESCRIPTOR_ARRAY_TYPE) \
|
||||
V(TRANSITION_ARRAY_TYPE) \
|
||||
\
|
||||
V(CALL_HANDLER_INFO_TYPE) \
|
||||
V(CELL_TYPE) \
|
||||
V(CODE_DATA_CONTAINER_TYPE) \
|
||||
V(FEEDBACK_CELL_TYPE) \
|
||||
V(FEEDBACK_VECTOR_TYPE) \
|
||||
V(LOAD_HANDLER_TYPE) \
|
||||
V(PROPERTY_ARRAY_TYPE) \
|
||||
V(PROPERTY_CELL_TYPE) \
|
||||
V(SHARED_FUNCTION_INFO_TYPE) \
|
||||
V(SMALL_ORDERED_HASH_MAP_TYPE) \
|
||||
V(SMALL_ORDERED_HASH_SET_TYPE) \
|
||||
V(STORE_HANDLER_TYPE) \
|
||||
V(WEAK_CELL_TYPE) \
|
||||
V(WEAK_ARRAY_LIST_TYPE) \
|
||||
\
|
||||
V(JS_PROXY_TYPE) \
|
||||
V(JS_GLOBAL_OBJECT_TYPE) \
|
||||
V(JS_GLOBAL_PROXY_TYPE) \
|
||||
V(JS_MODULE_NAMESPACE_TYPE) \
|
||||
V(JS_SPECIAL_API_OBJECT_TYPE) \
|
||||
V(JS_VALUE_TYPE) \
|
||||
V(JS_API_OBJECT_TYPE) \
|
||||
V(JS_OBJECT_TYPE) \
|
||||
\
|
||||
V(JS_ARGUMENTS_TYPE) \
|
||||
V(JS_ARRAY_BUFFER_TYPE) \
|
||||
V(JS_ARRAY_ITERATOR_TYPE) \
|
||||
V(JS_ARRAY_TYPE) \
|
||||
V(JS_ASYNC_FROM_SYNC_ITERATOR_TYPE) \
|
||||
V(JS_ASYNC_GENERATOR_OBJECT_TYPE) \
|
||||
V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
|
||||
V(JS_DATE_TYPE) \
|
||||
V(JS_ERROR_TYPE) \
|
||||
V(JS_GENERATOR_OBJECT_TYPE) \
|
||||
V(JS_MAP_TYPE) \
|
||||
V(JS_MAP_KEY_ITERATOR_TYPE) \
|
||||
V(JS_MAP_KEY_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_MAP_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_MESSAGE_OBJECT_TYPE) \
|
||||
V(JS_PROMISE_TYPE) \
|
||||
V(JS_REGEXP_TYPE) \
|
||||
V(JS_REGEXP_STRING_ITERATOR_TYPE) \
|
||||
V(JS_SET_TYPE) \
|
||||
V(JS_SET_KEY_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_SET_VALUE_ITERATOR_TYPE) \
|
||||
V(JS_STRING_ITERATOR_TYPE) \
|
||||
V(JS_WEAK_MAP_TYPE) \
|
||||
V(JS_WEAK_SET_TYPE) \
|
||||
V(JS_TYPED_ARRAY_TYPE) \
|
||||
V(JS_DATA_VIEW_TYPE)
|
||||
|
||||
#define INSTANCE_TYPE_LIST_AFTER_INTL(V) \
|
||||
V(WASM_GLOBAL_TYPE) \
|
||||
V(WASM_INSTANCE_TYPE) \
|
||||
V(WASM_MEMORY_TYPE) \
|
||||
V(WASM_MODULE_TYPE) \
|
||||
V(WASM_TABLE_TYPE) \
|
||||
V(JS_BOUND_FUNCTION_TYPE) \
|
||||
V(JS_FUNCTION_TYPE)
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#define INSTANCE_TYPE_LIST(V) \
|
||||
INSTANCE_TYPE_LIST_BEFORE_INTL(V) \
|
||||
V(JS_INTL_LOCALE_TYPE) \
|
||||
INSTANCE_TYPE_LIST_AFTER_INTL(V)
|
||||
#else
|
||||
#define INSTANCE_TYPE_LIST(V) \
|
||||
INSTANCE_TYPE_LIST_BEFORE_INTL(V) \
|
||||
INSTANCE_TYPE_LIST_AFTER_INTL(V)
|
||||
#endif // V8_INTL_SUPPORT
|
||||
|
||||
// Since string types are not consecutive, this macro is used to
|
||||
// iterate over them.
|
||||
#define STRING_TYPE_LIST(V) \
|
||||
V(STRING_TYPE, kVariableSizeSentinel, string, String) \
|
||||
V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \
|
||||
OneByteString) \
|
||||
V(CONS_STRING_TYPE, ConsString::kSize, cons_string, ConsString) \
|
||||
V(CONS_ONE_BYTE_STRING_TYPE, ConsString::kSize, cons_one_byte_string, \
|
||||
ConsOneByteString) \
|
||||
V(SLICED_STRING_TYPE, SlicedString::kSize, sliced_string, SlicedString) \
|
||||
V(SLICED_ONE_BYTE_STRING_TYPE, SlicedString::kSize, sliced_one_byte_string, \
|
||||
SlicedOneByteString) \
|
||||
V(EXTERNAL_STRING_TYPE, ExternalTwoByteString::kSize, external_string, \
|
||||
ExternalString) \
|
||||
V(EXTERNAL_ONE_BYTE_STRING_TYPE, ExternalOneByteString::kSize, \
|
||||
external_one_byte_string, ExternalOneByteString) \
|
||||
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, ExternalTwoByteString::kSize, \
|
||||
external_string_with_one_byte_data, ExternalStringWithOneByteData) \
|
||||
V(SHORT_EXTERNAL_STRING_TYPE, ExternalTwoByteString::kShortSize, \
|
||||
short_external_string, ShortExternalString) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE, ExternalOneByteString::kShortSize, \
|
||||
short_external_one_byte_string, ShortExternalOneByteString) \
|
||||
V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \
|
||||
ExternalTwoByteString::kShortSize, \
|
||||
short_external_string_with_one_byte_data, \
|
||||
ShortExternalStringWithOneByteData) \
|
||||
\
|
||||
V(INTERNALIZED_STRING_TYPE, kVariableSizeSentinel, internalized_string, \
|
||||
InternalizedString) \
|
||||
V(ONE_BYTE_INTERNALIZED_STRING_TYPE, kVariableSizeSentinel, \
|
||||
one_byte_internalized_string, OneByteInternalizedString) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_TYPE, ExternalTwoByteString::kSize, \
|
||||
external_internalized_string, ExternalInternalizedString) \
|
||||
V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE, ExternalOneByteString::kSize, \
|
||||
external_one_byte_internalized_string, ExternalOneByteInternalizedString) \
|
||||
V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \
|
||||
ExternalTwoByteString::kSize, \
|
||||
external_internalized_string_with_one_byte_data, \
|
||||
ExternalInternalizedStringWithOneByteData) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE, \
|
||||
ExternalTwoByteString::kShortSize, short_external_internalized_string, \
|
||||
ShortExternalInternalizedString) \
|
||||
V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE, \
|
||||
ExternalOneByteString::kShortSize, \
|
||||
short_external_one_byte_internalized_string, \
|
||||
ShortExternalOneByteInternalizedString) \
|
||||
V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \
|
||||
ExternalTwoByteString::kShortSize, \
|
||||
short_external_internalized_string_with_one_byte_data, \
|
||||
ShortExternalInternalizedStringWithOneByteData) \
|
||||
V(THIN_STRING_TYPE, ThinString::kSize, thin_string, ThinString) \
|
||||
V(THIN_ONE_BYTE_STRING_TYPE, ThinString::kSize, thin_one_byte_string, \
|
||||
ThinOneByteString)
|
||||
|
||||
// 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?
|
||||
//
|
||||
// Note that for subtle reasons related to the ordering or numerical values of
|
||||
// type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
|
||||
// manually.
|
||||
#define STRUCT_LIST(V) \
|
||||
V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
|
||||
V(ACCESSOR_INFO, AccessorInfo, accessor_info) \
|
||||
V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
|
||||
V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \
|
||||
V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \
|
||||
V(ASYNC_GENERATOR_REQUEST, AsyncGeneratorRequest, async_generator_request) \
|
||||
V(DEBUG_INFO, DebugInfo, debug_info) \
|
||||
V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
|
||||
V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
|
||||
V(INTERPRETER_DATA, InterpreterData, interpreter_data) \
|
||||
V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \
|
||||
V(MODULE, Module, module) \
|
||||
V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
|
||||
V(PROMISE_CAPABILITY, PromiseCapability, promise_capability) \
|
||||
V(PROMISE_REACTION, PromiseReaction, promise_reaction) \
|
||||
V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
|
||||
V(SCRIPT, Script, script) \
|
||||
V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \
|
||||
V(TUPLE2, Tuple2, tuple2) \
|
||||
V(TUPLE3, Tuple3, tuple3) \
|
||||
V(WASM_DEBUG_INFO, WasmDebugInfo, wasm_debug_info) \
|
||||
V(WASM_EXPORTED_FUNCTION_DATA, WasmExportedFunctionData, \
|
||||
wasm_exported_function_data) \
|
||||
V(CALLABLE_TASK, CallableTask, callable_task) \
|
||||
V(CALLBACK_TASK, CallbackTask, callback_task) \
|
||||
V(PROMISE_FULFILL_REACTION_JOB_TASK, PromiseFulfillReactionJobTask, \
|
||||
promise_fulfill_reaction_job_task) \
|
||||
V(PROMISE_REJECT_REACTION_JOB_TASK, PromiseRejectReactionJobTask, \
|
||||
promise_reject_reaction_job_task) \
|
||||
V(PROMISE_RESOLVE_THENABLE_JOB_TASK, PromiseResolveThenableJobTask, \
|
||||
promise_resolve_thenable_job_task)
|
||||
|
||||
#define ALLOCATION_SITE_LIST(V) \
|
||||
V(ALLOCATION_SITE, AllocationSite, WithWeakNext, allocation_site) \
|
||||
V(ALLOCATION_SITE, AllocationSite, WithoutWeakNext, \
|
||||
allocation_site_without_weaknext)
|
||||
|
||||
#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)
|
||||
|
||||
// We use the full 16 bits of the instance_type field to encode heap object
|
||||
// instance types. All the high-order bits (bit 7-15) are cleared if the object
|
||||
// is a string, and contain set bits if it is not a string.
|
||||
|
@ -13,6 +13,8 @@ namespace v8 {
|
||||
|
||||
namespace internal {
|
||||
|
||||
ReadOnlyRoots::ReadOnlyRoots(Isolate* isolate) : heap_(isolate->heap()) {}
|
||||
|
||||
#define ROOT_ACCESSOR(type, name, camel_name) \
|
||||
type* ReadOnlyRoots::name() { return heap_->name(); }
|
||||
STRONG_READ_ONLY_ROOT_LIST(ROOT_ACCESSOR)
|
||||
@ -34,6 +36,16 @@ PUBLIC_SYMBOL_LIST(SYMBOL_ACCESSOR)
|
||||
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
|
||||
#undef SYMBOL_ACCESSOR
|
||||
|
||||
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
|
||||
Map* ReadOnlyRoots::name##_map() { return heap_->name##_map(); }
|
||||
STRUCT_LIST(STRUCT_MAP_ACCESSOR)
|
||||
#undef STRUCT_MAP_ACCESSOR
|
||||
|
||||
#define ALLOCATION_SITE_MAP_ACCESSOR(NAME, Name, Size, name) \
|
||||
Map* ReadOnlyRoots::name##_map() { return heap_->name##_map(); }
|
||||
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_ACCESSOR)
|
||||
#undef ALLOCATION_SITE_MAP_ACCESSOR
|
||||
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
41
src/roots.h
41
src/roots.h
@ -6,6 +6,7 @@
|
||||
#define V8_ROOTS_H_
|
||||
|
||||
#include "src/heap-symbols.h"
|
||||
#include "src/objects-definitions.h"
|
||||
|
||||
namespace v8 {
|
||||
|
||||
@ -76,11 +77,9 @@ namespace internal {
|
||||
V(Map, bytecode_array_map, BytecodeArrayMap) \
|
||||
V(Map, code_data_container_map, CodeDataContainerMap) \
|
||||
V(Map, descriptor_array_map, DescriptorArrayMap) \
|
||||
V(Map, external_map, ExternalMap) \
|
||||
V(Map, fixed_double_array_map, FixedDoubleArrayMap) \
|
||||
V(Map, global_dictionary_map, GlobalDictionaryMap) \
|
||||
V(Map, many_closures_cell_map, ManyClosuresCellMap) \
|
||||
V(Map, message_object_map, JSMessageObjectMap) \
|
||||
V(Map, module_info_map, ModuleInfoMap) \
|
||||
V(Map, mutable_heap_number_map, MutableHeapNumberMap) \
|
||||
V(Map, name_dictionary_map, NameDictionaryMap) \
|
||||
@ -175,8 +174,6 @@ namespace internal {
|
||||
V(FixedTypedArrayBase, empty_fixed_biguint64_array, \
|
||||
EmptyFixedBigUint64Array) \
|
||||
V(FixedTypedArrayBase, empty_fixed_bigint64_array, EmptyFixedBigInt64Array) \
|
||||
V(Script, empty_script, EmptyScript) \
|
||||
V(FeedbackCell, many_closures_cell, ManyClosuresCell) \
|
||||
V(FixedArray, empty_sloppy_arguments_elements, EmptySloppyArgumentsElements) \
|
||||
V(NumberDictionary, empty_slow_element_dictionary, \
|
||||
EmptySlowElementDictionary) \
|
||||
@ -185,7 +182,6 @@ namespace internal {
|
||||
V(FeedbackMetadata, empty_feedback_metadata, EmptyFeedbackMetadata) \
|
||||
V(PropertyCell, empty_property_cell, EmptyPropertyCell) \
|
||||
V(WeakCell, empty_weak_cell, EmptyWeakCell) \
|
||||
V(Cell, invalid_prototype_validity_cell, InvalidPrototypeValidityCell) \
|
||||
V(InterceptorInfo, noop_interceptor_info, NoOpInterceptorInfo) \
|
||||
V(WeakFixedArray, empty_weak_fixed_array, EmptyWeakFixedArray) \
|
||||
V(WeakArrayList, empty_weak_array_list, EmptyWeakArrayList) \
|
||||
@ -196,11 +192,16 @@ namespace internal {
|
||||
V(HeapNumber, minus_zero_value, MinusZeroValue) \
|
||||
V(HeapNumber, minus_infinity_value, MinusInfinityValue) \
|
||||
/* Marker for self-references during code-generation */ \
|
||||
V(HeapObject, self_reference_marker, SelfReferenceMarker) \
|
||||
/* Indirection lists for isolate-independent builtins */ \
|
||||
V(FixedArray, builtins_constants_table, BuiltinsConstantsTable)
|
||||
V(HeapObject, self_reference_marker, SelfReferenceMarker)
|
||||
|
||||
#define STRONG_MUTABLE_ROOT_LIST(V) \
|
||||
/* Maps */ \
|
||||
V(Map, external_map, ExternalMap) \
|
||||
V(Map, message_object_map, JSMessageObjectMap) \
|
||||
/* Canonical empty values */ \
|
||||
V(Script, empty_script, EmptyScript) \
|
||||
V(FeedbackCell, many_closures_cell, ManyClosuresCell) \
|
||||
V(Cell, invalid_prototype_validity_cell, InvalidPrototypeValidityCell) \
|
||||
/* Protectors */ \
|
||||
V(Cell, array_constructor_protector, ArrayConstructorProtector) \
|
||||
V(PropertyCell, no_elements_protector, NoElementsProtector) \
|
||||
@ -232,6 +233,8 @@ namespace internal {
|
||||
V(FixedArray, detached_contexts, DetachedContexts) \
|
||||
V(HeapObject, retaining_path_targets, RetainingPathTargets) \
|
||||
V(WeakArrayList, retained_maps, RetainedMaps) \
|
||||
/* Indirection lists for isolate-independent builtins */ \
|
||||
V(FixedArray, builtins_constants_table, BuiltinsConstantsTable) \
|
||||
/* Feedback vectors that we need for code coverage or type profile */ \
|
||||
V(Object, feedback_vectors_for_profiling_tools, \
|
||||
FeedbackVectorsForProfilingTools) \
|
||||
@ -271,18 +274,24 @@ namespace internal {
|
||||
ConstructStubInvokeDeoptPCOffset) \
|
||||
V(Smi, interpreter_entry_return_pc_offset, InterpreterEntryReturnPCOffset)
|
||||
|
||||
#define ROOT_LIST(V) \
|
||||
STRONG_ROOT_LIST(V) \
|
||||
SMI_ROOT_LIST(V) \
|
||||
#define MUTABLE_ROOT_LIST(V) \
|
||||
STRONG_MUTABLE_ROOT_LIST(V) \
|
||||
SMI_ROOT_LIST(V) \
|
||||
V(StringTable, string_table, StringTable)
|
||||
|
||||
#define ROOT_LIST(V) \
|
||||
MUTABLE_ROOT_LIST(V) \
|
||||
STRONG_READ_ONLY_ROOT_LIST(V)
|
||||
|
||||
class Heap;
|
||||
class Isolate;
|
||||
class String;
|
||||
class Symbol;
|
||||
|
||||
class ReadOnlyRoots {
|
||||
public:
|
||||
explicit ReadOnlyRoots(Heap* heap) : heap_(heap) {}
|
||||
inline explicit ReadOnlyRoots(Isolate* isolate);
|
||||
|
||||
#define ROOT_ACCESSOR(type, name, camel_name) inline class type* name();
|
||||
STRONG_READ_ONLY_ROOT_LIST(ROOT_ACCESSOR)
|
||||
@ -301,6 +310,16 @@ class ReadOnlyRoots {
|
||||
WELL_KNOWN_SYMBOL_LIST(SYMBOL_ACCESSOR)
|
||||
#undef SYMBOL_ACCESSOR
|
||||
|
||||
// Utility type maps.
|
||||
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) inline Map* name##_map();
|
||||
STRUCT_LIST(STRUCT_MAP_ACCESSOR)
|
||||
#undef STRUCT_MAP_ACCESSOR
|
||||
|
||||
#define ALLOCATION_SITE_MAP_ACCESSOR(NAME, Name, Size, name) \
|
||||
inline Map* name##_map();
|
||||
ALLOCATION_SITE_LIST(ALLOCATION_SITE_MAP_ACCESSOR)
|
||||
#undef ALLOCATION_SITE_MAP_ACCESSOR
|
||||
|
||||
private:
|
||||
Heap* heap_;
|
||||
};
|
||||
|
@ -41,21 +41,25 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
||||
void Free(void* p, size_t) override {}
|
||||
};
|
||||
|
||||
#define RO_ROOT_LIST_CASE(type, name, camel_name) \
|
||||
if (n == NULL && o == roots.name()) n = #camel_name;
|
||||
#define ROOT_LIST_CASE(type, name, camel_name) \
|
||||
if (n == NULL && o == space->heap()->name()) n = #camel_name;
|
||||
#define STRUCT_LIST_CASE(upper_name, camel_name, name) \
|
||||
if (n == NULL && o == space->heap()->name##_map()) n = #camel_name "Map";
|
||||
if (n == NULL && o == roots.name##_map()) n = #camel_name "Map";
|
||||
#define ALLOCATION_SITE_LIST_CASE(upper_name, camel_name, size, name) \
|
||||
if (n == NULL && o == space->heap()->name##_map()) n = #camel_name "Map";
|
||||
if (n == NULL && o == roots.name##_map()) n = #camel_name "Map";
|
||||
static void DumpMaps(i::PagedSpace* space) {
|
||||
i::HeapObjectIterator it(space);
|
||||
i::ReadOnlyRoots roots(space->heap());
|
||||
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
|
||||
if (!o->IsMap()) continue;
|
||||
i::Map* m = i::Map::cast(o);
|
||||
const char* n = NULL;
|
||||
intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7FFFF;
|
||||
int t = m->instance_type();
|
||||
ROOT_LIST(ROOT_LIST_CASE)
|
||||
STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE)
|
||||
MUTABLE_ROOT_LIST(ROOT_LIST_CASE)
|
||||
STRUCT_LIST(STRUCT_LIST_CASE)
|
||||
ALLOCATION_SITE_LIST(ALLOCATION_SITE_LIST_CASE)
|
||||
if (n == NULL) continue;
|
||||
@ -67,6 +71,7 @@ static void DumpMaps(i::PagedSpace* space) {
|
||||
#undef ALLOCATION_SITE_LIST_CASE
|
||||
#undef STRUCT_LIST_CASE
|
||||
#undef ROOT_LIST_CASE
|
||||
#undef RO_ROOT_LIST_CASE
|
||||
|
||||
static int DumpHeapConstants(const char* argv0) {
|
||||
// Start up V8.
|
||||
@ -81,6 +86,7 @@ static int DumpHeapConstants(const char* argv0) {
|
||||
{
|
||||
Isolate::Scope scope(isolate);
|
||||
i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap();
|
||||
i::ReadOnlyRoots roots(heap);
|
||||
i::PrintF("%s", kHeader);
|
||||
#define DUMP_TYPE(T) i::PrintF(" %d: \"%s\",\n", i::T, #T);
|
||||
i::PrintF("INSTANCE_TYPES = {\n");
|
||||
@ -97,6 +103,11 @@ static int DumpHeapConstants(const char* argv0) {
|
||||
|
||||
// Dump the KNOWN_OBJECTS table to the console.
|
||||
i::PrintF("\n# List of known V8 objects.\n");
|
||||
#define RO_ROOT_LIST_CASE(type, name, camel_name) \
|
||||
if (n == NULL && o == roots.name()) { \
|
||||
n = #camel_name; \
|
||||
i = i::Heap::k##camel_name##RootIndex; \
|
||||
}
|
||||
#define ROOT_LIST_CASE(type, name, camel_name) \
|
||||
if (n == NULL && o == heap->name()) { \
|
||||
n = #camel_name; \
|
||||
@ -116,7 +127,8 @@ static int DumpHeapConstants(const char* argv0) {
|
||||
const char* n = NULL;
|
||||
i::Heap::RootListIndex i = i::Heap::kStrongRootListLength;
|
||||
intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7FFFF;
|
||||
ROOT_LIST(ROOT_LIST_CASE)
|
||||
STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE)
|
||||
MUTABLE_ROOT_LIST(ROOT_LIST_CASE)
|
||||
if (n == NULL) continue;
|
||||
if (!i::Heap::RootIsImmortalImmovable(i)) continue;
|
||||
i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n);
|
||||
@ -124,6 +136,7 @@ static int DumpHeapConstants(const char* argv0) {
|
||||
}
|
||||
i::PrintF("}\n");
|
||||
#undef ROOT_LIST_CASE
|
||||
#undef RO_ROOT_LIST_CASE
|
||||
|
||||
// Dump frame markers
|
||||
i::PrintF("\n# List of known V8 Frame Markers.\n");
|
||||
|
@ -272,8 +272,8 @@ KNOWN_MAPS = {
|
||||
("RO_SPACE", 0x04f99): (148, "FixedBigInt64ArrayMap"),
|
||||
("RO_SPACE", 0x05001): (131, "SelfReferenceMarkerMap"),
|
||||
("RO_SPACE", 0x05081): (171, "Tuple2Map"),
|
||||
("RO_SPACE", 0x05279): (169, "ScriptMap"),
|
||||
("RO_SPACE", 0x05441): (161, "InterceptorInfoMap"),
|
||||
("RO_SPACE", 0x053c9): (161, "InterceptorInfoMap"),
|
||||
("RO_SPACE", 0x054e9): (169, "ScriptMap"),
|
||||
("RO_SPACE", 0x09dc1): (154, "AccessorInfoMap"),
|
||||
("RO_SPACE", 0x09fd1): (153, "AccessCheckInfoMap"),
|
||||
("RO_SPACE", 0x0a039): (155, "AccessorPairMap"),
|
||||
@ -333,26 +333,26 @@ KNOWN_OBJECTS = {
|
||||
("RO_SPACE", 0x051d9): "EmptyFixedFloat32Array",
|
||||
("RO_SPACE", 0x051f9): "EmptyFixedFloat64Array",
|
||||
("RO_SPACE", 0x05219): "EmptyFixedUint8ClampedArray",
|
||||
("RO_SPACE", 0x052f1): "EmptySloppyArgumentsElements",
|
||||
("RO_SPACE", 0x05311): "EmptySlowElementDictionary",
|
||||
("RO_SPACE", 0x05359): "EmptyOrderedHashMap",
|
||||
("RO_SPACE", 0x05381): "EmptyOrderedHashSet",
|
||||
("RO_SPACE", 0x053b9): "EmptyPropertyCell",
|
||||
("RO_SPACE", 0x053e1): "EmptyWeakCell",
|
||||
("RO_SPACE", 0x054c1): "InfinityValue",
|
||||
("RO_SPACE", 0x054d1): "MinusZeroValue",
|
||||
("RO_SPACE", 0x054e1): "MinusInfinityValue",
|
||||
("RO_SPACE", 0x054f1): "SelfReferenceMarker",
|
||||
("RO_SPACE", 0x05279): "EmptySloppyArgumentsElements",
|
||||
("RO_SPACE", 0x05299): "EmptySlowElementDictionary",
|
||||
("RO_SPACE", 0x052e1): "EmptyOrderedHashMap",
|
||||
("RO_SPACE", 0x05309): "EmptyOrderedHashSet",
|
||||
("RO_SPACE", 0x05341): "EmptyPropertyCell",
|
||||
("RO_SPACE", 0x05369): "EmptyWeakCell",
|
||||
("RO_SPACE", 0x05459): "InfinityValue",
|
||||
("RO_SPACE", 0x05469): "MinusZeroValue",
|
||||
("RO_SPACE", 0x05479): "MinusInfinityValue",
|
||||
("RO_SPACE", 0x05489): "SelfReferenceMarker",
|
||||
("OLD_SPACE", 0x02211): "EmptyScript",
|
||||
("OLD_SPACE", 0x02299): "ManyClosuresCell",
|
||||
("OLD_SPACE", 0x02919): "NoElementsProtector",
|
||||
("OLD_SPACE", 0x02941): "IsConcatSpreadableProtector",
|
||||
("OLD_SPACE", 0x02951): "ArraySpeciesProtector",
|
||||
("OLD_SPACE", 0x02979): "TypedArraySpeciesProtector",
|
||||
("OLD_SPACE", 0x029a1): "PromiseSpeciesProtector",
|
||||
("OLD_SPACE", 0x029c9): "StringLengthProtector",
|
||||
("OLD_SPACE", 0x029d9): "ArrayIteratorProtector",
|
||||
("OLD_SPACE", 0x02a01): "ArrayBufferNeuteringProtector",
|
||||
("OLD_SPACE", 0x022b9): "NoElementsProtector",
|
||||
("OLD_SPACE", 0x022e1): "IsConcatSpreadableProtector",
|
||||
("OLD_SPACE", 0x022f1): "ArraySpeciesProtector",
|
||||
("OLD_SPACE", 0x02319): "TypedArraySpeciesProtector",
|
||||
("OLD_SPACE", 0x02341): "PromiseSpeciesProtector",
|
||||
("OLD_SPACE", 0x02369): "StringLengthProtector",
|
||||
("OLD_SPACE", 0x02379): "ArrayIteratorProtector",
|
||||
("OLD_SPACE", 0x023a1): "ArrayBufferNeuteringProtector",
|
||||
}
|
||||
|
||||
# List of known V8 Frame Markers.
|
||||
|
Loading…
Reference in New Issue
Block a user