#include "src/heap/factory.h"
#include <algorithm>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "src/ast/ast-source-ranges.h"
#include "src/base/bits.h"
#include "src/builtins/accessors.h"
#include "src/builtins/constants-table-builder.h"
#include "src/codegen/compilation-cache.h"
#include "src/codegen/compiler.h"
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/diagnostics/basic-block-profiler.h"
#include "src/execution/isolate-inl.h"
#include "src/execution/protectors-inl.h"
#include "src/flags/flags.h"
#include "src/heap/heap-allocator-inl.h"
#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/large-page-metadata-inl.h"
#include "src/heap/mark-compact-inl.h"
#include "src/heap/memory-chunk-metadata.h"
#include "src/heap/mutable-page-metadata.h"
#include "src/heap/read-only-heap.h"
#include "src/ic/handler-configuration-inl.h"
#include "src/init/bootstrapper.h"
#include "src/interpreter/interpreter.h"
#include "src/logging/counters.h"
#include "src/logging/log.h"
#include "src/numbers/conversions.h"
#include "src/numbers/hash-seed-inl.h"
#include "src/objects/allocation-site-inl.h"
#include "src/objects/allocation-site-scopes.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/bigint.h"
#include "src/objects/call-site-info-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/embedder-data-array-inl.h"
#include "src/objects/feedback-cell-inl.h"
#include "src/objects/feedback-cell.h"
#include "src/objects/fixed-array-inl.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/heap-object.h"
#include "src/objects/instance-type-inl.h"
#include "src/objects/instance-type.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-array-buffer.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/js-atomics-synchronization-inl.h"
#include "src/objects/js-collection-inl.h"
#include "src/objects/js-disposable-stack-inl.h"
#include "src/objects/js-generator-inl.h"
#include "src/objects/js-objects.h"
#include "src/objects/js-regexp-inl.h"
#include "src/objects/js-shared-array-inl.h"
#include "src/objects/js-struct-inl.h"
#include "src/objects/js-weak-refs-inl.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/managed-inl.h"
#include "src/objects/megadom-handler-inl.h"
#include "src/objects/microtask-inl.h"
#include "src/objects/module-inl.h"
#include "src/objects/objects.h"
#include "src/objects/promise-inl.h"
#include "src/objects/property-descriptor-object-inl.h"
#include "src/objects/scope-info.h"
#include "src/objects/string-set-inl.h"
#include "src/objects/struct-inl.h"
#include "src/objects/synthetic-module-inl.h"
#include "src/objects/template-objects-inl.h"
#include "src/objects/templates.h"
#include "src/objects/transitions-inl.h"
#include "src/roots/roots-inl.h"
#include "src/roots/roots.h"
#include "src/strings/unicode-inl.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/module-decoder-impl.h"
#include "src/wasm/module-instantiate.h"
#include "src/wasm/wasm-opcodes-inl.h"
#include "src/wasm/wasm-result.h"
#include "src/wasm/wasm-value.h"
#endif
#include "src/heap/local-factory-inl.h"
#include "src/heap/local-heap-inl.h"
namespace v8 {
namespace internal {
Factory::CodeBuilder::CodeBuilder(Isolate* isolate, const CodeDesc& desc,
CodeKind kind)
: … { … }
Factory::CodeBuilder::CodeBuilder(LocalIsolate* local_isolate,
const CodeDesc& desc, CodeKind kind)
: … { … }
Handle<TrustedByteArray> Factory::CodeBuilder::NewTrustedByteArray(int length) { … }
Handle<Code> Factory::CodeBuilder::NewCode(const NewCodeOptions& options) { … }
MaybeHandle<Code> Factory::CodeBuilder::BuildInternal(
bool retry_allocation_or_fail) { … }
Tagged<HeapObject> Factory::CodeBuilder::AllocateUninitializedInstructionStream(
bool retry_allocation_or_fail) { … }
MaybeHandle<Code> Factory::CodeBuilder::TryBuild() { … }
Handle<Code> Factory::CodeBuilder::Build() { … }
Tagged<HeapObject> Factory::AllocateRaw(int size, AllocationType allocation,
AllocationAlignment alignment) { … }
Tagged<HeapObject> Factory::AllocateRawWithAllocationSite(
DirectHandle<Map> map, AllocationType allocation,
DirectHandle<AllocationSite> allocation_site) { … }
void Factory::InitializeAllocationMemento(
Tagged<AllocationMemento> memento, Tagged<AllocationSite> allocation_site) { … }
Tagged<HeapObject> Factory::New(DirectHandle<Map> map,
AllocationType allocation) { … }
Handle<HeapObject> Factory::NewFillerObject(int size,
AllocationAlignment alignment,
AllocationType allocation,
AllocationOrigin origin) { … }
Handle<PrototypeInfo> Factory::NewPrototypeInfo() { … }
Handle<EnumCache> Factory::NewEnumCache(DirectHandle<FixedArray> keys,
DirectHandle<FixedArray> indices,
AllocationType allocation) { … }
Handle<Tuple2> Factory::NewTuple2Uninitialized(AllocationType allocation) { … }
Handle<Tuple2> Factory::NewTuple2(DirectHandle<Object> value1,
DirectHandle<Object> value2,
AllocationType allocation) { … }
Handle<Hole> Factory::NewHole() { … }
Handle<PropertyArray> Factory::NewPropertyArray(int length,
AllocationType allocation) { … }
MaybeHandle<FixedArray> Factory::TryNewFixedArray(
int length, AllocationType allocation_type) { … }
Handle<FeedbackVector> Factory::NewFeedbackVector(
DirectHandle<SharedFunctionInfo> shared,
DirectHandle<ClosureFeedbackCellArray> closure_feedback_cell_array,
DirectHandle<FeedbackCell> parent_feedback_cell) { … }
Handle<EmbedderDataArray> Factory::NewEmbedderDataArray(int length) { … }
Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles(int length) { … }
template <typename T>
Handle<T> Factory::AllocateSmallOrderedHashTable(DirectHandle<Map> map,
int capacity,
AllocationType allocation) { … }
Handle<SmallOrderedHashSet> Factory::NewSmallOrderedHashSet(
int capacity, AllocationType allocation) { … }
Handle<SmallOrderedHashMap> Factory::NewSmallOrderedHashMap(
int capacity, AllocationType allocation) { … }
Handle<SmallOrderedNameDictionary> Factory::NewSmallOrderedNameDictionary(
int capacity, AllocationType allocation) { … }
Handle<OrderedHashSet> Factory::NewOrderedHashSet() { … }
Handle<OrderedHashMap> Factory::NewOrderedHashMap() { … }
Handle<NameDictionary> Factory::NewNameDictionary(int at_least_space_for) { … }
Handle<PropertyDescriptorObject> Factory::NewPropertyDescriptorObject() { … }
Handle<SwissNameDictionary> Factory::CreateCanonicalEmptySwissNameDictionary() { … }
Handle<String> Factory::InternalizeUtf8String(base::Vector<const char> string) { … }
template <typename SeqString>
Handle<String> Factory::InternalizeString(Handle<SeqString> string, int from,
int length, bool convert_encoding) { … }
template Handle<String> Factory::InternalizeString(
Handle<SeqOneByteString> string, int from, int length,
bool convert_encoding);
template Handle<String> Factory::InternalizeString(
Handle<SeqTwoByteString> string, int from, int length,
bool convert_encoding);
namespace {
void ThrowInvalidEncodedStringBytes(Isolate* isolate, MessageTemplate message) { … }
template <typename Decoder, typename PeekBytes>
MaybeHandle<String> NewStringFromBytes(Isolate* isolate, PeekBytes peek_bytes,
AllocationType allocation,
MessageTemplate message) { … }
template <typename PeekBytes>
MaybeHandle<String> NewStringFromUtf8Variant(Isolate* isolate,
PeekBytes peek_bytes,
unibrow::Utf8Variant utf8_variant,
AllocationType allocation) { … }
}
MaybeHandle<String> Factory::NewStringFromUtf8(
base::Vector<const uint8_t> string, unibrow::Utf8Variant utf8_variant,
AllocationType allocation) { … }
MaybeHandle<String> Factory::NewStringFromUtf8(base::Vector<const char> string,
AllocationType allocation) { … }
#if V8_ENABLE_WEBASSEMBLY
MaybeHandle<String> Factory::NewStringFromUtf8(
DirectHandle<WasmArray> array, uint32_t start, uint32_t end,
unibrow::Utf8Variant utf8_variant, AllocationType allocation) { … }
MaybeHandle<String> Factory::NewStringFromUtf8(
DirectHandle<ByteArray> array, uint32_t start, uint32_t end,
unibrow::Utf8Variant utf8_variant, AllocationType allocation) { … }
namespace {
struct Wtf16Decoder { … };
}
MaybeHandle<String> Factory::NewStringFromUtf16(DirectHandle<WasmArray> array,
uint32_t start, uint32_t end,
AllocationType allocation) { … }
#endif
MaybeHandle<String> Factory::NewStringFromUtf8SubString(
Handle<SeqOneByteString> str, int begin, int length,
AllocationType allocation) { … }
MaybeHandle<String> Factory::NewStringFromTwoByte(const base::uc16* string,
int length,
AllocationType allocation) { … }
MaybeHandle<String> Factory::NewStringFromTwoByte(
base::Vector<const base::uc16> string, AllocationType allocation) { … }
MaybeHandle<String> Factory::NewStringFromTwoByte(
const ZoneVector<base::uc16>* string, AllocationType allocation) { … }
#if V8_ENABLE_WEBASSEMBLY
MaybeHandle<String> Factory::NewStringFromTwoByteLittleEndian(
base::Vector<const base::uc16> str, AllocationType allocation) { … }
#endif
Handle<String> Factory::NewInternalizedStringImpl(DirectHandle<String> string,
int len,
uint32_t hash_field) { … }
StringTransitionStrategy Factory::ComputeInternalizationStrategyForString(
DirectHandle<String> string, MaybeDirectHandle<Map>* internalized_map) { … }
template <class StringClass>
Handle<StringClass> Factory::InternalizeExternalString(
DirectHandle<String> string) { … }
template Handle<ExternalOneByteString> Factory::InternalizeExternalString<
ExternalOneByteString>(DirectHandle<String>);
template Handle<ExternalTwoByteString> Factory::InternalizeExternalString<
ExternalTwoByteString>(DirectHandle<String>);
StringTransitionStrategy Factory::ComputeSharingStrategyForString(
DirectHandle<String> string, MaybeDirectHandle<Map>* shared_map) { … }
Handle<String> Factory::NewSurrogatePairString(uint16_t lead, uint16_t trail) { … }
Handle<String> Factory::NewCopiedSubstring(DirectHandle<String> str, int begin,
int length) { … }
Handle<String> Factory::NewProperSubString(Handle<String> str, int begin,
int end) { … }
MaybeHandle<String> Factory::NewExternalStringFromOneByte(
const ExternalOneByteString::Resource* resource) { … }
MaybeHandle<String> Factory::NewExternalStringFromTwoByte(
const ExternalTwoByteString::Resource* resource) { … }
Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) { … }
Tagged<Symbol> Factory::NewSymbolInternal(AllocationType allocation) { … }
Handle<Symbol> Factory::NewSymbol(AllocationType allocation) { … }
Handle<Symbol> Factory::NewPrivateSymbol(AllocationType allocation) { … }
Handle<Symbol> Factory::NewPrivateNameSymbol(DirectHandle<String> name) { … }
Tagged<Context> Factory::NewContextInternal(DirectHandle<Map> map, int size,
int variadic_part_length,
AllocationType allocation) { … }
Handle<NativeContext> Factory::NewNativeContext() { … }
Handle<Context> Factory::NewScriptContext(DirectHandle<NativeContext> outer,
DirectHandle<ScopeInfo> scope_info) { … }
Handle<ScriptContextTable> Factory::NewScriptContextTable() { … }
Handle<Context> Factory::NewModuleContext(DirectHandle<SourceTextModule> module,
DirectHandle<NativeContext> outer,
DirectHandle<ScopeInfo> scope_info) { … }
Handle<Context> Factory::NewFunctionContext(
DirectHandle<Context> outer, DirectHandle<ScopeInfo> scope_info) { … }
#if V8_SINGLE_GENERATION_BOOL
#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG …
#elif V8_ENABLE_STICKY_MARK_BITS_BOOL
#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG …
#else
#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG(isolate, object) …
#endif
Handle<Context> Factory::NewCatchContext(DirectHandle<Context> previous,
DirectHandle<ScopeInfo> scope_info,
DirectHandle<Object> thrown_object) { … }
Handle<Context> Factory::NewDebugEvaluateContext(
DirectHandle<Context> previous, DirectHandle<ScopeInfo> scope_info,
DirectHandle<JSReceiver> extension, DirectHandle<Context> wrapped) { … }
Handle<Context> Factory::NewWithContext(DirectHandle<Context> previous,
DirectHandle<ScopeInfo> scope_info,
DirectHandle<JSReceiver> extension) { … }
Handle<Context> Factory::NewBlockContext(DirectHandle<Context> previous,
DirectHandle<ScopeInfo> scope_info) { … }
Handle<Context> Factory::NewBuiltinContext(
DirectHandle<NativeContext> native_context, int variadic_part_length) { … }
Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry(
int aliased_context_slot) { … }
Handle<AccessorInfo> Factory::NewAccessorInfo() { … }
Handle<ErrorStackData> Factory::NewErrorStackData(
DirectHandle<UnionOf<JSAny, FixedArray>> call_site_infos_or_formatted_stack,
DirectHandle<UnionOf<Smi, FixedArray>> limit_or_stack_frame_infos) { … }
void Factory::ProcessNewScript(Handle<Script> script,
ScriptEventType script_event_type) { … }
Handle<Script> Factory::CloneScript(DirectHandle<Script> script,
DirectHandle<String> source) { … }
Handle<CallableTask> Factory::NewCallableTask(DirectHandle<JSReceiver> callable,
DirectHandle<Context> context) { … }
Handle<CallbackTask> Factory::NewCallbackTask(DirectHandle<Foreign> callback,
DirectHandle<Foreign> data) { … }
Handle<PromiseResolveThenableJobTask> Factory::NewPromiseResolveThenableJobTask(
DirectHandle<JSPromise> promise_to_resolve,
DirectHandle<JSReceiver> thenable, DirectHandle<JSReceiver> then,
DirectHandle<Context> context) { … }
#if V8_ENABLE_WEBASSEMBLY
Handle<WasmTrustedInstanceData> Factory::NewWasmTrustedInstanceData() { … }
Handle<WasmDispatchTable> Factory::NewWasmDispatchTable(int length) { … }
Handle<WasmTypeInfo> Factory::NewWasmTypeInfo(
Address type_address, Handle<Map> opt_parent,
DirectHandle<WasmTrustedInstanceData> opt_trusted_data,
uint32_t type_index) { … }
Handle<WasmImportData> Factory::NewWasmImportData(
DirectHandle<HeapObject> callable, wasm::Suspend suspend,
MaybeDirectHandle<WasmTrustedInstanceData> instance_data,
DirectHandle<PodArray<wasm::ValueType>> serialized_sig) { … }
Handle<WasmImportData> Factory::NewWasmImportData(
DirectHandle<WasmImportData> import_data) { … }
Handle<WasmFastApiCallData> Factory::NewWasmFastApiCallData(
DirectHandle<HeapObject> signature, DirectHandle<Object> callback_data) { … }
Handle<WasmInternalFunction> Factory::NewWasmInternalFunction(
DirectHandle<TrustedObject> implicit_arg, int function_index,
uintptr_t signature_hash) { … }
Handle<WasmFuncRef> Factory::NewWasmFuncRef(
DirectHandle<WasmInternalFunction> internal_function,
DirectHandle<Map> rtt) { … }
Handle<WasmJSFunctionData> Factory::NewWasmJSFunctionData(
uint32_t canonical_sig_index, DirectHandle<JSReceiver> callable,
DirectHandle<PodArray<wasm::ValueType>> serialized_sig,
DirectHandle<Code> wrapper_code, DirectHandle<Map> rtt,
wasm::Suspend suspend, wasm::Promise promise, uintptr_t signature_hash) { … }
Handle<WasmResumeData> Factory::NewWasmResumeData(
DirectHandle<WasmSuspenderObject> suspender, wasm::OnResume on_resume) { … }
Handle<WasmSuspenderObject> Factory::NewWasmSuspenderObject() { … }
Handle<WasmExportedFunctionData> Factory::NewWasmExportedFunctionData(
DirectHandle<Code> export_wrapper,
DirectHandle<WasmTrustedInstanceData> instance_data,
DirectHandle<WasmFuncRef> func_ref,
DirectHandle<WasmInternalFunction> internal_function,
const wasm::FunctionSig* sig, uint32_t canonical_type_index,
int wrapper_budget, wasm::Promise promise) { … }
Handle<WasmCapiFunctionData> Factory::NewWasmCapiFunctionData(
Address call_target, DirectHandle<Foreign> embedder_data,
DirectHandle<Code> wrapper_code, DirectHandle<Map> rtt,
DirectHandle<PodArray<wasm::ValueType>> serialized_sig,
uintptr_t signature_hash) { … }
Tagged<WasmArray> Factory::NewWasmArrayUninitialized(uint32_t length,
DirectHandle<Map> map) { … }
Handle<WasmArray> Factory::NewWasmArray(wasm::ValueType element_type,
uint32_t length,
wasm::WasmValue initial_value,
DirectHandle<Map> map) { … }
Handle<WasmArray> Factory::NewWasmArrayFromElements(
const wasm::ArrayType* type, base::Vector<wasm::WasmValue> elements,
DirectHandle<Map> map) { … }
Handle<WasmArray> Factory::NewWasmArrayFromMemory(uint32_t length,
DirectHandle<Map> map,
Address source) { … }
Handle<Object> Factory::NewWasmArrayFromElementSegment(
Handle<WasmTrustedInstanceData> trusted_instance_data,
Handle<WasmTrustedInstanceData> shared_trusted_instance_data,
uint32_t segment_index, uint32_t start_offset, uint32_t length,
DirectHandle<Map> map) { … }
#if V8_ENABLE_DRUMBRAKE
Handle<WasmStruct> Factory::NewWasmStructUninitialized(
const wasm::StructType* type, Handle<Map> map) {
Tagged<HeapObject> raw =
AllocateRaw(WasmStruct::Size(type), AllocationType::kYoung);
raw->set_map_after_allocation(*map);
Tagged<WasmStruct> result = Cast<WasmStruct>(raw);
result->set_raw_properties_or_hash(*empty_fixed_array(), kRelaxedStore);
return handle(result, isolate());
}
#endif
Handle<WasmStruct> Factory::NewWasmStruct(const wasm::StructType* type,
wasm::WasmValue* args,
DirectHandle<Map> map) { … }
Handle<WasmContinuationObject> Factory::NewWasmContinuationObject(
Address jmpbuf, wasm::StackMemory* stack, DirectHandle<HeapObject> parent,
AllocationType allocation) { … }
Handle<SharedFunctionInfo>
Factory::NewSharedFunctionInfoForWasmExportedFunction(
DirectHandle<String> name, DirectHandle<WasmExportedFunctionData> data) { … }
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForWasmJSFunction(
DirectHandle<String> name, DirectHandle<WasmJSFunctionData> data) { … }
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForWasmResume(
DirectHandle<WasmResumeData> data) { … }
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForWasmCapiFunction(
DirectHandle<WasmCapiFunctionData> data) { … }
#endif
Handle<Cell> Factory::NewCell(Tagged<Smi> value) { … }
Handle<Cell> Factory::NewCell() { … }
Handle<FeedbackCell> Factory::NewNoClosuresCell() { … }
Handle<FeedbackCell> Factory::NewOneClosureCell(
DirectHandle<ClosureFeedbackCellArray> value) { … }
Handle<FeedbackCell> Factory::NewManyClosuresCell() { … }
Handle<PropertyCell> Factory::NewPropertyCell(DirectHandle<Name> name,
PropertyDetails details,
DirectHandle<Object> value,
AllocationType allocation) { … }
Handle<ConstTrackingLetCell> Factory::NewConstTrackingLetCell(
AllocationType allocation) { … }
Handle<PropertyCell> Factory::NewProtector() { … }
Handle<TransitionArray> Factory::NewTransitionArray(int number_of_transitions,
int slack) { … }
Handle<AllocationSite> Factory::NewAllocationSite(bool with_weak_next) { … }
template <typename MetaMapProviderFunc>
Handle<Map> Factory::NewMapImpl(MetaMapProviderFunc&& meta_map_provider,
InstanceType type, int instance_size,
ElementsKind elements_kind,
int inobject_properties,
AllocationType allocation_type) { … }
Tagged<Map> Factory::InitializeMap(Tagged<Map> map, InstanceType type,
int instance_size,
ElementsKind elements_kind,
int inobject_properties,
ReadOnlyRoots roots) { … }
Handle<Map> Factory::NewMap(Handle<HeapObject> meta_map_holder,
InstanceType type, int instance_size,
ElementsKind elements_kind, int inobject_properties,
AllocationType allocation_type) { … }
Handle<Map> Factory::NewMapWithMetaMap(Handle<Map> meta_map, InstanceType type,
int instance_size,
ElementsKind elements_kind,
int inobject_properties,
AllocationType allocation_type) { … }
Handle<Map> Factory::NewContextfulMap(
Handle<JSReceiver> creation_context_holder, InstanceType type,
int instance_size, ElementsKind elements_kind, int inobject_properties,
AllocationType allocation_type) { … }
Handle<Map> Factory::NewContextfulMap(Handle<NativeContext> native_context,
InstanceType type, int instance_size,
ElementsKind elements_kind,
int inobject_properties,
AllocationType allocation_type) { … }
Handle<Map> Factory::NewContextfulMapForCurrentContext(
InstanceType type, int instance_size, ElementsKind elements_kind,
int inobject_properties, AllocationType allocation_type) { … }
Handle<Map> Factory::NewContextlessMap(InstanceType type, int instance_size,
ElementsKind elements_kind,
int inobject_properties,
AllocationType allocation_type) { … }
Handle<JSObject> Factory::CopyJSObject(DirectHandle<JSObject> source) { … }
Handle<JSObject> Factory::CopyJSObjectWithAllocationSite(
DirectHandle<JSObject> source, DirectHandle<AllocationSite> site) { … }
namespace {
template <typename T>
void initialize_length(Tagged<T> array, int length) { … }
template <>
void initialize_length<PropertyArray>(Tagged<PropertyArray> array, int length) { … }
inline void InitEmbedderFields(Tagged<JSObject> obj,
Tagged<Object> initial_value) { … }
}
template <typename T>
Handle<T> Factory::CopyArrayWithMap(DirectHandle<T> src, DirectHandle<Map> map,
AllocationType allocation) { … }
template <typename T>
Handle<T> Factory::CopyArrayAndGrow(DirectHandle<T> src, int grow_by,
AllocationType allocation) { … }
Handle<FixedArray> Factory::CopyFixedArrayWithMap(
DirectHandle<FixedArray> array, DirectHandle<Map> map,
AllocationType allocation) { … }
Handle<WeakArrayList> Factory::NewUninitializedWeakArrayList(
int capacity, AllocationType allocation) { … }
Handle<WeakArrayList> Factory::NewWeakArrayList(int capacity,
AllocationType allocation) { … }
Handle<FixedArray> Factory::CopyFixedArrayAndGrow(
DirectHandle<FixedArray> array, int grow_by, AllocationType allocation) { … }
Handle<WeakFixedArray> Factory::CopyWeakFixedArray(
DirectHandle<WeakFixedArray> src) { … }
Handle<WeakFixedArray> Factory::CopyWeakFixedArrayAndGrow(
DirectHandle<WeakFixedArray> src, int grow_by) { … }
Handle<WeakArrayList> Factory::CopyWeakArrayListAndGrow(
DirectHandle<WeakArrayList> src, int grow_by, AllocationType allocation) { … }
Handle<WeakArrayList> Factory::CompactWeakArrayList(
DirectHandle<WeakArrayList> src, int new_capacity,
AllocationType allocation) { … }
Handle<PropertyArray> Factory::CopyPropertyArrayAndGrow(
DirectHandle<PropertyArray> array, int grow_by) { … }
Handle<FixedArray> Factory::CopyFixedArrayUpTo(DirectHandle<FixedArray> array,
int new_len,
AllocationType allocation) { … }
Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { … }
Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray(
Handle<FixedDoubleArray> array) { … }
Handle<HeapNumber> Factory::NewHeapNumberForCodeAssembler(double value) { … }
Handle<JSObject> Factory::NewError(
Handle<JSFunction> constructor, MessageTemplate template_index,
base::Vector<const DirectHandle<Object>> args) { … }
Handle<JSObject> Factory::NewError(Handle<JSFunction> constructor,
DirectHandle<String> message,
Handle<Object> options) { … }
Handle<JSObject> Factory::ShadowRealmNewTypeErrorCopy(
Handle<Object> original, MessageTemplate template_index,
base::Vector<const DirectHandle<Object>> args) { … }
Handle<Object> Factory::NewInvalidStringLengthError() { … }
Handle<JSObject> Factory::NewSuppressedErrorAtDisposal(
Isolate* isolate, Handle<Object> error, Handle<Object> suppressed_error) { … }
#define DEFINE_ERROR …
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
DEFINE_ERROR
#undef DEFINE_ERROR
Handle<JSObject> Factory::NewFunctionPrototype(
DirectHandle<JSFunction> function) { … }
Handle<JSObject> Factory::NewExternal(void* value) { … }
Handle<Code> Factory::NewCodeObjectForEmbeddedBuiltin(DirectHandle<Code> code,
Address off_heap_entry) { … }
Handle<BytecodeArray> Factory::CopyBytecodeArray(
DirectHandle<BytecodeArray> source) { … }
Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor,
AllocationType allocation,
NewJSObjectType new_js_object_type) { … }
Handle<JSObject> Factory::NewSlowJSObjectWithNullProto() { … }
Handle<JSObject> Factory::NewJSObjectWithNullProto() { … }
Handle<JSGlobalObject> Factory::NewJSGlobalObject(
DirectHandle<JSFunction> constructor) { … }
void Factory::InitializeCppHeapWrapper(Tagged<JSObject> obj) { … }
void Factory::InitializeJSObjectFromMap(Tagged<JSObject> obj,
Tagged<Object> properties,
Tagged<Map> map,
NewJSObjectType new_js_object_type) { … }
void Factory::InitializeJSObjectBody(Tagged<JSObject> obj, Tagged<Map> map,
int start_offset) { … }
Handle<JSObject> Factory::NewJSObjectFromMap(
DirectHandle<Map> map, AllocationType allocation,
DirectHandle<AllocationSite> allocation_site,
NewJSObjectType new_js_object_type) { … }
Handle<JSObject> Factory::NewSlowJSObjectFromMap(
DirectHandle<Map> map, int capacity, AllocationType allocation,
DirectHandle<AllocationSite> allocation_site,
NewJSObjectType new_js_object_type) { … }
Handle<JSObject> Factory::NewSlowJSObjectFromMap(DirectHandle<Map> map) { … }
Handle<JSObject> Factory::NewSlowJSObjectWithPropertiesAndElements(
Handle<HeapObject> prototype, DirectHandle<HeapObject> properties,
DirectHandle<FixedArrayBase> elements) { … }
Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, int length,
int capacity,
ArrayStorageAllocationMode mode,
AllocationType allocation) { … }
Handle<JSArray> Factory::NewJSArrayWithElements(
DirectHandle<FixedArrayBase> elements, ElementsKind elements_kind,
int length, AllocationType allocation) { … }
Handle<JSArray> Factory::NewJSArrayWithUnverifiedElements(
DirectHandle<FixedArrayBase> elements, ElementsKind elements_kind,
int length, AllocationType allocation) { … }
Handle<JSArray> Factory::NewJSArrayWithUnverifiedElements(
DirectHandle<Map> map, DirectHandle<FixedArrayBase> elements, int length,
AllocationType allocation) { … }
Handle<JSArray> Factory::NewJSArrayForTemplateLiteralArray(
DirectHandle<FixedArray> cooked_strings,
DirectHandle<FixedArray> raw_strings, int function_literal_id,
int slot_id) { … }
void Factory::NewJSArrayStorage(DirectHandle<JSArray> array, int length,
int capacity, ArrayStorageAllocationMode mode) { … }
Handle<FixedArrayBase> Factory::NewJSArrayStorage(
ElementsKind elements_kind, int capacity, ArrayStorageAllocationMode mode) { … }
Handle<JSWeakMap> Factory::NewJSWeakMap() { … }
Handle<JSModuleNamespace> Factory::NewJSModuleNamespace() { … }
Handle<JSWrappedFunction> Factory::NewJSWrappedFunction(
DirectHandle<NativeContext> creation_context, DirectHandle<Object> target) { … }
Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
Handle<JSFunction> function) { … }
Handle<JSDisposableStackBase> Factory::NewJSDisposableStackBase() { … }
Handle<JSSyncDisposableStack> Factory::NewJSSyncDisposableStack(
DirectHandle<Map> map) { … }
Handle<JSAsyncDisposableStack> Factory::NewJSAsyncDisposableStack(
DirectHandle<Map> map) { … }
Handle<SourceTextModule> Factory::NewSourceTextModule(
DirectHandle<SharedFunctionInfo> sfi) { … }
Handle<SyntheticModule> Factory::NewSyntheticModule(
DirectHandle<String> module_name, DirectHandle<FixedArray> export_names,
v8::Module::SyntheticModuleEvaluationSteps evaluation_steps) { … }
Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(
std::shared_ptr<BackingStore> backing_store, AllocationType allocation) { … }
MaybeHandle<JSArrayBuffer> Factory::NewJSArrayBufferAndBackingStore(
size_t byte_length, InitializedFlag initialized,
AllocationType allocation) { … }
MaybeHandle<JSArrayBuffer> Factory::NewJSArrayBufferAndBackingStore(
size_t byte_length, size_t max_byte_length, InitializedFlag initialized,
ResizableFlag resizable, AllocationType allocation) { … }
Handle<JSArrayBuffer> Factory::NewJSSharedArrayBuffer(
std::shared_ptr<BackingStore> backing_store) { … }
Handle<JSIteratorResult> Factory::NewJSIteratorResult(
DirectHandle<Object> value, bool done) { … }
Handle<JSAsyncFromSyncIterator> Factory::NewJSAsyncFromSyncIterator(
DirectHandle<JSReceiver> sync_iterator, DirectHandle<Object> next) { … }
Handle<JSMap> Factory::NewJSMap() { … }
Handle<JSSet> Factory::NewJSSet() { … }
void Factory::TypeAndSizeForElementsKind(ElementsKind kind,
ExternalArrayType* array_type,
size_t* element_size) { … }
Handle<JSArrayBufferView> Factory::NewJSArrayBufferView(
DirectHandle<Map> map, DirectHandle<FixedArrayBase> elements,
DirectHandle<JSArrayBuffer> buffer, size_t byte_offset,
size_t byte_length) { … }
Handle<JSTypedArray> Factory::NewJSTypedArray(
ExternalArrayType type, DirectHandle<JSArrayBuffer> buffer,
size_t byte_offset, size_t length, bool is_length_tracking) { … }
Handle<JSDataViewOrRabGsabDataView> Factory::NewJSDataViewOrRabGsabDataView(
DirectHandle<JSArrayBuffer> buffer, size_t byte_offset, size_t byte_length,
bool is_length_tracking) { … }
MaybeHandle<JSBoundFunction> Factory::NewJSBoundFunction(
DirectHandle<JSReceiver> target_function, DirectHandle<JSAny> bound_this,
base::Vector<Handle<Object>> bound_args, Handle<HeapObject> prototype) { … }
Handle<JSProxy> Factory::NewJSProxy(DirectHandle<JSReceiver> target,
DirectHandle<JSReceiver> handler) { … }
Handle<JSGlobalProxy> Factory::NewUninitializedJSGlobalProxy(int size) { … }
void Factory::ReinitializeJSGlobalProxy(DirectHandle<JSGlobalProxy> object,
DirectHandle<JSFunction> constructor) { … }
Handle<JSMessageObject> Factory::NewJSMessageObject(
MessageTemplate message, DirectHandle<Object> argument, int start_position,
int end_position, DirectHandle<SharedFunctionInfo> shared_info,
int bytecode_offset, DirectHandle<Script> script,
DirectHandle<Object> stack_frames) { … }
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForApiFunction(
MaybeDirectHandle<String> maybe_name,
DirectHandle<FunctionTemplateInfo> function_template_info,
FunctionKind kind) { … }
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForBuiltin(
MaybeDirectHandle<String> maybe_name, Builtin builtin, FunctionKind kind) { … }
Handle<InterpreterData> Factory::NewInterpreterData(
DirectHandle<BytecodeArray> bytecode_array, DirectHandle<Code> code) { … }
int Factory::NumberToStringCacheHash(Tagged<Smi> number) { … }
int Factory::NumberToStringCacheHash(double number) { … }
Handle<String> Factory::SizeToString(size_t value, bool check_cache) { … }
Handle<DebugInfo> Factory::NewDebugInfo(
DirectHandle<SharedFunctionInfo> shared) { … }
Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { … }
Handle<BreakPoint> Factory::NewBreakPoint(int id,
DirectHandle<String> condition) { … }
Handle<CallSiteInfo> Factory::NewCallSiteInfo(
DirectHandle<JSAny> receiver_or_instance,
DirectHandle<UnionOf<Smi, JSFunction>> function,
DirectHandle<HeapObject> code_object, int code_offset_or_source_position,
int flags, DirectHandle<FixedArray> parameters) { … }
Handle<StackFrameInfo> Factory::NewStackFrameInfo(
DirectHandle<UnionOf<SharedFunctionInfo, Script>> shared_or_script,
int bytecode_offset_or_source_position, DirectHandle<String> function_name,
bool is_constructor) { … }
Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee,
int length) { … }
Handle<Map> Factory::ObjectLiteralMapFromCache(
DirectHandle<NativeContext> context, int number_of_properties) { … }
Handle<MegaDomHandler> Factory::NewMegaDomHandler(MaybeObjectHandle accessor,
MaybeObjectHandle context) { … }
Handle<LoadHandler> Factory::NewLoadHandler(int data_count,
AllocationType allocation) { … }
Handle<StoreHandler> Factory::NewStoreHandler(int data_count) { … }
void Factory::SetRegExpAtomData(DirectHandle<JSRegExp> regexp,
DirectHandle<String> source,
JSRegExp::Flags flags,
DirectHandle<String> pattern) { … }
void Factory::SetRegExpIrregexpData(DirectHandle<JSRegExp> regexp,
DirectHandle<String> source,
JSRegExp::Flags flags, int capture_count,
uint32_t backtrack_limit) { … }
void Factory::SetRegExpExperimentalData(DirectHandle<JSRegExp> regexp,
DirectHandle<String> source,
JSRegExp::Flags flags,
int capture_count) { … }
Handle<RegExpData> Factory::NewAtomRegExpData(DirectHandle<String> source,
JSRegExp::Flags flags,
DirectHandle<String> pattern) { … }
Handle<RegExpData> Factory::NewIrRegExpData(DirectHandle<String> source,
JSRegExp::Flags flags,
int capture_count,
uint32_t backtrack_limit) { … }
Handle<RegExpData> Factory::NewExperimentalRegExpData(
DirectHandle<String> source, JSRegExp::Flags flags, int capture_count) { … }
Handle<Object> Factory::GlobalConstantFor(Handle<Name> name) { … }
Handle<String> Factory::ToPrimitiveHintString(ToPrimitiveHint hint) { … }
Handle<Map> Factory::CreateSloppyFunctionMap(
FunctionMode function_mode, MaybeHandle<JSFunction> maybe_empty_function) { … }
Handle<Map> Factory::CreateStrictFunctionMap(
FunctionMode function_mode, Handle<JSFunction> empty_function) { … }
Handle<Map> Factory::CreateClassFunctionMap(Handle<JSFunction> empty_function) { … }
Handle<JSPromise> Factory::NewJSPromiseWithoutHook() { … }
Handle<JSPromise> Factory::NewJSPromise() { … }
bool Factory::CanAllocateInReadOnlySpace() { … }
bool Factory::EmptyStringRootIsInitialized() { … }
AllocationType Factory::AllocationTypeForInPlaceInternalizableString() { … }
Handle<JSFunction> Factory::NewFunctionForTesting(DirectHandle<String> name) { … }
Handle<JSSharedStruct> Factory::NewJSSharedStruct(
Handle<JSFunction> constructor,
MaybeHandle<NumberDictionary> maybe_elements_template) { … }
Handle<JSSharedArray> Factory::NewJSSharedArray(Handle<JSFunction> constructor,
int length) { … }
Handle<JSAtomicsMutex> Factory::NewJSAtomicsMutex() { … }
Handle<JSAtomicsCondition> Factory::NewJSAtomicsCondition() { … }
namespace {
inline void InitializeTemplate(Tagged<TemplateInfo> that, ReadOnlyRoots roots,
bool do_not_cache) { … }
}
Handle<FunctionTemplateInfo> Factory::NewFunctionTemplateInfo(
int length, bool do_not_cache) { … }
Handle<ObjectTemplateInfo> Factory::NewObjectTemplateInfo(
DirectHandle<FunctionTemplateInfo> constructor, bool do_not_cache) { … }
Handle<DictionaryTemplateInfo> Factory::NewDictionaryTemplateInfo(
DirectHandle<FixedArray> property_names) { … }
Handle<TrustedForeign> Factory::NewTrustedForeign(Address addr) { … }
Factory::JSFunctionBuilder::JSFunctionBuilder(Isolate* isolate,
Handle<SharedFunctionInfo> sfi,
Handle<Context> context)
: … { … }
Handle<JSFunction> Factory::JSFunctionBuilder::Build() { … }
Handle<JSFunction> Factory::JSFunctionBuilder::BuildRaw(
DirectHandle<Code> code) { … }
void Factory::JSFunctionBuilder::PrepareMap() { … }
void Factory::JSFunctionBuilder::PrepareFeedbackCell() { … }
}
}