88#if V8_ENABLE_WEBASSEMBLY
112 :
isolate_(local_isolate->GetMainThreadIsolateUnsafe()),
127 bool retry_allocation_or_fail) {
136 on_heap_profiler_data = profiler_data_->CopyToJSHeap(
isolate_);
144 isolate_->heap()->SetBasicBlockProfilingData(new_list);
148 AllocateUninitializedInstructionStream(retry_allocation_or_fail);
149 if (istream_allocation.
is_null()) {
161 code_desc_.body_size(), code_desc_.constant_pool_offset, *reloc_info);
176 is_context_specialized_,
179 code_desc_.instruction_size(),
180 code_desc_.metadata_size(),
181 inlined_bytecode_size_,
183 code_desc_.handler_table_offset_relative(),
184 code_desc_.constant_pool_offset_relative(),
185 code_desc_.code_comments_offset_relative(),
186 code_desc_.builtin_jump_table_info_offset_relative(),
187 code_desc_.unwinding_info_offset_relative(),
189 deoptimization_data_,
190 bytecode_offset_table_,
195 code =
NewCode(new_code_options);
196 DCHECK_EQ(istream->body_size(), code->body_size());
205 if (self_reference_.ToHandle(&self_reference)) {
209 if (
isolate_->IsGeneratingEmbeddedBuiltins()) {
210 isolate_->builtins_constants_table_builder()->PatchSelfReference(
211 self_reference, istream);
219 isolate_->builtins_constants_table_builder()
220 ->PatchBasicBlockCountersReference(
231 istream->Finalize(*code, *reloc_info, code_desc_,
isolate_->heap());
235 HeapObject::VerifyCodePointer(
isolate_, raw_istream);
242 DCHECK_EQ(stack_slots_, code->stack_slots());
244#ifdef ENABLE_DISASSEMBLER
246 std::ostringstream os;
247 code->Disassemble(
nullptr, os,
isolate_);
248 if (!on_heap_profiler_data.
is_null()) {
252 on_heap_profiler_data->set_code(*disassembly);
254 profiler_data_->SetCode(os);
263 bool retry_allocation_or_fail) {
267 if (retry_allocation_or_fail) {
285 return BuildInternal(
false);
289 return BuildInternal(
true).ToHandleChecked();
301 DCHECK_NE(map->instance_type(), MAP_TYPE);
302 const auto [write_barrier_mode, should_allocate_memento] =
307 const int instance_size = map->instance_size();
308 const int allocation_size =
309 should_allocate_memento
316 result->set_map_after_allocation(
isolate(), *map, write_barrier_mode);
317 if (should_allocate_memento) {
329 memento->set_map_after_allocation(
isolate(), *allocation_memento_map(),
332 if (
v8_flags.allocation_site_pretenuring) {
333 allocation_site->IncrementMementoCreateCount();
339 DCHECK(map->instance_type() != MAP_TYPE);
340 int size = map->instance_size();
348 result->set_map_after_allocation(
isolate(), *map, write_barrier_mode);
359 size, allocation, origin, alignment);
360 heap->CreateFillerObjectAt(
result.address(), size);
386 result->set_indices(*indices);
401 result->set_value1(*value1);
402 result->set_value2(*value2);
416 if (length == 0)
return empty_property_array();
419 result->set_map_after_allocation(
isolate(), *property_array_map(),
422 array->initialize_length(length);
431 if (length == 0)
return empty_fixed_array();
438 if ((size >
heap->MaxRegularHeapObjectSize(allocation_type)) &&
439 v8_flags.use_marking_progress_bar) {
445 result->set_map_after_allocation(
isolate(), *fixed_array_map(),
448 array->set_length(length);
449 MemsetTagged(array->RawFieldOfFirstElement(), *undefined_value(), length);
457 int length = shared->feedback_metadata()->slot_count();
459 int size = FeedbackVector::SizeFor(length);
465 vector->set_shared_function_info(*shared);
466 vector->set_length(length);
467 vector->set_invocation_count(0);
468 vector->set_invocation_count_before_stable(0);
469 vector->reset_osr_state();
470 vector->reset_flags();
471#ifndef V8_ENABLE_LEAPTIERING
473 vector->set_log_next_execution(
v8_flags.log_function_events);
475 vector->set_closure_feedback_cell_array(*closure_feedback_cell_array);
476 vector->set_parent_feedback_cell(*parent_feedback_cell);
490 array->set_length(length);
522 capacity = std::min({capacity, T::kMaxCapacity});
527 int size = T::SizeFor(capacity);
531 table->Initialize(
isolate(), capacity);
538 small_ordered_hash_set_map(), capacity, allocation);
544 small_ordered_hash_map_map(), capacity, allocation);
551 small_ordered_name_dictionary_map(), capacity, allocation);
569 int at_least_space_for) {
577 object->set_flags(0);
590 RootIndex::kEmptySwissPropertyDictionary));
598 Tagged<Map> map = roots.swiss_name_dictionary_map();
614 std::unique_ptr<uint8_t[]> buffer(
new uint8_t[decoder.
utf16_length()]);
615 decoder.
Decode(buffer.get(), utf8_data);
619 std::unique_ptr<uint16_t[]> buffer(
new uint16_t[decoder.
utf16_length()]);
620 decoder.
Decode(buffer.get(), utf8_data);
625template <
typename SeqString,
template <
typename>
typename HandleType>
629 uint32_t from, uint32_t length,
630 bool convert_encoding) {
641 bool convert_encoding);
644 bool convert_encoding);
647 bool convert_encoding);
650 bool convert_encoding);
654#if V8_ENABLE_WEBASSEMBLY
655 DCHECK(message == MessageTemplate::kWasmTrapStringInvalidWtf8 ||
656 message == MessageTemplate::kWasmTrapStringInvalidUtf8);
658 isolate->factory()->NewWasmRuntimeError(message);
660 isolate->factory()->wasm_uncatchable_symbol(),
661 isolate->factory()->true_value(),
NONE);
662 isolate->Throw(*error_obj);
671template <
typename Decoder,
typename PeekBytes>
672MaybeHandle<String> NewStringFromBytes(
Isolate* isolate, PeekBytes peek_bytes,
675 Decoder decoder(peek_bytes());
676 if (decoder.is_invalid()) {
677 if (message != MessageTemplate::kNone) {
678 ThrowInvalidEncodedStringBytes(isolate, message);
680 return MaybeHandle<String>();
683 if (decoder.utf16_length() == 0)
return isolate->factory()->empty_string();
685 if (decoder.is_one_byte()) {
686 if (decoder.utf16_length() == 1) {
688 decoder.Decode(&codepoint, peek_bytes());
689 return isolate->factory()->LookupSingleCharacterStringFromCode(codepoint);
694 isolate->factory()->NewRawOneByteString(
695 decoder.utf16_length(), allocation));
698 decoder.Decode(
result->GetChars(no_gc), peek_bytes());
705 isolate->factory()->NewRawTwoByteString(
706 decoder.utf16_length(), allocation));
709 decoder.Decode(
result->GetChars(no_gc), peek_bytes());
713template <
typename PeekBytes>
714MaybeHandle<String> NewStringFromUtf8Variant(Isolate* isolate,
715 PeekBytes peek_bytes,
718 switch (utf8_variant) {
720 return NewStringFromBytes<Utf8Decoder>(isolate, peek_bytes, allocation,
721 MessageTemplate::kNone);
722#if V8_ENABLE_WEBASSEMBLY
723 case unibrow::Utf8Variant::kUtf8:
724 return NewStringFromBytes<StrictUtf8Decoder>(
725 isolate, peek_bytes, allocation,
726 MessageTemplate::kWasmTrapStringInvalidUtf8);
727 case unibrow::Utf8Variant::kUtf8NoTrap:
728 return NewStringFromBytes<StrictUtf8Decoder>(
729 isolate, peek_bytes, allocation, MessageTemplate::kNone);
730 case unibrow::Utf8Variant::kWtf8:
731 return NewStringFromBytes<Wtf8Decoder>(
732 isolate, peek_bytes, allocation,
733 MessageTemplate::kWasmTrapStringInvalidWtf8);
749 return NewStringFromUtf8Variant(
isolate(), peek_bytes, utf8_variant,
759#if V8_ENABLE_WEBASSEMBLY
770 reinterpret_cast<const uint8_t*
>(array->ElementAddress(0));
773 return NewStringFromUtf8Variant(
isolate(), peek_bytes, utf8_variant,
778 DirectHandle<ByteArray> array, uint32_t
start, uint32_t
end,
784 auto peek_bytes = [&]() -> base::Vector<const uint8_t> {
785 const uint8_t*
contents =
reinterpret_cast<const uint8_t*
>(array->begin());
788 return NewStringFromUtf8Variant(
isolate(), peek_bytes, utf8_variant,
796 explicit Wtf16Decoder(base::Vector<const uint16_t> data)
799 bool is_invalid()
const {
return false; }
800 bool is_one_byte()
const {
return is_one_byte_; }
801 int utf16_length()
const {
return length_; }
802 template <
typename Char>
803 void Decode(Char* out, base::Vector<const uint16_t> data) {
809MaybeDirectHandle<String> Factory::NewStringFromUtf16(
810 DirectHandle<WasmArray> array, uint32_t
start, uint32_t
end,
818 auto peek_bytes = [&]() -> base::Vector<const uint16_t> {
820 reinterpret_cast<const uint16_t*
>(array->ElementAddress(0));
823 return NewStringFromBytes<Wtf16Decoder>(
isolate(), peek_bytes, allocation,
824 MessageTemplate::kNone);
842 decoder.
Decode(&t, utf8_data);
887 if (length == 0)
return empty_string();
917#if V8_ENABLE_WEBASSEMBLY
920#if defined(V8_TARGET_LITTLE_ENDIAN)
922#elif defined(V8_TARGET_BIG_ENDIAN)
927#error Unknown endianness
934 if (string->IsOneByteRepresentation()) {
954 if (
isolate()->enable_ro_allocation_for_snapshot() &&
955 isolate()->serializer_enabled()) {
975 if (!internalized_map->
is_null()) {
984template <
class StringClass>
992 external_string->InitExternalPointerFields(
isolate());
994 external_string->set_length(cast_string->length());
995 external_string->set_raw_hash_field(cast_string->raw_hash_field());
996 external_string->SetResource(
isolate(),
nullptr);
1015 InstanceType instance_type =
string->map()->instance_type();
1019 switch (instance_type) {
1021 *shared_map = shared_seq_two_byte_string_map();
1024 *shared_map = shared_seq_one_byte_string_map();
1027 *shared_map = shared_external_two_byte_string_map();
1030 *shared_map = shared_external_one_byte_string_map();
1033 *shared_map = shared_uncached_external_two_byte_string_map();
1036 *shared_map = shared_uncached_external_one_byte_string_map();
1060 uint32_t begin, uint32_t length) {
1077 uint8_t* dest =
result->GetChars(no_gc);
1091 uint32_t begin, uint32_t
end) {
1100 if (begin >=
end)
return empty_string();
1101 uint32_t length =
end - begin;
1110 uint16_t c1 = str->Get(begin);
1111 uint16_t c2 = str->Get(begin + 1);
1121 if (IsSlicedString(*str)) {
1124 offset += slice->offset();
1126 if (IsThinString(*str)) {
1131 DCHECK(IsSeqString(*str) || IsExternalString(*str));
1133 ? sliced_one_byte_string_map()
1134 : sliced_two_byte_string_map();
1139 slice->set_length(length);
1140 slice->set_parent(*str);
1141 slice->set_offset(
offset);
1147 size_t length = resource->
length();
1151 if (length == 0)
return empty_string();
1154 ? external_one_byte_string_map()
1155 : uncached_external_one_byte_string_map();
1159 external_string->InitExternalPointerFields(
isolate());
1160 external_string->set_length(
static_cast<int>(length));
1162 external_string->SetResource(
isolate(), resource);
1171 size_t length = resource->
length();
1175 if (length == 0)
return empty_string();
1178 ? external_two_byte_string_map()
1179 : uncached_external_two_byte_string_map();
1183 string->InitExternalPointerFields(
isolate());
1184 string->set_length(
static_cast<int>(length));
1186 string->SetResource(
isolate(), resource);
1203 raw->set_string(*flat_string);
1218 symbol->set_raw_hash_field(
1220 if (
isolate()->read_only_heap()->roots_init_complete()) {
1226 symbol->description_.store(&*symbol,
read_only_roots().undefined_value(),
1229 symbol->set_flags(0);
1230 DCHECK(!symbol->is_private());
1242 symbol->set_is_private(
true);
1249 symbol->set_is_private_name();
1250 symbol->set_description(*name);
1255 int variadic_part_length,
1268 context->set_length(variadic_part_length);
1269 DCHECK_EQ(context->SizeFromMap(*map), size);
1301 contextful_meta_map->set_map(
isolate(), *contextful_meta_map);
1308 MapEvent(
"NewNativeContext",
isolate()->factory()->meta_map(),
1309 contextful_meta_map,
"contextful meta map"));
1311 MapEvent(
"NewNativeContext",
isolate()->factory()->meta_map(),
1312 context_map,
"native context map"));
1319 contextful_meta_map->set_native_context(context);
1320 context_map->set_native_context(context);
1321 context->set_meta_map(*contextful_meta_map);
1322 context->set_scope_info(*native_scope_info());
1323 context->set_previous(
Context());
1324 context->set_extension(*undefined_value());
1325 context->set_errors_thrown(
Smi::zero());
1326 context->set_is_wasm_js_installed(
Smi::zero());
1327 context->set_is_wasm_jspi_installed(
Smi::zero());
1328 context->set_math_random_index(
Smi::zero());
1329 context->set_serialized_objects(*empty_fixed_array());
1330 context->init_microtask_queue(
isolate(),
nullptr);
1331 context->set_retained_maps(*empty_weak_array_list());
1337 DCHECK(scope_info->is_script_scope());
1338 int variadic_part_length = scope_info->ContextLength();
1342 v8_flags.script_context_mutable_heap_number) {
1345 side_data = empty_fixed_array();
1352 context->set_scope_info(*scope_info);
1353 context->set_previous(*outer);
1355 DCHECK(context->IsScriptContext());
1360 static constexpr int kInitialCapacity = 0;
1369 int variadic_part_length = scope_info->ContextLength();
1374 context->set_scope_info(*scope_info);
1375 context->set_previous(*outer);
1376 context->set_extension(*module);
1377 DCHECK(context->IsModuleContext());
1384 switch (scope_info->scope_type()) {
1386 map =
isolate()->eval_context_map();
1389 map =
isolate()->function_context_map();
1394 int variadic_part_length = scope_info->ContextLength();
1399 context->set_scope_info(*scope_info);
1400 context->set_previous(*outer);
1404#if V8_SINGLE_GENERATION_BOOL
1405#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG(isolate, object)
1406#elif V8_ENABLE_STICKY_MARK_BITS_BOOL
1407#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG(isolate, object) \
1408 DCHECK_IMPLIES(!isolate->heap()->incremental_marking()->IsMajorMarking(), \
1409 HeapLayout::InYoungGeneration(object))
1411#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG(isolate, object) \
1412 DCHECK(HeapLayout::InYoungGeneration(object))
1437 DCHECK(scope_info->IsDebugEvaluateScope());
1479 int variadic_part_length = scope_info->ContextLength();
1505 int aliased_context_slot) {
1508 entry->set_aliased_context_slot(aliased_context_slot);
1519 info->set_is_sloppy(
true);
1520 info->set_initial_property_attributes(
NONE);
1525 info->clear_padding();
1535 info->set_data(*undefined_value());
1537 info->clear_padding();
1541#define INIT_CALLBACK_FIELD(Name, name) info->init_named_##name();
1544#undef INIT_CALLBACK_FIELD
1555 error_stack_data->set_call_site_infos_or_formatted_stack(
1563 int script_id = script->id();
1571 if (IsString(script->source()) && isolate()->NeedsSourcePositions()) {
1574 LOG(
isolate(), ScriptEvent(script_event_type, script_id));
1580#ifdef V8_SCRIPTORMODULE_LEGACY_LIFETIME
1589 new_script->set_source(*source);
1590 new_script->set_name(old_script->name());
1591 new_script->set_id(script_id);
1592 new_script->set_line_offset(old_script->line_offset());
1593 new_script->set_column_offset(old_script->column_offset());
1594 new_script->set_context_data(old_script->context_data());
1595 new_script->set_type(old_script->type());
1597 new_script->set_eval_from_shared_or_wrapped_arguments(
1598 script->eval_from_shared_or_wrapped_arguments());
1600 new_script->set_eval_from_position(old_script->eval_from_position());
1601 new_script->set_flags(old_script->flags());
1602 new_script->set_host_defined_options(old_script->host_defined_options());
1604 new_script->set_compiled_lazy_function_positions(*undefined_value(),
1606#ifdef V8_SCRIPTORMODULE_LEGACY_LIFETIME
1607 new_script->set_script_or_modules(*list);
1611 return new_script_handle;
1616 DCHECK(IsCallable(*callable));
1622#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
1623 microtask->set_continuation_preserved_embedder_data(
1624 isolate()->isolate_data()->continuation_preserved_embedder_data(),
1637#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
1638 microtask->set_continuation_preserved_embedder_data(
1639 isolate()->isolate_data()->continuation_preserved_embedder_data(),
1650 DCHECK(IsCallable(*then));
1658#ifdef V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA
1659 microtask->set_continuation_preserved_embedder_data(
1660 isolate()->isolate_data()->continuation_preserved_embedder_data(),
1666#if V8_ENABLE_WEBASSEMBLY
1682DirectHandle<WasmDispatchTable> Factory::NewWasmDispatchTable(
1683 int length, wasm::CanonicalValueType table_type) {
1687 size_t estimated_offheap_size = 0;
1688 DirectHandle<TrustedManaged<WasmDispatchTableData>> offheap_data =
1690 isolate(), estimated_offheap_size,
1691 std::make_shared<WasmDispatchTableData>());
1701 result->set_protected_offheap_data(*offheap_data);
1702 result->set_protected_uses(*empty_protected_weak_fixed_array());
1703 result->set_table_type(table_type);
1706 result->clear_entry_padding(
i);
1711DirectHandle<WasmTypeInfo> Factory::NewWasmTypeInfo(
1712 wasm::CanonicalValueType type, wasm::CanonicalValueType element_type,
1713 DirectHandle<Map> opt_parent) {
1720 DirectHandleVector<Object> supertypes(
isolate());
1721 if (opt_parent.is_null()) {
1724 DirectHandle<WasmTypeInfo> parent_type_info(opt_parent->wasm_type_info(),
1726 int first_undefined_index = -1;
1727 for (
int i = 0;
i < parent_type_info->supertypes_length();
i++) {
1728 DirectHandle<Object> supertype(parent_type_info->supertypes(
i),
1730 if (IsUndefined(*supertype) && first_undefined_index == -1) {
1731 first_undefined_index =
i;
1733 supertypes.emplace_back(supertype);
1735 if (first_undefined_index >= 0) {
1736 supertypes[first_undefined_index] = opt_parent;
1738 supertypes.emplace_back(opt_parent);
1741 Tagged<Map> map = *wasm_type_info_map();
1743 WasmTypeInfo::SizeFor(
static_cast<int>(supertypes.size())),
1746 result->set_supertypes_length(
static_cast<int>(supertypes.size()));
1747 for (
size_t i = 0;
i < supertypes.
size();
i++) {
1748 result->set_supertypes(
static_cast<int>(
i), *supertypes[
i]);
1750 result->set_canonical_type(type.raw_bit_field());
1751 result->set_canonical_element_type(element_type.raw_bit_field());
1755DirectHandle<WasmImportData> Factory::NewWasmImportData(
1758 const wasm::CanonicalSig*
sig) {
1759 Tagged<Map> map = *wasm_import_data_map();
1765 result->set_suspend(suspend);
1767 result->clear_instance_data();
1771 result->set_wrapper_budget(
v8_flags.wasm_wrapper_tiering_budget);
1772 result->clear_call_origin();
1774#if TAGGED_SIZE_8_BYTES
1775 result->set_optional_padding(0);
1780DirectHandle<WasmImportData> Factory::NewWasmImportData(
1781 DirectHandle<WasmImportData> import_data) {
1782 return NewWasmImportData(
1783 direct_handle(import_data->callable(), isolate()), import_data->suspend(),
1785 import_data->sig());
1788DirectHandle<WasmFastApiCallData> Factory::NewWasmFastApiCallData(
1789 DirectHandle<HeapObject> signature, DirectHandle<Object> callback_data) {
1790 Tagged<Map> map = *wasm_fast_api_call_data_map();
1793 result->set_signature(*signature);
1794 result->set_callback_data(*callback_data);
1799DirectHandle<WasmInternalFunction> Factory::NewWasmInternalFunction(
1800 DirectHandle<TrustedObject> implicit_arg,
int function_index) {
1804 *wasm_internal_function_map()));
1809 DCHECK(IsWasmTrustedInstanceData(*implicit_arg) ||
1810 IsWasmImportData(*implicit_arg));
1811 internal->set_implicit_arg(*implicit_arg);
1813 internal->set_function_index(function_index);
1814 internal->set_external(*undefined_value());
1820DirectHandle<WasmFuncRef> Factory::NewWasmFuncRef(
1821 DirectHandle<WasmInternalFunction> internal_function,
1822 DirectHandle<Map> rtt) {
1826 DCHECK_EQ(WASM_FUNC_REF_TYPE, rtt->instance_type());
1827 DCHECK_EQ(WasmFuncRef::kSize, rtt->instance_size());
1828 raw->set_map_after_allocation(
isolate(), *rtt);
1830 func_ref->set_internal(*internal_function);
1834DirectHandle<WasmJSFunctionData> Factory::NewWasmJSFunctionData(
1835 wasm::CanonicalTypeIndex sig_index, DirectHandle<JSReceiver> callable,
1836 DirectHandle<Code> wrapper_code, DirectHandle<Map> rtt,
1839 const wasm::CanonicalSig*
sig =
1841 DirectHandle<WasmImportData> import_data = NewWasmImportData(
1842 callable, suspend, DirectHandle<WasmTrustedInstanceData>(),
sig);
1845 constexpr size_t kOffheapDataSizeEstimate = 100;
1846 DirectHandle<TrustedManaged<WasmJSFunctionData::OffheapData>> offheap_data =
1848 isolate(), kOffheapDataSizeEstimate,
1849 std::make_shared<WasmJSFunctionData::OffheapData>(
1850 sig->signature_hash()));
1852 DirectHandle<WasmInternalFunction>
internal =
1853 NewWasmInternalFunction(import_data, -1);
1854 DirectHandle<WasmFuncRef> func_ref = NewWasmFuncRef(
internal, rtt);
1855 import_data->SetFuncRefAsCallOrigin(*
internal);
1856 Tagged<Map> map = *wasm_js_function_data_map();
1862 result->set_func_ref(*func_ref);
1864 result->set_wrapper_code(*wrapper_code);
1865 result->set_canonical_sig_index(sig_index.index);
1868 result->set_protected_offheap_data(*offheap_data);
1872DirectHandle<WasmResumeData> Factory::NewWasmResumeData(
1873 DirectHandle<WasmSuspenderObject> suspender,
wasm::OnResume on_resume) {
1874 Tagged<Map> map = *wasm_resume_data_map();
1879 result->set_suspender(*suspender);
1880 result->set_on_resume(
static_cast<int>(on_resume));
1884DirectHandle<WasmSuspenderObject> Factory::NewWasmSuspenderObject() {
1886 Tagged<Map> map = *wasm_suspender_object_map();
1892 suspender->init_stack(IsolateForSandbox(
isolate()),
nullptr);
1893 suspender->set_parent(*undefined_value());
1894 suspender->set_promise(*promise);
1895 suspender->set_resume(*undefined_value());
1896 suspender->set_reject(*undefined_value());
1899 DirectHandle<WasmResumeData> resume_data =
1901 DirectHandle<SharedFunctionInfo> resume_sfi =
1902 NewSharedFunctionInfoForWasmResume(resume_data);
1904 DirectHandle<JSObject> resume =
1905 Factory::JSFunctionBuilder{
isolate(), resume_sfi, context}.Build();
1907 DirectHandle<WasmResumeData> reject_data =
1910 DirectHandle<SharedFunctionInfo> reject_sfi =
1911 isolate()->
factory()->NewSharedFunctionInfoForWasmResume(reject_data);
1912 DirectHandle<JSObject> reject =
1913 Factory::JSFunctionBuilder{
isolate(), reject_sfi, context}.Build();
1914 suspender->set_resume(*resume);
1915 suspender->set_reject(*reject);
1919DirectHandle<WasmExportedFunctionData> Factory::NewWasmExportedFunctionData(
1920 DirectHandle<Code> export_wrapper,
1922 DirectHandle<WasmFuncRef> func_ref,
1923 DirectHandle<WasmInternalFunction> internal_function,
1924 const wasm::CanonicalSig*
sig, wasm::CanonicalTypeIndex type_index,
1926 int func_index = internal_function->function_index();
1927 DirectHandle<Cell> wrapper_budget_cell =
1929 Tagged<Map> map = *wasm_exported_function_data_map();
1935 result->set_func_ref(*func_ref);
1936 result->set_internal(*internal_function);
1937 result->set_wrapper_code(*export_wrapper);
1939 result->set_function_index(func_index);
1941 result->set_canonical_type_index(type_index.index);
1942 result->set_wrapper_budget(*wrapper_budget_cell);
1946 result->set_packed_args_size(0);
1947 result->set_js_promise_flags(
1953DirectHandle<WasmCapiFunctionData> Factory::NewWasmCapiFunctionData(
1954 Address call_target, DirectHandle<Foreign> embedder_data,
1955 DirectHandle<Code> wrapper_code, DirectHandle<Map> rtt,
1956 wasm::CanonicalTypeIndex sig_index,
const wasm::CanonicalSig*
sig) {
1957 DirectHandle<WasmImportData> import_data =
1959 DirectHandle<WasmTrustedInstanceData>(),
sig);
1960 DirectHandle<WasmInternalFunction>
internal =
1961 NewWasmInternalFunction(import_data, -1);
1962 DirectHandle<WasmFuncRef> func_ref = NewWasmFuncRef(
internal, rtt);
1967 ->GetOrCreateHandleForNativeFunction(call_target));
1968 Tagged<Map> map = *wasm_capi_function_data_map();
1974 result->set_func_ref(*func_ref);
1976 result->set_canonical_sig_index(sig_index.index);
1977 result->set_wrapper_code(*wrapper_code);
1978 result->set_embedder_data(*embedder_data);
1980 result->set_js_promise_flags(
1987 DirectHandle<Map> map) {
1991 raw->set_map_after_allocation(
isolate(), *map);
1994 result->set_length(length);
1998DirectHandle<WasmArray> Factory::NewWasmArray(wasm::ValueType element_type,
2000 wasm::WasmValue initial_value,
2001 DirectHandle<Map> map) {
2004 if (element_type.is_numeric()) {
2005 if (initial_value.zero_byte_representation()) {
2006 memset(
reinterpret_cast<void*
>(
result->ElementAddress(0)), 0,
2007 length * element_type.value_kind_size());
2009 wasm::WasmValue packed = initial_value.Packed(element_type);
2012 packed.CopyTo(
reinterpret_cast<uint8_t*
>(address));
2017 result->SetTaggedElement(
i, initial_value.to_ref());
2023DirectHandle<WasmArray> Factory::NewWasmArrayFromElements(
2024 const wasm::ArrayType* type, base::Vector<wasm::WasmValue> elements,
2025 DirectHandle<Map> map) {
2026 uint32_t length =
static_cast<uint32_t
>(elements.size());
2029 if (type->element_type().is_numeric()) {
2033 .Packed(type->element_type())
2034 .CopyTo(
reinterpret_cast<uint8_t*
>(address));
2038 result->SetTaggedElement(
i, elements[
i].to_ref());
2044DirectHandle<WasmArray> Factory::NewWasmArrayFromMemory(
2045 uint32_t length, DirectHandle<Map> map,
2046 wasm::CanonicalValueType element_type,
Address source) {
2047 DCHECK(element_type.is_numeric());
2050#if V8_TARGET_BIG_ENDIAN
2051 MemCopyAndSwitchEndianness(
reinterpret_cast<void*
>(
result->ElementAddress(0)),
2052 reinterpret_cast<void*
>(source), length,
2053 element_type.value_kind_size());
2056 reinterpret_cast<void*
>(source),
2057 length * element_type.value_kind_size());
2063DirectHandle<Object> Factory::NewWasmArrayFromElementSegment(
2064 DirectHandle<WasmTrustedInstanceData> trusted_instance_data,
2065 DirectHandle<WasmTrustedInstanceData> shared_trusted_instance_data,
2066 uint32_t segment_index, uint32_t start_offset, uint32_t length,
2067 DirectHandle<Map> map, wasm::CanonicalValueType element_type) {
2068 DCHECK(element_type.is_reference());
2075 &zone,
isolate(), trusted_instance_data, shared_trusted_instance_data,
2077 if (opt_error.has_value()) {
2083 trusted_instance_data->element_segments()->get(segment_index)),
2090 elements->RawFieldOfElementAt(start_offset),
2097 const wasm::StructType* type, DirectHandle<Map> map,
2100 raw->set_map_after_allocation(
isolate(), *map);
2106DirectHandle<WasmStruct> Factory::NewWasmStruct(
const wasm::StructType* type,
2107 wasm::WasmValue*
args,
2108 DirectHandle<Map> map) {
2111 raw->set_map_after_allocation(
isolate(), *map);
2114 for (uint32_t
i = 0;
i < type->field_count();
i++) {
2115 int offset = type->field_offset(
i);
2116 if (type->field(
i).is_numeric()) {
2119 .Packed(type->field(
i))
2120 .CopyTo(
reinterpret_cast<uint8_t*
>(address));
2122 offset += WasmStruct::kHeaderSize;
2129DirectHandle<SharedFunctionInfo>
2130Factory::NewSharedFunctionInfoForWasmExportedFunction(
2131 DirectHandle<String> name, DirectHandle<WasmExportedFunctionData> data,
2136DirectHandle<SharedFunctionInfo>
2137Factory::NewSharedFunctionInfoForWasmJSFunction(
2138 DirectHandle<String> name, DirectHandle<WasmJSFunctionData> data) {
2143DirectHandle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForWasmResume(
2144 DirectHandle<WasmResumeData> data) {
2148DirectHandle<SharedFunctionInfo>
2149Factory::NewSharedFunctionInfoForWasmCapiFunction(
2150 DirectHandle<WasmCapiFunctionData> data) {
2178 *no_closures_cell_map()));
2181 result->clear_interrupt_budget();
2182#ifdef V8_ENABLE_LEAPTIERING
2183 result->clear_dispatch_handle();
2193 *one_closure_cell_map()));
2195 result->set_value(*value);
2196 result->clear_interrupt_budget();
2197#ifdef V8_ENABLE_LEAPTIERING
2198 result->clear_dispatch_handle();
2210 result->clear_interrupt_budget();
2211 result->clear_dispatch_handle();
2223 PropertyCell::kSize, allocation, *global_property_cell_map()));
2225 cell->set_dependent_code(
2231 cell->set_name(*name, mode);
2232 cell->set_value(*value, mode);
2242 *global_context_side_property_cell_map()));
2245 cell->set_dependent_code(
2258 int number_of_transitions,
int slack) {
2267 if (
heap->incremental_marking()->black_allocation()) {
2268 heap->mark_compact_collector()->AddTransitionArray(*array);
2281 ? allocation_site_map()
2282 : allocation_site_without_weaknext_map();
2287 if (with_weak_next) {
2298template <
typename MetaMapProv
iderFunc>
2302 int inobject_properties,
2304 static_assert(LAST_JS_OBJECT_TYPE ==
LAST_TYPE);
2315 Map::kSize, allocation_type);
2318 result->set_map_after_allocation(
isolate(), meta_map_provider());
2320#if V8_STATIC_ROOTS_BOOL
2327 elements_kind, inobject_properties, roots),
2334 int inobject_properties,
2337 map->set_bit_field(0);
2338 map->set_bit_field2(Map::Bits2::NewTargetIsBaseBit::encode(
true));
2341 Map::Bits3::OwnsDescriptorsBit::encode(
true) |
2343 Map::Bits3::IsExtensibleBit::encode(
true);
2345 map->set_instance_type(type);
2346 map->init_prototype_and_constructor_or_back_pointer(roots);
2347 map->set_instance_size(instance_size);
2348 if (InstanceTypeChecker::IsJSObject(type)) {
2355 !IsAlwaysSharedSpaceJSObjectMap(*map),
2357 map->SetInObjectPropertiesStartInWords(instance_size /
kTaggedSize -
2358 inobject_properties);
2359 DCHECK_EQ(map->GetInObjectProperties(), inobject_properties);
2360 map->set_prototype_validity_cell(roots.invalid_prototype_validity_cell(),
2364 map->set_inobject_properties_start_or_constructor_function_index(0);
2371 map->SetInObjectUnusedPropertyFields(inobject_properties);
2372 map->SetInstanceDescriptors(
isolate(), roots.empty_descriptor_array(), 0,
2376 DCHECK(!map->is_in_retained_map_list());
2377 map->clear_padding();
2378 map->set_elements_kind(elements_kind);
2389 auto meta_map_provider = [meta_map_holder] {
2392 DCHECK(IsMapMap(meta_map));
2396 NewMapImpl(meta_map_provider, type, instance_size, elements_kind,
2397 inobject_properties, allocation_type);
2405 int inobject_properties,
2408 auto meta_map_provider = [meta_map] {
2413 NewMapImpl(meta_map_provider, type, instance_size, elements_kind,
2414 inobject_properties, allocation_type);
2420 int instance_size,
ElementsKind elements_kind,
int inobject_properties,
2423 auto meta_map_provider = [creation_context_holder] {
2426 Tagged<Map> meta_map = creation_context_holder->map()->map();
2427 DCHECK(IsMapMap(meta_map));
2431 NewMapImpl(meta_map_provider, type, instance_size, elements_kind,
2432 inobject_properties, allocation_type);
2438 int instance_size,
ElementsKind elements_kind,
int inobject_properties,
2441#
if V8_ENABLE_WEBASSEMBLY
2442 InstanceTypeChecker::IsWasmStruct(type) ||
2444 InstanceTypeChecker::IsMap(type));
2450 NewMapImpl(meta_map_provider, type, instance_size, elements_kind,
2451 inobject_properties, allocation_type);
2459 InstanceTypeChecker::IsMap(type));
2460 auto meta_map_provider = [
this] {
2465 NewMapImpl(meta_map_provider, type, instance_size, elements_kind,
2466 inobject_properties, allocation_type);
2472 int inobject_properties,
2475 type == NATIVE_CONTEXT_TYPE ||
2476 type == JS_GLOBAL_PROXY_TYPE ||
2477 type == JS_SPECIAL_API_OBJECT_TYPE ||
2478 InstanceTypeChecker::IsMap(type));
2479 auto meta_map_provider = [
this] {
2484 NewMapImpl(meta_map_provider, type, instance_size, elements_kind,
2485 inobject_properties, allocation_type);
2500 bool is_clonable_js_type =
2501 instance_type == JS_REG_EXP_TYPE || instance_type == JS_OBJECT_TYPE ||
2502 instance_type == JS_ERROR_TYPE || instance_type == JS_ARRAY_TYPE ||
2503 instance_type == JS_SPECIAL_API_OBJECT_TYPE ||
2504 InstanceTypeChecker::IsJSApiObject(instance_type);
2505 bool is_clonable_wasm_type =
false;
2506#if V8_ENABLE_WEBASSEMBLY
2507 is_clonable_wasm_type = instance_type == WASM_GLOBAL_OBJECT_TYPE ||
2508 instance_type == WASM_INSTANCE_OBJECT_TYPE ||
2509 instance_type == WASM_MEMORY_OBJECT_TYPE ||
2510 instance_type == WASM_MODULE_OBJECT_TYPE ||
2511 instance_type == WASM_TABLE_OBJECT_TYPE;
2513 CHECK(is_clonable_js_type || is_clonable_wasm_type);
2517 int object_size = map->instance_size();
2519 int adjusted_object_size = aligned_object_size;
2520 if (!site.is_null()) {
2522 adjusted_object_size +=
2531 Heap::CopyBlock(raw_clone.
address(), source->address(), object_size);
2534 if (
v8_flags.enable_unconditional_write_barriers) {
2541 if (!site.is_null()) {
2547 SLOW_DCHECK(clone->GetElementsKind() == source->GetElementsKind());
2550 if (elements->length() > 0) {
2552 if (elements->map() == *fixed_cow_array_map()) {
2554 }
else if (source->HasDoubleElements()) {
2560 clone->set_elements(elem);
2564 if (source->HasFastProperties()) {
2566 if (properties->length() > 0) {
2578 direct_handle(source->property_dictionary_swiss(), isolate()));
2583 clone->set_raw_properties_or_hash(*copied_properties,
kRelaxedStore);
2589template <
typename T>
2590void initialize_length(
Tagged<T> array,
int length) {
2591 array->set_length(length);
2596 array->initialize_length(length);
2601 for (
int i = 0;
i < obj->GetEmbedderFieldCount();
i++) {
2602 EmbedderDataSlot(obj,
i).Initialize(initial_value);
2608template <
typename T>
2611 int len = src->length();
2616 initialize_length(
result, len);
2623template <
typename T>
2628 int old_len = src->length();
2629 int new_len = old_len + grow_by;
2633 new_object->set_map_after_allocation(
isolate(), src->map(),
2636 initialize_length(
result, new_len);
2639 T::CopyElements(
isolate(),
result, 0, *src, 0, old_len, mode);
2656 if (capacity == 0)
return empty_weak_array_list();
2661 heap_object->set_map_after_allocation(
isolate(), *weak_array_list_map(),
2665 result->set_capacity(capacity);
2685 DCHECK(!IsTransitionArray(*src));
2691 DCHECK(!IsTransitionArray(*src));
2697 int old_capacity = src->capacity();
2698 int new_capacity = old_capacity + grow_by;
2704 int old_len = src->length();
2705 raw->set_length(old_len);
2708 raw->CopyElements(
isolate(), 0, *src, 0, old_len, mode);
2725 int copy_to = 0, length = raw_src->length();
2729 raw_result->Set(copy_to++, element, mode);
2731 raw_result->set_length(copy_to);
2748 if (new_len == 0)
return empty_fixed_array();
2751 heap_object->set_map_after_allocation(
isolate(), *fixed_array_map(),
2754 result->set_length(new_len);
2757 result->CopyElements(
isolate(), 0, *array, 0, new_len, mode);
2762 if (array->length() == 0)
return array;
2769 int len = array->length();
2770 if (len == 0)
return array;
2783 if (!num.is_null())
return num;
2806 if (options.is_null()) options = undefined_value();
2817 template_index,
args);
2821 if (
v8_flags.correctness_fuzzer_suppressions) {
2822 FATAL(
"Aborting on invalid string length");
2825 if (Protectors::IsStringLengthOverflowLookupChainIntact(
isolate())) {
2826 Protectors::InvalidateStringLengthOverflowLookupChain(
isolate());
2828 return NewRangeError(MessageTemplate::kInvalidStringLength);
2835 NewSuppressedError(MessageTemplate::kSuppressedErrorDuringDisposal);
2838 err, isolate->factory()->error_string(), error,
DONT_ENUM)
2842 err, isolate->factory()->suppressed_string(), suppressed_error,
DONT_ENUM)
2848#define DEFINE_ERROR(NAME, name) \
2849 Handle<JSObject> Factory::New##NAME( \
2850 MessageTemplate template_index, \
2851 base::Vector<const DirectHandle<Object>> args) { \
2852 return NewError(isolate()->name##_function(), template_index, args); \
2876 native_context->async_generator_object_prototype_map(), isolate());
2887 DCHECK(object_function->has_initial_map());
2888 new_map =
direct_handle(object_function->initial_map(), isolate());
2891 DCHECK(!new_map->is_prototype_map());
2906 external->init_value(
isolate(), value);
2916 DCHECK(code->has_instruction_stream());
2918 DCHECK_EQ(code->inlined_bytecode_size(), 0);
2922 DCHECK(!code->marked_for_deoptimization());
2923 DCHECK(!code->can_have_weak_objects());
2924 DCHECK(!code->embedded_objects_cleared());
2933 code->is_context_specialized(),
2934 code->is_turbofanned(),
2935 code->parameter_count(),
2936 code->instruction_size(),
2937 code->metadata_size(),
2938 code->inlined_bytecode_size(),
2940 code->handler_table_offset(),
2941 code->constant_pool_offset(),
2942 code->code_comments_offset(),
2943 code->builtin_jump_table_info_offset(),
2944 code->unwinding_info_offset(),
2953 return NewCode(new_code_options);
2964 copy->init_self_indirect_pointer(
isolate());
2965 copy->set_length(raw_source->length());
2966 copy->set_frame_size(raw_source->frame_size());
2967 copy->set_parameter_count(raw_source->parameter_count());
2968 copy->set_max_arguments(raw_source->max_arguments());
2969 copy->set_incoming_new_target_or_generator_register(
2970 raw_source->incoming_new_target_or_generator_register());
2971 copy->set_constant_pool(raw_source->constant_pool());
2972 copy->set_handler_table(raw_source->handler_table());
2973 copy->set_wrapper(*wrapper);
2974 if (raw_source->has_source_position_table(
kAcquireLoad)) {
2975 copy->set_source_position_table(
2980 raw_source->CopyBytecodesTo(copy);
2981 wrapper->set_bytecode(copy);
2992 DCHECK(!map->is_dictionary_map());
2995 new_js_object_type);
3014 DCHECK(constructor->has_initial_map());
3016 DCHECK(map->is_dictionary_map());
3021 DCHECK_EQ(map->NextFreePropertyIndex(), 0);
3025 DCHECK_EQ(map->UnusedPropertyFields(), 0);
3026 DCHECK_EQ(map->GetInObjectProperties(), 0);
3031 int initial_size = 64;
3034 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size;
3036 GlobalDictionary::New(
isolate(), at_least_space_for);
3052 USE(GlobalDictionary::Add(
isolate(), dictionary, name, cell, d));
3064 raw_map->set_may_have_interesting_properties(
true);
3065 raw_map->set_is_dictionary_map(
true);
3073 DCHECK(IsJSGlobalObject(*global) && !global->HasFastProperties());
3079 DCHECK(IsJSAPIObjectWithEmbedderSlots(obj) || IsJSSpecialObject(obj));
3080 static_assert(JSSpecialObject::kCppHeapWrappableOffset ==
3081 JSAPIObjectWithEmbedderSlots::kCppHeapWrappableOffset);
3082 obj->SetupLazilyInitializedCppHeapPointerField(
3083 JSAPIObjectWithEmbedderSlots::kCppHeapWrappableOffset);
3092 obj->initialize_elements();
3104 ? JSObject::kHeaderSize
3105 : JSAPIObjectWithEmbedderSlots::kHeaderSize);
3114 if (start_offset == map->instance_size())
return;
3115 DCHECK_LT(start_offset, map->instance_size());
3126 bool in_progress = map->IsInobjectSlackTrackingInProgress();
3127 obj->InitializeBody(map, start_offset, in_progress,
3129 *undefined_value());
3131 map->FindRootMap(
isolate())->InobjectSlackTrackingStep(
isolate());
3141 DCHECK(!InstanceTypeChecker::IsJSFunction(*map));
3145 DCHECK_NE(map->instance_type(), JS_GLOBAL_OBJECT_TYPE);
3151 new_js_object_type);
3153 DCHECK(js_obj->HasFastElements() ||
3154 (isolate()->bootstrapper()->IsActive() ||
3156 ->raw_native_context()
3157 ->js_array_template_literal_object_map()) ||
3158 js_obj->HasTypedArrayOrRabGsabTypedArrayElements() ||
3159 js_obj->HasFastStringWrapperElements() ||
3160 js_obj->HasFastArgumentsElements() ||
3161 js_obj->HasDictionaryElements() || js_obj->HasSharedArrayElements());
3169 DCHECK(map->is_dictionary_map());
3178 js_object->set_raw_properties_or_hash(*object_properties,
kRelaxedStore);
3189 DCHECK(IsPropertyDictionary(*properties));
3192 isolate()->slow_object_with_object_prototype_map();
3193 if (object_map->prototype() != *prototype) {
3195 isolate(), object_map, prototype);
3197 DCHECK(object_map->is_dictionary_map());
3200 object->set_raw_properties_or_hash(*properties);
3202 DCHECK(IsNumberDictionary(*elements));
3206 object->set_elements(*elements);
3215 DCHECK(capacity >= length);
3216 if (capacity == 0) {
3225 elms, elements_kind, length, allocation));
3232 elements, elements_kind, length, allocation);
3233#ifdef ENABLE_SLOW_DCHECKS
3245 if (map.is_null()) {
3247 map = array_function->initial_map();
3250 elements, length, allocation);
3259 raw->set_elements(*elements);
3275 auto template_object =
3284 raw_template_object->set_raw(*raw_object);
3285 raw_template_object->set_function_literal_id(function_literal_id);
3286 raw_template_object->set_slot_id(slot_id);
3287 return template_object;
3292 DCHECK(capacity >= length);
3294 if (capacity == 0) {
3298 raw->set_elements(*empty_fixed_array());
3307 raw->set_elements(*elms);
3360 module_namespace->FastPropertyAtPut(index,
read_only_roots().Module_string(),
3362 return module_namespace;
3367 DCHECK(IsCallable(*target));
3369 Cast<Map>(creation_context->get(Context::WRAPPED_FUNCTION_MAP_INDEX)),
3380 wrapped->set_context(*creation_context);
3392 DCHECK(map->instance_type() == JS_GENERATOR_OBJECT_TYPE ||
3393 map->instance_type() == JS_ASYNC_GENERATOR_OBJECT_TYPE);
3403 disposable_stack->set_status(0);
3404 return disposable_stack;
3411 disposable_stack->set_status(0);
3412 return disposable_stack;
3419 disposable_stack->set_status(0);
3420 return disposable_stack;
3426 sfi->scope_info()->ModuleDescriptorInfo(), isolate());
3428 ObjectHashTable::New(
isolate(), module_info->RegularExportCount());
3433 int requested_modules_length = module_info->module_requests()->length();
3435 requested_modules_length > 0 ?
NewFixedArray(requested_modules_length)
3436 : empty_fixed_array();
3442 module->set_code(*sfi);
3443 module->set_exports(*exports);
3444 module->set_regular_exports(*regular_exports);
3445 module->set_regular_imports(*regular_imports);
3446 module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue));
3447 module->set_module_namespace(roots.undefined_value(), SKIP_WRITE_BARRIER);
3448 module->set_requested_modules(*requested_modules);
3449 module->set_status(Module::kUnlinked);
3450 module->set_exception(roots.the_hole_value(), SKIP_WRITE_BARRIER);
3451 module->set_top_level_capability(roots.undefined_value(), SKIP_WRITE_BARRIER);
3452 module->set_import_meta(roots.the_hole_value(), kReleaseStore,
3453 SKIP_WRITE_BARRIER);
3454 module->set_dfs_index(-1);
3455 module->set_dfs_ancestor_index(-1);
3456 module->set_flags(0);
3457 module->set_has_toplevel_await(IsModuleWithTopLevelAwait(sfi->kind()));
3458 module->set_async_evaluation_ordinal(SourceTextModule::kNotAsyncEvaluated);
3459 module->set_cycle_root(roots.the_hole_value(), SKIP_WRITE_BARRIER);
3460 module->set_async_parent_modules(roots.empty_array_list());
3461 module->set_pending_async_dependencies(0);
3471 ObjectHashTable::New(
isolate(),
static_cast<int>(export_names->length()));
3474 reinterpret_cast<Address>(evaluation_steps));
3479 module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue));
3480 module->set_module_namespace(roots.undefined_value(), SKIP_WRITE_BARRIER);
3481 module->set_status(Module::kUnlinked);
3482 module->set_exception(roots.the_hole_value(), SKIP_WRITE_BARRIER);
3483 module->set_top_level_capability(roots.undefined_value(), SKIP_WRITE_BARRIER);
3484 module->set_name(*module_name);
3485 module->set_export_names(*export_names);
3486 module->set_exports(*exports);
3487 module->set_evaluation_steps(*evaluation_steps_foreign);
3492 std::shared_ptr<BackingStore> backing_store,
AllocationType allocation) {
3497 if (backing_store->is_resizable_by_js()) {
3504 std::move(backing_store),
isolate());
3517 size_t byte_length,
size_t max_byte_length,
InitializedFlag initialized,
3519 DCHECK_LE(byte_length, max_byte_length);
3520 std::unique_ptr<BackingStore> backing_store =
nullptr;
3523 size_t page_size, initial_pages, max_pages;
3526 &initial_pages, &max_pages)
3532 isolate(), byte_length, max_byte_length, page_size, initial_pages,
3536 if (byte_length > 0) {
3549 std::move(backing_store),
isolate());
3550 return array_buffer;
3554 std::shared_ptr<BackingStore> backing_store) {
3561 ResizableFlag resizable = backing_store->is_resizable_by_js()
3579 return js_iter_result;
3612 size_t* element_size) {
3614#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) \
3615 case TYPE##_ELEMENTS: \
3616 *array_type = kExternal##Type##Array; \
3617 *element_size = sizeof(ctype); \
3621#undef TYPED_ARRAY_CASE
3631 size_t byte_length) {
3633 CHECK_LE(byte_length, buffer->GetByteLength());
3634 CHECK_LE(byte_offset, buffer->GetByteLength());
3635 CHECK_LE(byte_offset + byte_length, buffer->GetByteLength());
3646 raw->set_byte_offset(byte_offset);
3647 raw->set_byte_length(byte_length);
3648 raw->set_bit_field(0);
3653 return array_buffer_view;
3658 size_t byte_offset,
size_t length,
bool is_length_tracking) {
3659 size_t element_size;
3664 buffer->is_resizable_by_js() && !buffer->is_shared();
3669 isolate()->raw_native_context()->TypedArrayElementsKindToRabGsabCtorMap(
3674 isolate()->raw_native_context()->TypedArrayElementsKindToCtorMap(
3679 if (is_length_tracking) {
3686 CHECK_EQ(0, byte_offset % element_size);
3687 size_t byte_length = length * element_size;
3690 map, empty_byte_array(), buffer, byte_offset, byte_length));
3693 raw->set_length(length);
3694 raw->SetOffHeapDataPtr(
isolate(), buffer->backing_store(), byte_offset);
3695 raw->set_is_length_tracking(is_length_tracking);
3702 bool is_length_tracking) {
3703 if (is_length_tracking) {
3708 bool is_backed_by_rab = !buffer->is_shared() && buffer->is_resizable_by_js();
3719 map, empty_fixed_array(), buffer, byte_offset, byte_length));
3720 obj->set_data_pointer(
3721 isolate(),
static_cast<uint8_t*
>(buffer->backing_store()) + byte_offset);
3722 obj->set_is_length_tracking(is_length_tracking);
3731 DCHECK(IsCallable(*target_function));
3735 NewRangeError(MessageTemplate::kTooManyArguments));
3739 target_function->GetCreationContext().value());
3743 if (bound_args.empty()) {
3744 bound_arguments = empty_fixed_array();
3747 for (
int i = 0;
i < bound_args.
length(); ++
i) {
3748 bound_arguments->set(
i, *bound_args[
i]);
3754 IsConstructor(*target_function)
3755 ?
isolate()->bound_function_with_constructor_map()
3756 :
isolate()->bound_function_without_constructor_map();
3757 if (map->prototype() != *prototype) {
3761 DCHECK_EQ(IsConstructor(*target_function), map->is_constructor());
3780 ? IsConstructor(*target)
3781 ?
isolate()->proxy_constructor_map()
3782 :
isolate()->proxy_callable_map()
3801 raw->set_is_access_check_needed(
true);
3802 raw->set_may_have_interesting_properties(
true);
3810 proxy->GetOrCreateIdentityHash(
isolate());
3816 DCHECK(constructor->has_initial_map());
3824 if (old_map->is_prototype_map()) {
3826 map->set_is_prototype_map(
true);
3829 old_map->NotifyLeafMapLayoutChange(
isolate());
3833 DCHECK(map->instance_size() == old_map->instance_size());
3834 DCHECK(map->instance_type() == old_map->instance_type());
3848 DCHECK_EQ(object->map()->map(), constructor->map()->map());
3860 message_obj->set_raw_properties_or_hash(*empty_fixed_array(),
3862 message_obj->initialize_elements();
3864 message_obj->set_type(message);
3866 message_obj->set_start_position(start_position);
3867 message_obj->set_end_position(end_position);
3869 if (start_position >= 0) {
3876 message_obj->set_bytecode_offset(
Smi::FromInt(bytecode_offset));
3908 builtin, len, adapt,
kind);
3916 *interpreter_data_map()));
3918 interpreter_data->init_self_indirect_pointer(
isolate());
3919 interpreter_data->set_bytecode_array(*bytecode_array);
3920 interpreter_data->set_interpreter_trampoline(*code);
3925 int mask = (number_string_cache()->length() >> 1) - 1;
3926 return number.value() &
mask;
3930 int mask = (number_string_cache()->length() >> 1) - 1;
3932 return (
static_cast<int>(bits) ^
static_cast<int>(bits >> 32)) &
mask;
3940 int32_t int32v =
static_cast<int32_t
>(
static_cast<uint32_t
>(
value));
3945 double double_value =
static_cast<double>(
value);
3952 size_t value_copy =
value;
3955 buffer[--
i] =
'0' + (value_copy % 10);
3957 }
while (value_copy > 0);
3958 char*
string = buffer.
begin() +
i;
3968 static_cast<uint32_t
>(value), raw->length());
3969 raw->set_raw_hash_field(raw_hash_field);
3977 DCHECK(!shared->HasDebugInfo(isolate()));
3984 debug_info->set_shared(raw_shared);
3985 debug_info->set_debugger_hints(0);
3988 debug_info->clear_original_bytecode_array();
3989 debug_info->clear_debug_bytecode_array();
3998 new_break_point_info->set_source_position(source_position);
3999 new_break_point_info->set_break_points(*undefined_value(),
4006 auto new_break_point =
4009 new_break_point->set_id(
id);
4010 new_break_point->set_condition(*
condition);
4025 info->set_code_offset_or_source_position(code_offset_or_source_position);
4026 info->set_flags(flags);
4035 DCHECK_GE(bytecode_offset_or_source_position, 0);
4041 info->set_bytecode_offset_or_source_position(
4042 bytecode_offset_or_source_position);
4053 info->set_id(
isolate()->
heap()->NextStackTraceId());
4060 bool strict_mode_callee =
is_strict(callee->shared()->language_mode()) ||
4061 !callee->shared()->has_simple_parameters();
4063 ?
isolate()->strict_arguments_map()
4064 :
isolate()->sloppy_arguments_map();
4074 if (!strict_mode_callee) {
4087 return handle(context->slow_object_with_object_prototype_map(), isolate());
4098 if (
result.GetHeapObjectIfWeak(&heap_object)) {
4100 DCHECK(!map->is_dictionary_map());
4106 DCHECK(!map->is_dictionary_map());
4107 cache->set(number_of_properties,
MakeWeak(*map));
4118 handler->set_context(*context);
4125 switch (data_count) {
4127 map = load_handler1_map();
4130 map = load_handler2_map();
4133 map = load_handler3_map();
4143 switch (data_count) {
4145 map = store_handler0_map();
4148 map = store_handler1_map();
4151 map = store_handler2_map();
4154 map = store_handler3_map();
4164 JSRegExp::Flags flags,
4168 regexp->set_data(*regexp_data);
4173 JSRegExp::Flags flags,
int capture_count,
4174 uint32_t backtrack_limit) {
4177 regexp->set_data(*regexp_data);
4182 JSRegExp::Flags flags,
4183 int capture_count) {
4186 regexp->set_data(*regexp_data);
4193 int size = AtomRegExpData::kSize;
4198 instance->init_self_indirect_pointer(
isolate());
4200 instance->set_source(*source);
4201 instance->set_flags(flags);
4202 instance->set_pattern(*
pattern);
4204 instance->set_wrapper(raw_wrapper);
4205 raw_wrapper->set_data(instance);
4210 JSRegExp::Flags flags,
4212 uint32_t backtrack_limit) {
4214 int size = IrRegExpData::kSize;
4219 instance->init_self_indirect_pointer(
isolate());
4221 instance->set_source(*source);
4222 instance->set_flags(flags);
4223 instance->clear_latin1_code();
4224 instance->clear_uc16_code();
4225 instance->clear_latin1_bytecode();
4226 instance->clear_uc16_bytecode();
4229 instance->set_capture_count(capture_count);
4230 int ticks_until_tier_up =
v8_flags.regexp_tier_up
4233 instance->set_ticks_until_tier_up(ticks_until_tier_up);
4234 instance->set_backtrack_limit(backtrack_limit);
4236 instance->set_wrapper(raw_wrapper);
4237 raw_wrapper->set_data(instance);
4244 int size = IrRegExpData::kSize;
4256 instance->init_self_indirect_pointer(
isolate());
4258 instance->set_source(*source);
4259 instance->set_flags(flags);
4260 instance->clear_latin1_code();
4261 instance->clear_uc16_code();
4262 instance->clear_latin1_bytecode();
4263 instance->clear_uc16_bytecode();
4266 instance->set_capture_count(capture_count);
4270 instance->set_wrapper(raw_wrapper);
4271 raw_wrapper->set_data(instance);
4277 return undefined_value();
4287 return default_string();
4289 return number_string();
4291 return string_string();
4302 int descriptors_count = has_prototype ? 5 : 4;
4303 int inobject_properties_count = 0;
4307 JS_FUNCTION_TYPE, header_size + inobject_properties_count *
kTaggedSize,
4312 raw_map->set_has_prototype_slot(has_prototype);
4313 raw_map->set_is_constructor(has_prototype);
4314 raw_map->set_is_callable(
true);
4317 if (maybe_empty_function.
ToHandle(&empty_function)) {
4319 map->SetConstructor(*empty_function);
4325 isolate()->raw_native_context()->get(Context::EMPTY_FUNCTION_INDEX)));
4340 int field_index = 0;
4345 length_string(), function_length_accessor(), roc_attribs);
4346 map->AppendDescriptor(
isolate(), &d);
4356 map->AppendDescriptor(
isolate(), &d);
4361 name_string(), function_name_accessor(), roc_attribs);
4362 map->AppendDescriptor(
isolate(), &d);
4366 arguments_string(), function_arguments_accessor(), ro_attribs);
4367 map->AppendDescriptor(
isolate(), &d);
4371 caller_string(), function_caller_accessor(), ro_attribs);
4372 map->AppendDescriptor(
isolate(), &d);
4380 prototype_string(), function_prototype_accessor(), attribs);
4381 map->AppendDescriptor(
isolate(), &d);
4383 DCHECK_EQ(inobject_properties_count, field_index);
4385 0, map->instance_descriptors(isolate())->number_of_slack_descriptors());
4395 int inobject_properties_count = 0;
4399 ++inobject_properties_count;
4401 ++descriptors_count;
4403 descriptors_count += inobject_properties_count;
4406 JS_FUNCTION_TYPE, header_size + inobject_properties_count *
kTaggedSize,
4411 raw_map->set_has_prototype_slot(has_prototype);
4412 raw_map->set_is_constructor(has_prototype);
4413 raw_map->set_is_callable(
true);
4415 raw_map->SetConstructor(*empty_function);
4431 int field_index = 0;
4432 static_assert(JSFunction::kLengthDescriptorIndex == 0);
4435 length_string(), function_length_accessor(), roc_attribs);
4436 map->AppendDescriptor(
isolate(), &d);
4439 static_assert(JSFunction::kNameDescriptorIndex == 1);
4445 map->AppendDescriptor(
isolate(), &d);
4450 name_string(), function_name_accessor(), roc_attribs);
4451 map->AppendDescriptor(
isolate(), &d);
4460 prototype_string(), function_prototype_accessor(), attribs);
4461 map->AppendDescriptor(
isolate(), &d);
4463 DCHECK_EQ(inobject_properties_count, field_index);
4465 0, map->instance_descriptors(isolate())->number_of_slack_descriptors());
4477 raw_map->set_has_prototype_slot(
true);
4478 raw_map->set_is_constructor(
true);
4479 raw_map->set_is_prototype_map(
true);
4480 raw_map->set_is_callable(
true);
4482 raw_map->SetConstructor(*empty_function);
4496 static_assert(JSFunction::kLengthDescriptorIndex == 0);
4499 length_string(), function_length_accessor(), roc_attribs);
4500 map->AppendDescriptor(
isolate(), &d);
4506 prototype_string(), function_prototype_accessor(), ro_attribs);
4507 map->AppendDescriptor(
isolate(), &d);
4521 InitEmbedderFields(*promise,
Smi::zero());
4562 const int num_oob_fields =
4564 instance_map->GetInObjectProperties();
4565 if (num_oob_fields > 0) {
4571 bool has_elements_dictionary;
4572 if ((has_elements_dictionary =
4573 maybe_elements_template.
ToHandle(&elements_dictionary))) {
4574 elements_dictionary = NumberDictionary::ShallowCopy(
4584 if (!property_array.
is_null()) instance->SetProperties(*property_array);
4585 if (has_elements_dictionary) instance->set_elements(*elements_dictionary);
4597 instance->set_elements(*storage);
4599 constructor->initial_map(),
4612 mutex->SetNullWaiterQueueHead();
4621 cond->set_state(JSAtomicsCondition::kEmptyState);
4622 cond->SetNullWaiterQueueHead();
4628 that->set_template_info_flags(0);
4630 that->set_is_cacheable(is_cacheable);
4633inline void InitializeTemplateWithProperties(
4635 bool is_cacheable) {
4636 InitializeTemplate(that, is_cacheable);
4638 that->set_number_of_properties(0);
4646 int length,
bool do_not_cache) {
4647 const int size = FunctionTemplateInfo::SizeFor();
4657 InitializeTemplateWithProperties(raw, roots, !do_not_cache);
4667 raw->set_undetectable(
false);
4668 raw->set_needs_access_check(
false);
4669 raw->set_accept_any_receiver(
true);
4670 raw->set_exception_context(
4673 raw->set_length(length);
4674 raw->SetInstanceType(0);
4676 raw->set_callback_data(roots.the_hole_value(),
kReleaseStore,
4684 const int size = ObjectTemplateInfo::SizeFor();
4693 InitializeTemplateWithProperties(raw, roots, !do_not_cache);
4694 if (constructor.is_null()) {
4697 raw->set_constructor(*constructor);
4706 const int size = DictionaryTemplateInfo::SizeFor();
4710 InitializeTemplate(obj,
true);
4711 obj->set_property_names(*property_names);
4723 foreign->set_foreign_address(addr);
4741 if (code->kind() == CodeKind::BASELINE) {
4755 if (!maybe_map_.ToHandle(&map)) {
4761 DCHECK(InstanceTypeChecker::IsJSFunction(*map));
4764 bool many_closures_cell =
false;
4779 if (maybe_feedback_cell_.ToHandle(&feedback_cell)) {
4781 cell_transition = feedback_cell->IncrementClosureCount(
isolate_);
4784 feedback_cell =
isolate_->factory()->many_closures_cell();
4786 many_closures_cell =
true;
4793 function->initialize_properties(isolate);
4794 function->initialize_elements();
4795 function->set_shared(*sfi_, mode);
4797 function->set_raw_feedback_cell(*feedback_cell, mode);
4799#ifdef V8_ENABLE_LEAPTIERING
4800 if (!many_closures_cell) {
4806 DCHECK_NE(*feedback_cell, *isolate->factory()->many_closures_cell());
4824 if (old_code->is_builtin()) {
4825 jdt->SetCodeNoWriteBarrier(dispatch_handle, *code);
4826 function->set_dispatch_handle(dispatch_handle, mode_if_setting_code);
4832 old_code->is_context_specialized()) {
4833 jdt->SetCodeNoWriteBarrier(dispatch_handle, *code);
4834 function->set_dispatch_handle(dispatch_handle, mode_if_setting_code);
4835 DCHECK(old_code->kind() == CodeKind::MAGLEV ||
4836 old_code->kind() == CodeKind::TURBOFAN_JS);
4837 if (!old_code->marked_for_deoptimization()) {
4838 function->RequestOptimization(isolate, old_code->kind());
4841 function->set_dispatch_handle(dispatch_handle, mode);
4846 USE(cell_transition, many_closures_cell);
4847 function->UpdateCode(*code, mode);
4850 if (function->has_prototype_slot()) {
4851 function->set_prototype_or_initial_map(
4863#ifdef V8_ENABLE_LEAPTIERING
4868 if (many_closures_cell) {
4872 DCHECK(code->kind() == CodeKind::BUILTIN ||
4873 code->kind() == CodeKind::JS_TO_WASM_FUNCTION ||
4874 code->kind() == CodeKind::BASELINE);
4878 function_handle->clear_dispatch_handle();
4880 function_handle, JSFunction::kDispatchHandleOffset, isolate,
4881 sfi_->internal_formal_parameter_count_with_receiver(), code);
4887 return function_handle;
#define INTERCEPTOR_INFO_CALLBACK_LIST(V)
#define DEFINE_ERROR(NAME, name)
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
#define BUILTIN_CODE(isolate, name)
#define SLOW_DCHECK(condition)
static const int kEmbedderFieldCount
static constexpr int kEmbedderFieldCount
virtual size_t length() const =0
virtual bool IsCacheable() const
virtual size_t length() const =0
static constexpr U encode(T value)
constexpr T * begin() const
constexpr T * data() const
static Vector< T > cast(Vector< S > input)
static bool CanTrack(InstanceType type)
static V8_EXPORT_PRIVATE DirectHandle< ArrayList > Add(Isolate *isolate, DirectHandle< ArrayList > array, Tagged< Smi > obj, AllocationType allocation=AllocationType::kYoung)
static DirectHandle< ArrayList > New(IsolateT *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static std::unique_ptr< BackingStore > TryAllocateAndPartiallyCommitMemory(Isolate *isolate, size_t byte_length, size_t max_byte_length, size_t page_size, size_t initial_pages, size_t maximum_pages, WasmMemoryFlag wasm_memory, SharedFlag shared, bool has_guard_regions=false)
static std::unique_ptr< BackingStore > Allocate(Isolate *isolate, size_t byte_length, SharedFlag shared, InitializedFlag initialized)
static bool IsIsolateIndependentBuiltin(Tagged< Code > code)
static constexpr bool IsBuiltinId(Builtin builtin)
static constexpr int SizeFor(int length)
static constexpr BytecodeOffset None()
static const int kMaxArguments
static void PostInstantiation(Isolate *isolate, DirectHandle< JSFunction > function, IsCompiledScope *is_compiled_scope)
static V8_INLINE constexpr int SizeFor(int length)
@ MIN_CONTEXT_EXTENDED_SLOTS
@ CONTEXT_SIDE_TABLE_PROPERTY_INDEX
static const int kTodoHeaderSize
static const int kNoDebuggingId
static V8_EXPORT_PRIVATE Tagged< DependentCode > empty_dependent_code(const ReadOnlyRoots &roots)
static Descriptor DataField(Isolate *isolate, DirectHandle< Name > key, int field_index, PropertyAttributes attributes, Representation representation)
static Descriptor AccessorConstant(DirectHandle< Name > key, DirectHandle< Object > foreign, PropertyAttributes attributes)
V8_INLINE bool is_null() const
static constexpr int SizeFor(int length)
V8_INLINE void Initialize(Tagged< Object > initial_value)
static Handle< JSObject > MakeGenericError(Isolate *isolate, DirectHandle< JSFunction > constructor, MessageTemplate index, base::Vector< const DirectHandle< Object > > args, FrameSkipMode mode)
static MaybeDirectHandle< JSObject > Construct(Isolate *isolate, DirectHandle< JSFunction > target, DirectHandle< Object > new_target, DirectHandle< Object > message, DirectHandle< Object > options)
static DirectHandle< JSObject > ShadowRealmConstructTypeErrorCopy(Isolate *isolate, DirectHandle< Object > original, MessageTemplate index, base::Vector< const DirectHandle< Object > > args)
Handle< Boolean > ToBoolean(bool value)
Tagged< HeapObject > AllocateRawWithImmortalMap(int size, AllocationType allocation, Tagged< Map > map, AllocationAlignment alignment=kTaggedAligned)
Tagged< HeapObject > AllocateRawFixedArray(int length, AllocationType allocation)
Handle< SharedFunctionInfo > NewSharedFunctionInfo(AllocationType allocation)
Handle< WeakFixedArray > NewWeakFixedArrayWithMap(Tagged< Map > map, int length, AllocationType allocation=AllocationType::kYoung)
DirectHandle< RegExpDataWrapper > NewRegExpDataWrapper()
Handle< String > MakeOrFindTwoCharacterString(uint16_t c1, uint16_t c2)
Handle< String > NewStringFromAsciiChecked(const char *str, AllocationType allocation=AllocationType::kYoung)
V8_WARN_UNUSED_RESULT Handle< String > SmiToString(Tagged< Smi > number, NumberCacheMode mode=NumberCacheMode::kBoth)
Handle< Code > NewCode(const NewCodeOptions &options)
Handle< String > LookupSingleCharacterStringFromCode(uint16_t code)
V8_WARN_UNUSED_RESULT MaybeHandle< SeqOneByteString > NewRawOneByteString(int length, AllocationType allocation=AllocationType::kYoung)
Handle< SwissNameDictionary > NewSwissNameDictionary(int at_least_space_for=kSwissNameDictionaryInitialCapacity, AllocationType allocation=AllocationType::kYoung)
V8_WARN_UNUSED_RESULT Handle< String > HeapNumberToString(DirectHandle< HeapNumber > number, double value, NumberCacheMode mode=NumberCacheMode::kBoth)
Handle< ByteArray > NewByteArray(int length, AllocationType allocation=AllocationType::kYoung)
Tagged< HeapObject > AllocateRawWeakArrayList(int length, AllocationType allocation)
DirectHandle< BytecodeWrapper > NewBytecodeWrapper(AllocationType allocation=AllocationType::kOld)
MaybeDirectHandle< Map > GetInPlaceInternalizedStringMap(Tagged< Map > from_string_map)
Handle< SeqOneByteString > AllocateRawOneByteInternalizedString(int length, uint32_t raw_hash_field)
Handle< FixedArray > NewFixedArrayWithHoles(int length, AllocationType allocation=AllocationType::kYoung)
static constexpr int kNumberToStringBufferSize
Tagged< StructType > NewStructInternal(InstanceType type, AllocationType allocation)
Handle< FixedArrayBase > NewFixedDoubleArray(int length, AllocationType allocation=AllocationType::kYoung)
V8_WARN_UNUSED_RESULT MaybeHandle< SeqTwoByteString > NewRawTwoByteString(int length, AllocationType allocation=AllocationType::kYoung)
Handle< Struct > NewStruct(InstanceType type, AllocationType allocation=AllocationType::kYoung)
Handle< FixedArray > NewFixedArray(int length, AllocationType allocation=AllocationType::kYoung)
Handle< SeqTwoByteString > AllocateRawTwoByteInternalizedString(int length, uint32_t raw_hash_field)
Handle< TrustedByteArray > NewTrustedByteArray(int length, AllocationType allocation_type=AllocationType::kTrusted)
Handle< String > InternalizeStringWithKey(StringTableKey *key)
Handle< HeapNumber > NewHeapNumber()
DirectHandle< TrustedByteArray > NewTrustedByteArray(int length)
CodeBuilder(Isolate *isolate, const CodeDesc &desc, CodeKind kind)
Tagged< HeapObject > AllocateUninitializedInstructionStream(bool retry_allocation_or_fail)
V8_WARN_UNUSED_RESULT Handle< Code > Build()
Handle< Code > NewCode(const NewCodeOptions &options)
MaybeHandle< Code > BuildInternal(bool retry_allocation_or_fail)
V8_WARN_UNUSED_RESULT MaybeHandle< Code > TryBuild()
V8_WARN_UNUSED_RESULT Handle< JSFunction > BuildRaw(DirectHandle< Code > code)
JSFunctionBuilder(Isolate *isolate, DirectHandle< SharedFunctionInfo > sfi, DirectHandle< Context > context)
V8_WARN_UNUSED_RESULT Handle< JSFunction > Build()
Handle< JSGlobalProxy > NewUninitializedJSGlobalProxy(int size)
Handle< FixedArray > CopyFixedArray(Handle< FixedArray > array)
DirectHandle< Map > NewMapWithMetaMap(DirectHandle< Map > meta_map, InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, int inobject_properties=0, AllocationType allocation_type=AllocationType::kMap)
Handle< Map > NewContextlessMap(InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, int inobject_properties=0, AllocationType allocation_type=AllocationType::kMap)
ReadOnlyRoots read_only_roots() const
Handle< JSArrayBufferView > NewJSArrayBufferView(DirectHandle< Map > map, DirectHandle< FixedArrayBase > elements, DirectHandle< JSArrayBuffer > buffer, size_t byte_offset, size_t byte_length)
DirectHandle< HeapObject > NewFillerObject(int size, AllocationAlignment alignment, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime)
DirectHandle< Object > GlobalConstantFor(DirectHandle< Name > name)
DirectHandle< String > ToPrimitiveHintString(ToPrimitiveHint hint)
DirectHandle< StringClass > InternalizeExternalString(DirectHandle< String > string)
V8_WARN_UNUSED_RESULT MaybeHandle< FixedArray > TryNewFixedArray(int length, AllocationType allocation=AllocationType::kYoung)
Isolate * isolate() const
DirectHandle< DictionaryTemplateInfo > NewDictionaryTemplateInfo(DirectHandle< FixedArray > property_names)
bool CanAllocateInReadOnlySpace()
static bool IsFunctionModeWithName(FunctionMode function_mode)
Handle< Symbol > NewSymbol(AllocationType allocation=AllocationType::kOld)
void InitializeAllocationMemento(Tagged< AllocationMemento > memento, Tagged< AllocationSite > allocation_site)
Handle< JSGlobalObject > NewJSGlobalObject(DirectHandle< JSFunction > constructor)
Handle< JSWeakMap > NewJSWeakMap()
Handle< SharedFunctionInfo > NewSharedFunctionInfoForBuiltin(MaybeDirectHandle< String > name, Builtin builtin, int len, AdaptArguments adapt, FunctionKind kind=FunctionKind::kNormalFunction)
static bool IsFunctionModeWithWritablePrototype(FunctionMode function_mode)
DirectHandle< WeakArrayList > NewWeakArrayList(int capacity, AllocationType allocation=AllocationType::kYoung)
Handle< T > AllocateSmallOrderedHashTable(DirectHandle< Map > map, int capacity, AllocationType allocation)
Handle< SharedFunctionInfo > NewSharedFunctionInfoForApiFunction(MaybeDirectHandle< String > maybe_name, DirectHandle< FunctionTemplateInfo > function_template_info, FunctionKind kind)
DirectHandle< RegExpData > NewIrRegExpData(DirectHandle< String > source, JSRegExp::Flags flags, int capture_count, uint32_t backtrack_limit)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=ArrayStorageAllocationMode::DONT_INITIALIZE_ARRAY_ELEMENTS, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSSharedArray > NewJSSharedArray(DirectHandle< JSFunction > constructor, int length)
DirectHandle< Context > NewScriptContext(DirectHandle< NativeContext > outer, DirectHandle< ScopeInfo > scope_info)
DirectHandle< Map > CreateStrictFunctionMap(FunctionMode function_mode, DirectHandle< JSFunction > empty_function)
Handle< JSObject > NewSlowJSObjectWithNullProto()
static void TypeAndSizeForElementsKind(ElementsKind kind, ExternalArrayType *array_type, size_t *element_size)
Handle< Symbol > NewPrivateSymbol(AllocationType allocation=AllocationType::kOld)
DirectHandle< InterceptorInfo > NewInterceptorInfo(AllocationType allocation=AllocationType::kOld)
Handle< JSObject > NewJSObjectWithNullProto()
Tagged< HeapObject > AllocateRawWithAllocationSite(DirectHandle< Map > map, AllocationType allocation, DirectHandle< AllocationSite > allocation_site)
void SetRegExpAtomData(DirectHandle< JSRegExp > regexp, DirectHandle< String > source, JSRegExp::Flags flags, DirectHandle< String > match_pattern)
DirectHandle< PromiseResolveThenableJobTask > NewPromiseResolveThenableJobTask(DirectHandle< JSPromise > promise_to_resolve, DirectHandle< JSReceiver > thenable, DirectHandle< JSReceiver > then, DirectHandle< Context > context)
void InitializeCppHeapWrapper(Tagged< JSObject > obj)
Handle< JSTypedArray > NewJSTypedArray(ExternalArrayType type, DirectHandle< JSArrayBuffer > buffer, size_t byte_offset, size_t length, bool is_length_tracking=false)
Handle< T > CopyArrayAndGrow(DirectHandle< T > src, int grow_by, AllocationType allocation)
DirectHandle< SwissNameDictionary > CreateCanonicalEmptySwissNameDictionary()
Handle< FixedArray > CopyFixedArrayWithMap(DirectHandle< FixedArray > array, DirectHandle< Map > map, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSGeneratorObject > NewJSGeneratorObject(DirectHandle< JSFunction > function)
DirectHandle< FunctionTemplateInfo > NewFunctionTemplateInfo(int length, bool do_not_cache)
DirectHandle< JSSharedStruct > NewJSSharedStruct(DirectHandle< JSFunction > constructor, MaybeDirectHandle< NumberDictionary > maybe_elements_template)
DirectHandle< TransitionArray > NewTransitionArray(int number_of_transitions, int slack=0)
V8_INLINE Handle< Map > NewMapImpl(MetaMapProviderFunc &&meta_map_provider, InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, int inobject_properties=0, AllocationType allocation_type=AllocationType::kMap)
Handle< JSObject > CopyJSObject(DirectHandle< JSObject > object)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewStringFromUtf8SubString(Handle< SeqOneByteString > str, int begin, int end, AllocationType allocation=AllocationType::kYoung)
DirectHandle< Context > NewFunctionContext(DirectHandle< Context > outer, DirectHandle< ScopeInfo > scope_info)
DirectHandle< Map > NewContextfulMap(DirectHandle< JSReceiver > creation_context_holder, InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, int inobject_properties=0, AllocationType allocation_type=AllocationType::kMap)
DirectHandle< ContextSidePropertyCell > NewContextSidePropertyCell(ContextSidePropertyCell::Property property, AllocationType allocation=AllocationType::kOld)
Handle< FixedDoubleArray > CopyFixedDoubleArray(Handle< FixedDoubleArray > array)
DirectHandle< PropertyCell > NewProtector()
DirectHandle< PrototypeInfo > NewPrototypeInfo()
DirectHandle< JSWrappedFunction > NewJSWrappedFunction(DirectHandle< NativeContext > creation_context, DirectHandle< Object > target)
Handle< TrustedForeign > NewTrustedForeign(Address addr)
MaybeHandle< JSArrayBuffer > NewJSArrayBufferAndBackingStore(size_t byte_length, InitializedFlag initialized, AllocationType allocation=AllocationType::kYoung)
Handle< LoadHandler > NewLoadHandler(int data_count, AllocationType allocation=AllocationType::kOld)
DirectHandle< AccessorInfo > NewAccessorInfo()
DirectHandle< JSObject > NewFunctionPrototype(DirectHandle< JSFunction > function)
DirectHandle< Tuple2 > NewTuple2(DirectHandle< Object > value1, DirectHandle< Object > value2, AllocationType allocation)
Handle< JSObject > NewJSObject(DirectHandle< JSFunction > constructor, AllocationType allocation=AllocationType::kYoung, NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
DirectHandle< Context > NewModuleContext(DirectHandle< SourceTextModule > module, DirectHandle< NativeContext > outer, DirectHandle< ScopeInfo > scope_info)
DirectHandle< SourceTextModule > NewSourceTextModule(DirectHandle< SharedFunctionInfo > code)
DirectHandle< JSStringIterator > NewJSStringIterator(Handle< String > string)
Handle< JSArrayBuffer > NewJSSharedArrayBuffer(std::shared_ptr< BackingStore > backing_store)
Handle< Map > NewContextfulMapForCurrentContext(InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, int inobject_properties=0, AllocationType allocation_type=AllocationType::kMap)
DirectHandle< Context > NewBlockContext(DirectHandle< Context > previous, DirectHandle< ScopeInfo > scope_info)
Handle< CallSiteInfo > 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)
DirectHandle< Hole > NewHole()
Tagged< Map > InitializeMap(Tagged< Map > map, InstanceType type, int instance_size, ElementsKind elements_kind, int inobject_properties, ReadOnlyRoots roots)
DirectHandle< FeedbackCell > NewManyClosuresCell(AllocationType allocation=AllocationType::kOld)
DirectHandle< AliasedArgumentsEntry > NewAliasedArgumentsEntry(int aliased_context_slot)
void ReinitializeJSGlobalProxy(DirectHandle< JSGlobalProxy > global, DirectHandle< JSFunction > constructor)
DirectHandle< FeedbackCell > NewNoClosuresCell()
DirectHandle< NameDictionary > NewNameDictionary(int at_least_space_for)
DirectHandle< CallbackTask > NewCallbackTask(DirectHandle< Foreign > callback, DirectHandle< Foreign > data)
Handle< WeakArrayList > CopyWeakArrayListAndGrow(DirectHandle< WeakArrayList > array, int grow_by, AllocationType allocation=AllocationType::kYoung)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewExternalStringFromTwoByte(const v8::String::ExternalStringResource *resource)
DirectHandle< WeakFixedArray > CopyWeakFixedArrayAndGrow(DirectHandle< WeakFixedArray > array, int grow_by)
DirectHandle< JSObject > NewSuppressedErrorAtDisposal(Isolate *isolate, DirectHandle< Object > error, DirectHandle< Object > suppressed_error)
Handle< SmallOrderedNameDictionary > NewSmallOrderedNameDictionary(int capacity=kSmallOrderedHashMapMinCapacity, AllocationType allocation=AllocationType::kYoung)
DirectHandle< MegaDomHandler > NewMegaDomHandler(MaybeObjectDirectHandle accessor, MaybeObjectDirectHandle context)
void SetRegExpIrregexpData(DirectHandle< JSRegExp > regexp, DirectHandle< String > source, JSRegExp::Flags flags, int capture_count, uint32_t backtrack_limit)
Handle< PropertyCell > NewPropertyCell(DirectHandle< Name > name, PropertyDetails details, DirectHandle< Object > value, AllocationType allocation=AllocationType::kOld)
DirectHandle< StackFrameInfo > NewStackFrameInfo(DirectHandle< UnionOf< SharedFunctionInfo, Script > > shared_or_script, int bytecode_offset_or_source_position, DirectHandle< String > function_name, bool is_constructor)
DirectHandle< WeakArrayList > CompactWeakArrayList(DirectHandle< WeakArrayList > array, int new_capacity, AllocationType allocation=AllocationType::kYoung)
DirectHandle< Object > NewInvalidStringLengthError()
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewExternalStringFromOneByte(const v8::String::ExternalOneByteStringResource *resource)
DirectHandle< JSArray > NewJSArrayForTemplateLiteralArray(DirectHandle< FixedArray > cooked_strings, DirectHandle< FixedArray > raw_strings, int function_literal_id, int slot_id)
DirectHandle< FeedbackCell > NewOneClosureCell(DirectHandle< ClosureFeedbackCellArray > value)
Handle< Script > CloneScript(DirectHandle< Script > script, DirectHandle< String > source)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewStringFromUtf8(base::Vector< const char > str, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSSet > NewJSSet()
DirectHandle< CallableTask > NewCallableTask(DirectHandle< JSReceiver > callable, DirectHandle< Context > context)
DirectHandle< Context > NewBuiltinContext(DirectHandle< NativeContext > native_context, int length)
DirectHandle< Code > NewCodeObjectForEmbeddedBuiltin(DirectHandle< Code > code, Address off_heap_entry)
DirectHandle< RegExpData > NewAtomRegExpData(DirectHandle< String > source, JSRegExp::Flags flags, DirectHandle< String > pattern)
DirectHandle< BytecodeArray > CopyBytecodeArray(DirectHandle< BytecodeArray >)
Handle< NativeContext > NewNativeContext()
Handle< SyntheticModule > NewSyntheticModule(DirectHandle< String > module_name, DirectHandle< FixedArray > export_names, v8::Module::SyntheticModuleEvaluationSteps evaluation_steps)
Handle< String > NewProperSubString(DirectHandle< String > str, uint32_t begin, uint32_t end)
DirectHandle< JSModuleNamespace > NewJSModuleNamespace()
Handle< BreakPoint > NewBreakPoint(int id, DirectHandle< String > condition)
Handle< FixedArray > CopyFixedArrayAndGrow(DirectHandle< FixedArray > array, int grow_by, AllocationType allocation=AllocationType::kYoung)
void InitializeJSObjectBody(Tagged< JSObject > obj, Tagged< Map > map, int start_offset)
Handle< JSDataViewOrRabGsabDataView > NewJSDataViewOrRabGsabDataView(DirectHandle< JSArrayBuffer > buffer, size_t byte_offset, size_t byte_length, bool is_length_tracking=false)
Handle< SmallOrderedHashMap > NewSmallOrderedHashMap(int capacity=kSmallOrderedHashMapMinCapacity, AllocationType allocation=AllocationType::kYoung)
Handle< FeedbackVector > NewFeedbackVector(DirectHandle< SharedFunctionInfo > shared, DirectHandle< ClosureFeedbackCellArray > closure_feedback_cell_array, DirectHandle< FeedbackCell > parent_feedback_cell)
DirectHandle< Map > CreateClassFunctionMap(DirectHandle< JSFunction > empty_function)
Handle< Foreign > NewForeign(Address addr, AllocationType allocation_type=AllocationType::kYoung)
Handle< JSProxy > NewJSProxy(DirectHandle< JSReceiver > target, DirectHandle< JSReceiver > handler)
DirectHandle< String > NewInternalizedStringImpl(DirectHandle< String > string, int len, uint32_t hash_field)
Handle< String > NewCopiedSubstring(DirectHandle< String > str, uint32_t begin, uint32_t length)
Handle< OrderedHashSet > NewOrderedHashSet()
Handle< T > CopyArrayWithMap(DirectHandle< T > src, DirectHandle< Map > map, AllocationType allocation=AllocationType::kYoung)
Handle< AllocationSite > NewAllocationSite(bool with_weak_next)
V8_WARN_UNUSED_RESULT MaybeHandle< String > NewStringFromTwoByte(base::Vector< const base::uc16 > str, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSMap > NewJSMap()
Tagged< HeapObject > AllocateRaw(int size, AllocationType allocation, AllocationAlignment alignment=kTaggedAligned)
V8_INLINE HeapAllocator * allocator() const
DirectHandle< EnumCache > NewEnumCache(DirectHandle< FixedArray > keys, DirectHandle< FixedArray > indices, AllocationType allocation=AllocationType::kOld)
MaybeDirectHandle< JSBoundFunction > NewJSBoundFunction(DirectHandle< JSReceiver > target_function, DirectHandle< JSAny > bound_this, base::Vector< DirectHandle< Object > > bound_args, DirectHandle< JSPrototype > prototype)
Handle< ScriptContextTable > NewScriptContextTable()
DirectHandle< Map > CreateSloppyFunctionMap(FunctionMode function_mode, MaybeDirectHandle< JSFunction > maybe_empty_function)
Tagged< Context > NewContextInternal(DirectHandle< Map > map, int size, int variadic_part_length, AllocationType allocation)
DirectHandle< PropertyDescriptorObject > NewPropertyDescriptorObject()
Tagged< HeapObject > New(DirectHandle< Map > map, AllocationType allocation)
Handle< JSObject > NewExternal(void *value, AllocationType allocation=AllocationType::kYoung)
Handle< JSObject > CopyJSObjectWithAllocationSite(DirectHandle< JSObject > object, DirectHandle< AllocationSite > site)
Handle< String > InternalizeSubString(HandleType< SeqString >, uint32_t from, uint32_t length, bool convert_encoding=false)
DirectHandle< EmbedderDataArray > NewEmbedderDataArray(int length)
DirectHandle< JSObject > ShadowRealmNewTypeErrorCopy(DirectHandle< Object > original, MessageTemplate template_index, base::Vector< const DirectHandle< Object > > args)
Handle< OrderedHashMap > NewOrderedHashMap()
DirectHandle< InterpreterData > NewInterpreterData(DirectHandle< BytecodeArray > bytecode_array, DirectHandle< Code > code)
DirectHandle< PropertyArray > CopyPropertyArrayAndGrow(DirectHandle< PropertyArray > array, int grow_by)
DirectHandle< Context > NewCatchContext(DirectHandle< Context > previous, DirectHandle< ScopeInfo > scope_info, DirectHandle< Object > thrown_object)
Handle< StoreHandler > NewStoreHandler(int data_count)
Handle< StackTraceInfo > NewStackTraceInfo(DirectHandle< FixedArray > frames)
void SetRegExpExperimentalData(DirectHandle< JSRegExp > regexp, DirectHandle< String > source, JSRegExp::Flags flags, int capture_count)
AllocationType AllocationTypeForInPlaceInternalizableString()
DirectHandle< ErrorStackData > NewErrorStackData(DirectHandle< UnionOf< JSAny, FixedArray > > call_site_infos_or_formatted_stack, DirectHandle< StackTraceInfo > stack_trace)
Handle< JSMessageObject > NewJSMessageObject(MessageTemplate message, DirectHandle< Object > argument, int start_position, int end_position, DirectHandle< SharedFunctionInfo > shared_info, int bytecode_offset, DirectHandle< Script > script, DirectHandle< StackTraceInfo > stack_trace=DirectHandle< StackTraceInfo >::null())
DirectHandle< String > NewSurrogatePairString(uint16_t lead, uint16_t trail)
DirectHandle< Tuple2 > NewTuple2Uninitialized(AllocationType allocation)
V8_WARN_UNUSED_RESULT StringTransitionStrategy ComputeInternalizationStrategyForString(DirectHandle< String > string, MaybeDirectHandle< Map > *internalized_map)
V8_WARN_UNUSED_RESULT StringTransitionStrategy ComputeSharingStrategyForString(DirectHandle< String > string, MaybeDirectHandle< Map > *shared_map)
DirectHandle< JSAsyncFromSyncIterator > NewJSAsyncFromSyncIterator(DirectHandle< JSReceiver > sync_iterator, DirectHandle< Object > next)
DirectHandle< Symbol > NewPrivateNameSymbol(DirectHandle< String > name)
Handle< Context > NewWithContext(DirectHandle< Context > previous, DirectHandle< ScopeInfo > scope_info, DirectHandle< JSReceiver > extension)
DirectHandle< JSDisposableStackBase > NewJSDisposableStackBase()
Handle< JSArray > NewJSArrayWithElements(DirectHandle< FixedArrayBase > elements, ElementsKind elements_kind, int length, AllocationType allocation=AllocationType::kYoung)
DirectHandle< PropertyArray > NewPropertyArray(int length, AllocationType allocation=AllocationType::kYoung)
DirectHandle< WeakFixedArray > CopyWeakFixedArray(DirectHandle< WeakFixedArray > array)
Handle< SmallOrderedHashSet > NewSmallOrderedHashSet(int capacity=kSmallOrderedHashSetMinCapacity, AllocationType allocation=AllocationType::kYoung)
Handle< JSFunction > NewFunctionForTesting(DirectHandle< String > name)
void NewJSArrayStorage(DirectHandle< JSArray > array, int length, int capacity, ArrayStorageAllocationMode mode=ArrayStorageAllocationMode::DONT_INITIALIZE_ARRAY_ELEMENTS)
Handle< JSPromise > NewJSPromise()
Handle< Map > ObjectLiteralMapFromCache(DirectHandle< NativeContext > native_context, int number_of_properties)
Handle< Context > NewDebugEvaluateContext(DirectHandle< Context > previous, DirectHandle< ScopeInfo > scope_info, DirectHandle< JSReceiver > extension, DirectHandle< Context > wrapped)
DirectHandle< FixedArrayBase > NewFixedDoubleArrayWithHoles(int size)
DirectHandle< JSObject > NewSlowJSObjectWithPropertiesAndElements(DirectHandle< JSPrototype > prototype, DirectHandle< HeapObject > properties, DirectHandle< FixedArrayBase > elements)
int NumberToStringCacheHash(Tagged< Smi > number)
DirectHandle< RegExpData > NewExperimentalRegExpData(DirectHandle< String > source, JSRegExp::Flags flags, int capture_count)
Handle< JSObject > NewJSObjectFromMap(DirectHandle< Map > map, AllocationType allocation=AllocationType::kYoung, DirectHandle< AllocationSite > allocation_site=DirectHandle< AllocationSite >::null(), NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
Handle< Map > NewMap(DirectHandle< HeapObject > meta_map_holder, InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, int inobject_properties=0, AllocationType allocation_type=AllocationType::kMap)
Handle< JSArrayBuffer > NewJSArrayBuffer(std::shared_ptr< BackingStore > backing_store, AllocationType allocation=AllocationType::kYoung)
Handle< HeapNumber > NewHeapNumberForCodeAssembler(double value)
DirectHandle< BreakPointInfo > NewBreakPointInfo(int source_position)
Handle< JSObject > NewError(DirectHandle< JSFunction > constructor, DirectHandle< String > message, DirectHandle< Object > options={})
Handle< JSAtomicsCondition > NewJSAtomicsCondition()
DirectHandle< JSSyncDisposableStack > NewJSSyncDisposableStack(DirectHandle< Map > map)
Handle< JSAtomicsMutex > NewJSAtomicsMutex()
Handle< JSObject > NewSlowJSObjectFromMap(DirectHandle< Map > map, int number_of_slow_properties, AllocationType allocation=AllocationType::kYoung, DirectHandle< AllocationSite > allocation_site=DirectHandle< AllocationSite >::null(), NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
void ProcessNewScript(DirectHandle< Script > shared, ScriptEventType script_event_type)
Handle< FixedArray > CopyFixedArrayUpTo(DirectHandle< FixedArray > array, int new_len, AllocationType allocation=AllocationType::kYoung)
DirectHandle< JSIteratorResult > NewJSIteratorResult(DirectHandle< Object > value, bool done)
static bool IsFunctionModeWithPrototype(FunctionMode function_mode)
bool EmptyStringRootIsInitialized()
DirectHandle< JSAsyncDisposableStack > NewJSAsyncDisposableStack(DirectHandle< Map > map)
Handle< JSArray > NewJSArrayWithUnverifiedElements(DirectHandle< FixedArrayBase > elements, ElementsKind elements_kind, int length, AllocationType allocation=AllocationType::kYoung)
Handle< JSPromise > NewJSPromiseWithoutHook()
DirectHandle< ObjectTemplateInfo > NewObjectTemplateInfo(DirectHandle< FunctionTemplateInfo > constructor, bool do_not_cache)
HandleType< String > NewSubString(HandleType< T > str, uint32_t begin, uint32_t end)
Handle< String > InternalizeUtf8String(base::Vector< const char > str)
void InitializeJSObjectFromMap(Tagged< JSObject > obj, Tagged< Object > properties, Tagged< Map > map, NewJSObjectType=NewJSObjectType::kNoAPIWrapper)
Handle< String > SizeToString(size_t value, bool check_cache=true)
Handle< WeakArrayList > NewUninitializedWeakArrayList(int capacity, AllocationType allocation=AllocationType::kYoung)
Tagged< Symbol > NewSymbolInternal(AllocationType allocation=AllocationType::kOld)
Handle< DebugInfo > NewDebugInfo(DirectHandle< SharedFunctionInfo > shared)
Handle< JSObject > NewArgumentsObject(DirectHandle< JSFunction > callee, int length)
static const int kAlignedSize
static FieldIndex ForDescriptor(Tagged< Map > map, InternalIndex descriptor_index)
static constexpr int kMaxLength
V8_INLINE Address address() const
HandleType< T > CloseAndEscape(HandleType< T > handle_value)
void PatchValue(Tagged< T > new_value)
V8_INLINE bool CanAllocateInReadOnlySpace() const
V8_WARN_UNUSED_RESULT V8_INLINE Tagged< HeapObject > AllocateRawWith(int size, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
static V8_INLINE bool InYoungGeneration(Tagged< Object > object)
static V8_INLINE bool InAnySharedSpace(Tagged< HeapObject > object)
static JSDispatchHandle AllocateAndInstallJSDispatchHandle(ObjectType host, size_t offset, Isolate *isolate, uint16_t parameter_count, DirectHandle< Code > code, WriteBarrierMode mode=WriteBarrierMode::UPDATE_WRITE_BARRIER)
void set_allocation_sites_list(Tagged< UnionOf< Smi, Undefined, AllocationSiteWithWeakNext > > object)
void RegisterExternalString(Tagged< String > string)
AllocationType allocation_type_for_in_place_internalizable_strings() const
V8_EXPORT_PRIVATE void CopyRange(Tagged< HeapObject > dst_object, TSlot dst_slot, TSlot src_slot, int len, WriteBarrierMode mode)
static void Initialize(Isolate *isolate, DirectHandle< Hole > hole, DirectHandle< HeapNumber > numeric_value)
static NEVER_READ_ONLY_SPACE constexpr bool kOnHeapBodyIsContiguous
static constexpr int SizeFor(int body_size)
static V8_INLINE Tagged< InstructionStream > Initialize(Tagged< HeapObject > self, Tagged< Map > map, uint32_t body_size, int constant_pool_offset, Tagged< TrustedByteArray > reloc_info)
static IsolateGroup * current()
int GenerateIdentityHash(uint32_t mask)
Tagged< NativeContext > raw_native_context()
void RunAllPromiseHooks(PromiseHookType type, DirectHandle< JSPromise > promise, DirectHandle< Object > parent)
Handle< NativeContext > native_context()
v8::internal::Factory * factory()
RootsTable & roots_table()
static Maybe< bool > GetResizableBackingStorePageConfiguration(Isolate *isolate, size_t byte_length, size_t max_byte_length, ShouldThrow should_throw, size_t *page_size, size_t *initial_pages, size_t *max_pages)
static constexpr uint32_t kMaxArrayIndex
static constexpr StateT kUnlockedUncontended
static const int kLengthDescriptorIndex
static const int kNameDescriptorIndex
static constexpr int kSizeWithPrototype
static V8_EXPORT_PRIVATE void EnsureFeedbackVector(Isolate *isolate, DirectHandle< JSFunction > function, IsCompiledScope *compiled_scope)
FeedbackVector eventually. Generally this shouldn't be used to get the.
static constexpr int kSizeWithoutPrototype
static V8_EXPORT_PRIVATE void EnsureHasInitialMap(DirectHandle< JSFunction > function)
static int GetHeaderSize(bool function_has_prototype_slot)
static void Initialize(DirectHandle< JSMap > map, Isolate *isolate)
static V8_EXPORT_PRIVATE void AddProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static void ValidateElements(Tagged< JSObject > object)
static const int kMapCacheSize
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > V8_EXPORT_PRIVATE SetOwnPropertyIgnoreAttributes(DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static void NotifyMapChange(DirectHandle< Map > old_map, DirectHandle< Map > new_map, Isolate *isolate)
static V8_EXPORT_PRIVATE void MigrateToMap(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Map > new_map, int expected_additional_properties=0)
static DirectHandle< Map > GetElementsTransitionMap(DirectHandle< JSObject > object, ElementsKind to_kind)
static constexpr int kUninitializedValue
static void Initialize(DirectHandle< JSSet > set, Isolate *isolate)
static constexpr size_t kMaxByteLength
static void ForFixedTypedArray(ExternalArrayType array_type, size_t *element_size, ElementsKind *element_kind)
static void Initialize(DirectHandle< JSWeakCollection > collection, Isolate *isolate)
static V8_INLINE LargePageMetadata * FromHeapObject(Tagged< HeapObject > o)
static V8_EXPORT_PRIVATE Handle< Map > Create(Isolate *isolate, int inobject_properties)
static V8_EXPORT_PRIVATE void EnsureDescriptorSlack(Isolate *isolate, DirectHandle< Map > map, int slack)
static constexpr Tagged< Smi > kPrototypeChainValidSmi
static const int kNoSlackTracking
static Handle< Map > CopyDropDescriptors(Isolate *isolate, DirectHandle< Map > map)
static Handle< Map > Copy(Isolate *isolate, DirectHandle< Map > map, const char *reason, TransitionKindFlag kind=SPECIAL_TRANSITION)
bool CanHaveFastTransitionableElementsKind() const
static V8_EXPORT_PRIVATE Handle< Map > TransitionRootMapToPrototypeForNewObject(Isolate *isolate, DirectHandle< Map > map, DirectHandle< JSPrototype > prototype)
static V8_EXPORT_PRIVATE void SetPrototype(Isolate *isolate, DirectHandle< Map > map, DirectHandle< JSPrototype > prototype, bool enable_prototype_setup_mode=true)
static V8_EXPORT_PRIVATE VisitorId GetVisitorId(Tagged< Map > map)
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(DirectHandle< S > *out) const
V8_INLINE bool is_null() const
static MaybeObjectDirectHandle Weak(Tagged< Object > object, Isolate *isolate)
MarkingProgressTracker & marking_progress_tracker()
static V8_WARN_UNUSED_RESULT Handle< NameDictionary > New(IsolateT *isolate, int at_least_space_for, AllocationType allocation=AllocationType::kYoung, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY)
static const int kInitialCapacity
static uint32_t CreateHashFieldValue(uint32_t hash, HashFieldType type)
static constexpr int kEmptyHashField
bool Equals(Tagged< Name > other)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > SetProperty(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
static MaybeHandle< OrderedHashMap > Allocate(IsolateT *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static MaybeHandle< OrderedHashSet > Allocate(IsolateT *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static const int kInitialCapacity
static constexpr int kMaxLength
static constexpr int SizeFor(int length)
static const int kNoHashSentinel
PropertyAttributes attributes() const
PropertyKind kind() const
static constexpr PropertyDetails Empty(PropertyCellType cell_type=PropertyCellType::kNoCell)
Tagged< Smi > AsSmi() const
static const int kProtectorValid
static V8_EXPORT_PRIVATE bool Contains(Address address)
static constexpr Representation Tagged()
IndirectHandle< HeapNumber > FindHeapNumber(double value)
static Handle< ScriptContextTable > New(Isolate *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static void InitLineEnds(Isolate *isolate, DirectHandle< Script > script)
static constexpr int kTemporaryScriptId
static const uint32_t kMinLength
static constexpr Tagged< Smi > FromEnum(E value)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr Tagged< Smi > zero()
static constexpr int kMaxValue
static V8_INLINE uint32_t MakeArrayIndexHash(uint32_t value, uint32_t length)
base::Vector< const base::uc16 > ToUC16Vector() const
static void WriteToFlat(Tagged< String > source, SinkCharT *sink, uint32_t start, uint32_t length)
static const uint32_t kMaxLength
static V8_INLINE HandleType< String > Flatten(Isolate *isolate, HandleType< T > string, AllocationType allocation=AllocationType::kYoung)
static constexpr int kMetaTableEnumerationDataStartIndex
static constexpr int SizeFor(int capacity)
static DirectHandle< SwissNameDictionary > ShallowCopy(Isolate *isolate, DirectHandle< SwissNameDictionary > table)
static constexpr int SizeFor(int capacity)
static void store(Tagged< HeapObject > host, PtrType value)
V8_INLINE constexpr StorageType ptr() const
constexpr bool IsCleared() const
V8_INLINE constexpr bool is_null() const
static const int kUninitializedSerialNumber
static constexpr ThreadId Invalid()
static const int kSideStepTransitionsIndex
static int LengthFor(int number_of_transitions)
static const int kTransitionLengthIndex
static const int kPrototypeTransitionsIndex
static DirectHandle< TrustedManaged< CppType > > From(Isolate *isolate, size_t estimated_size, std::shared_ptr< CppType > shared_ptr)
void Decode(Char *out, base::Vector< const uint8_t > data)
static V8_INLINE Tagged_t CompressObject(Address tagged)
static int SizeFor(Tagged< Map > map, int length)
static constexpr int MaxLength(uint32_t element_size_bytes)
static int DecodeElementSizeFromMap(Tagged< Map > map)
static constexpr size_t kCapacityOffset
static constexpr int kMaxLength
static constexpr int SizeFor(int length)
static constexpr size_t kLengthOffset
static int Size(const wasm::StructType *type)
static constexpr std::array< uint16_t, kTaggedFieldsCount > kTaggedFieldOffsets
static V8_WARN_UNUSED_RESULT DirectHandle< WeakArrayList > Append(Isolate *isolate, DirectHandle< WeakArrayList > array, MaybeObjectDirectHandle value, AllocationType allocation=AllocationType::kYoung)
static void ForRange(Heap *heap, Tagged< HeapObject > object, TSlot start, TSlot end)
V8_EXPORT_PRIVATE const CanonicalSig * LookupFunctionSignature(CanonicalTypeIndex index) const
#define V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
#define ALIGN_TO_ALLOCATION_ALIGNMENT(value)
Handle< SharedFunctionInfo > info
Handle< Context > context_
#define RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE(V)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
#define THROW_NEW_ERROR(isolate, call)
base::Vector< const DirectHandle< Object > > args
#define DCHECK_NEWLY_ALLOCATED_OBJECT_IS_YOUNG(isolate, object)
#define INIT_CALLBACK_FIELD(Name, name)
#define V8_ALLOCATION_SITE_TRACKING_BOOL
SharedFunctionInfoRef shared
ZoneVector< RpoNumber > & result
#define LOG(isolate, Call)
LocalIsolate * local_isolate_
InstructionOperand source
V8_BASE_EXPORT constexpr uint32_t RoundUpToPowerOfTwo32(uint32_t value)
V8_INLINE Dest bit_cast(Source const &source)
bool MayHaveMapCheckFastCase(InstanceType type)
constexpr Tagged_t kNonJsReceiverMapLimit
V8_INLINE constexpr bool IsInternalizedString(InstanceType instance_type)
V8_INLINE constexpr bool IsNativeContextSpecific(InstanceType instance_type)
V8_INLINE constexpr bool IsMaybeReadOnlyJSObject(InstanceType instance_type)
Node::Uses::const_iterator begin(const Node::Uses &uses)
V8_EXPORT_PRIVATE WasmCodePointerTable * GetProcessWideWasmCodePointerTable()
constexpr uint32_t kMinimumSupertypeArraySize
std::optional< MessageTemplate > InitializeElementSegment(Zone *zone, Isolate *isolate, DirectHandle< WasmTrustedInstanceData > trusted_instance_data, DirectHandle< WasmTrustedInstanceData > shared_trusted_instance_data, uint32_t segment_index)
TypeCanonicalizer * GetTypeCanonicalizer()
constexpr WasmCodePointer kInvalidWasmCodePointer
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
constexpr int kFunctionEntryBytecodeOffset
constexpr int kTaggedSize
constexpr double kMaxSafeInteger
constexpr int kMaxRegularHeapObjectSize
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
SlotTraits::TObjectSlot ObjectSlot
bool IsRabGsabTypedArrayElementsKind(ElementsKind kind)
Tagged(T object) -> Tagged< T >
kWasmInternalFunctionIndirectPointerTag instance_data
bool IsResumableFunction(FunctionKind kind)
constexpr intptr_t kCodeAlignment
kInterpreterTrampolineOffset Tagged< HeapObject >
void MemsetTagged(Tagged_t *start, Tagged< MaybeObject > value, size_t counter)
@ TERMINAL_FAST_ELEMENTS_KIND
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in name
kWasmInternalFunctionIndirectPointerTag kProtectedInstanceDataOffset sig
const int kVariableSizeSentinel
Handle< To > UncheckedCast(Handle< From > value)
bool IsSmiOrObjectElementsKind(ElementsKind kind)
static const int kInvalidEnumCacheSentinel
bool IsAsyncGeneratorFunction(FunctionKind kind)
constexpr JSDispatchHandle kNullJSDispatchHandle(0)
bool IsShared(Tagged< Object > obj)
constexpr AdaptArguments kDontAdapt
typename detail::FlattenUnionHelper< Union<>, Ts... >::type UnionOf
bool IsTerminalElementsKind(ElementsKind kind)
@ SEQ_ONE_BYTE_STRING_TYPE
@ UNCACHED_EXTERNAL_TWO_BYTE_STRING_TYPE
@ UNCACHED_EXTERNAL_ONE_BYTE_STRING_TYPE
@ EXTERNAL_TWO_BYTE_STRING_TYPE
@ SEQ_TWO_BYTE_STRING_TYPE
@ EXTERNAL_ONE_BYTE_STRING_TYPE
Tagged< MaybeWeak< T > > MakeWeak(Tagged< T > value)
bool IsSharedArrayElementsKind(ElementsKind kind)
void CopyChars(DstType *dst, const SrcType *src, size_t count) V8_NONNULL(1
Map::Bits1::HasPrototypeSlotBit Map::Bits1::HasNamedInterceptorBit Map::Bits1::IsUndetectableBit Map::Bits1::IsConstructorBit Map::Bits2::IsImmutablePrototypeBit Map::Bits3::IsDeprecatedBit Map::Bits3::IsPrototypeMapBit bit_field3
bool is_strict(LanguageMode language_mode)
bool IsDictionaryElementsKind(ElementsKind kind)
Tagged< ClearedWeakValue > ClearedValue(PtrComprCageBase cage_base)
V8_EXPORT_PRIVATE FlagValues v8_flags
bool IsUniqueName(Tagged< Name > obj)
bool IsJSApiWrapperObject(Tagged< Map > map)
static constexpr Address kNullAddress
constexpr bool IsDoubleElementsKind(ElementsKind kind)
void MemCopy(void *dest, const void *src, size_t size)
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
ArrayStorageAllocationMode
@ DONT_INITIALIZE_ARRAY_ELEMENTS
@ INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset prototype
template const char * string
kInterpreterTrampolineOffset script
!IsContextMap !IsContextMap native_context
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
v8_inspector::String16 String
static constexpr ReleaseStoreTag kReleaseStore
static constexpr RelaxedStoreTag kRelaxedStore
static constexpr AcquireLoadTag kAcquireLoad
Maybe< T > Just(const T &t)
base::Vector< const char > contents
#define DCHECK_LE(v1, v2)
#define CHECK_IMPLIES(lhs, rhs)
#define CHECK_LE(lhs, rhs)
#define DCHECK_NOT_NULL(val)
#define CHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define CHECK_NE(lhs, rhs)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
constexpr bool IsAligned(T value, U alignment)
#define V8_UNLIKELY(condition)
SourcePositionTable * source_position_table_