29 switch (type.kind()) {
53 StackFrameIterator it(isolate, isolate->thread_local_top());
55 DCHECK_EQ(StackFrame::EXIT, it.frame()->type());
58 DCHECK_EQ(StackFrame::WASM_INTERPRETER_ENTRY, it.frame()->type());
59 return it.frame()->fp();
69 instance->trusted_data(isolate), isolate);
78 Address arg_buffer = (*arg_buffer_obj).ptr();
85 int num_params =
static_cast<int>(
sig->parameter_count());
86 std::vector<wasm::WasmValue> wasm_args(num_params);
88 int num_returns =
static_cast<int>(
sig->return_count());
89 std::vector<wasm::WasmValue> wasm_rets(num_returns);
97 WasmTrustedInstanceData::GetOrCreateInterpreterObject(instance);
105 isolate->Throw(*isolate->factory()->NewTypeError(
106 MessageTemplate::kWasmTrapJSTypeError));
110 Address frame_pointer = FindInterpreterEntryFramePointer(isolate);
121 Address arg_buf_ptr = arg_buffer;
122 for (
int i = 0;
i < num_params; ++
i) {
123#define CASE_ARG_TYPE(type, ctype) \
125 DCHECK_EQ(wasm::ValueTypes::ElementSizeInBytes(sig->GetParam(i)), \
128 wasm::WasmValue(base::ReadUnalignedValue<ctype>(arg_buf_ptr)); \
129 arg_buf_ptr += sizeof(ctype); \
141 case wasm::kRefNull: {
146 arg_buf_ptr += (arg_buf_ptr & 0x04);
153 ref = wasm_runtime->JSToWasmObject(ref, value_type);
154 if (isolate->has_exception()) {
162 ref = isolate->factory()->wasm_null();
180 isolate, frame_pointer, instance, func_index, wasm_args, wasm_rets);
184 DCHECK(isolate->has_exception());
190 arg_buf_ptr = arg_buffer;
192 for (
int i = 0;
i < num_returns; ++
i) {
193#define CASE_RET_TYPE(type, ctype) \
195 DCHECK_EQ(wasm::ValueTypes::ElementSizeInBytes(sig->GetReturn(i)), \
197 base::WriteUnalignedValue<ctype>(arg_buf_ptr, wasm_rets[i].to<ctype>()); \
198 arg_buf_ptr += sizeof(ctype); \
201 switch (
sig->GetReturn(
i).kind()) {
208 case wasm::kRefNull: {
216 arg_buf_ptr += (arg_buf_ptr & 0x04);
247 if (IsUndefined(*
handle, isolate)) {
253 size_t interpreter_size =
v8_flags.stack_size * KB * 2;
255 isolate, interpreter_size,
256 std::make_shared<InterpreterHandle>(isolate, interpreter_object));
275 int table_index,
int entry_index);
299 instance->GetIsolate())
303 instance->GetIsolate())),
317 start_function_index_(UINT_MAX),
318 trap_function_index_(-1),
320 current_thread_(nullptr),
321 fuzzer_start_time_(
base::TimeTicks::Now()),
322 memory_start_(nullptr),
324 generic_wasm_to_js_interpreter_wrapper_fn_(
326#ifdef V8_ENABLE_DRUMBRAKE_TRACING
328 shadow_stack_(
nullptr)
333 InitGlobalAddressCache();
334 InitMemoryAddresses();
335 InitIndirectFunctionTables();
338 Address wasm_to_js_code_addr_addr =
339 isolate->isolate_root() +
342 *
reinterpret_cast<Address*
>(wasm_to_js_code_addr_addr);
343 generic_wasm_to_js_interpreter_wrapper_fn_ =
345 wasm_to_js_code_addr);
350 for (
size_t index = 0; index <
module_->globals.size(); index++) {
362 Isolate* isolate = instance->GetIsolate();
364 WasmTrustedInstanceData::GetOrCreateInterpreterObject(instance);
368 handle->interpreter()->GetWasmRuntime();
375 uint32_t memory_index = 0;
384 int table_count =
static_cast<int>(
module_->tables.size());
386 for (
int table_index = 0; table_index < table_count; ++table_index) {
392 uint32_t table_index,
393 uint32_t entry_index,
401 uint32_t table_size = table->current_length();
402 if (entry_index >= table_size) {
403 SetTrap(TrapReason::kTrapTableOutOfBounds, current_code);
412 uint32_t table_index,
413 uint32_t entry_index,
421 uint32_t table_size = table->current_length();
422 if (entry_index >= table_size) {
423 SetTrap(TrapReason::kTrapTableOutOfBounds, current_code);
430 uint32_t table_index,
431 uint32_t element_segment_index,
432 uint32_t dst, uint32_t src,
445 std::optional<MessageTemplate> msg_template =
448 table_index, element_segment_index, dst, src, size);
450 if (msg_template == MessageTemplate::kWasmTrapTableOutOfBounds) {
451 SetTrap(TrapReason::kTrapTableOutOfBounds, current_code);
452 }
else if (msg_template ==
453 MessageTemplate::kWasmTrapElementSegmentOutOfBounds) {
454 SetTrap(TrapReason::kTrapElementSegmentOutOfBounds, current_code);
459 uint32_t dst_table_index,
460 uint32_t src_table_index, uint32_t dst,
461 uint32_t src, uint32_t size) {
476 SetTrap(TrapReason::kTrapTableOutOfBounds, current_code);
497 return table->current_length();
501 uint32_t table_index, uint32_t
count,
510 uint32_t table_size = table->current_length();
513 SetTrap(TrapReason::kTrapTableOutOfBounds, current_code);
525 uint32_t data_segment_index,
526 uint64_t dst, uint64_t src,
532 trusted_data->data_segment_sizes()->get(data_segment_index);
535 SetTrap(TrapReason::kTrapMemOutOfBounds, current_code);
540 trusted_data->data_segment_starts()->get(data_segment_index) + src;
541 std::memmove(
reinterpret_cast<void*
>(dst_addr),
542 reinterpret_cast<void*
>(src_addr), size);
547 uint64_t dst, uint64_t src,
553 SetTrap(TrapReason::kTrapMemOutOfBounds, current_code);
557 std::memmove(
reinterpret_cast<void*
>(dst_addr),
558 reinterpret_cast<void*
>(src_addr), size);
563 uint64_t dst, uint32_t value,
567 SetTrap(TrapReason::kTrapMemOutOfBounds, current_code);
571 std::memset(
reinterpret_cast<void*
>(dst_addr), value, size);
579 uint32_t first_param_slot_index, uint32_t first_param_ref_stack_index) {
587 uint32_t encoded_index = 0;
588 uint32_t* p =
sp + first_param_slot_index;
589 for (
size_t i = 0;
i <
sig->parameter_count(); ++
i) {
590#ifdef V8_ENABLE_DRUMBRAKE_TRACING
591 if (
v8_flags.trace_drumbrake_execution) {
592 TracePush(
sig->GetParam(
i).kind(),
static_cast<uint32_t
>(p -
sp));
597 switch (
sig->GetParam(
i).kind()) {
606 uint32_t f32_bits = 0;
608 float f32 = Float32::FromBits(f32_bits).get_scalar();
621 uint64_t f64_bits = 0;
623 float f64 = Float64::FromBits(f64_bits).get_scalar();
629 int32x4 s128 = {0, 0, 0, 0};
630 uint32_t* vals =
reinterpret_cast<uint32_t*
>(s128.val);
661void RedirectCodeToUnwindHandler(
const uint8_t*& code) {
668DirectHandle<WasmExceptionPackage>
679 return exception_object;
697 RedirectCodeToUnwindHandler(code);
706 uint32_t catch_block_index) {
709 DCHECK(!IsTheHole(*exception_object));
717 const uint8_t*& current_code) {
732 DCHECK(AllowHeapAllocation::IsAllowed());
734 size_t current_code_offset =
737 current_frame_.current_function_->GetTryBlock(current_code_offset);
740 if (catch_handler.tag_index < 0) {
743 catch_handler.code_offset;
745 isolate_, catch_handler.catch_block_index, exception);
748 }
else if (IsWasmExceptionPackage(*exception,
isolate_)) {
755 trusted_data->tags_table()->get(catch_handler.tag_index),
757 DCHECK(IsWasmExceptionTag(*expected_tag));
763 catch_handler.code_offset;
766 auto exception_payload_slot_offsets =
768 ->GetExceptionPayloadStartSlotOffsets(
769 catch_handler.catch_block_index);
772 exception_payload_slot_offsets.first_param_slot_offset,
773 exception_payload_slot_offsets.first_param_ref_stack_index);
775 isolate_, catch_handler.catch_block_index, exception);
788 if (
sig->return_count() != 0 ||
sig->parameter_count() != 1 ||
790 sig->GetParam(0).kind() !=
kRef)) {
800 trusted_data->tags_table()->get(catch_handler.tag_index),
807 catch_handler.code_offset;
809 auto exception_payload_slot_offsets =
811 ->GetExceptionPayloadStartSlotOffsets(
812 catch_handler.catch_block_index);
814 exception_payload_slot_offsets.first_param_ref_stack_index,
818 sp + exception_payload_slot_offsets.first_param_slot_offset),
822 isolate_, catch_handler.catch_block_index, exception);
838 return !
module_->memories.empty() &&
module_->memories[0].is_shared &&
844 if (
module_->memories.empty() || !
module_->memories[0].is_shared) {
849 uint32_t memory_index = 0;
851 ->memory_object(memory_index)
860 int32_t val, int64_t timeout) {
868 uint32_t memory_index = 0;
873 buffer_offset, val, timeout);
874 return result.ToSmi().value();
878 int64_t val, int64_t timeout) {
886 uint32_t memory_index = 0;
891 buffer_offset, val, timeout);
892 return result.ToSmi().value();
897 uint8_t* interpreter_fp, uint32_t ref_stack_offset,
898 const std::vector<WasmValue>* argument_values) {
902 thread->StartActivation(
this, frame_pointer, interpreter_fp,
current_frame_);
910#ifdef V8_ENABLE_DRUMBRAKE_TRACING
911 current_frame_.current_stack_start_args_ = thread->CurrentStackFrameStart();
915 size_t args_count = 0;
916 uint32_t rets_slots_size = 0;
917 uint32_t ref_rets_count = 0;
918 uint32_t ref_args_count = 0;
920 if (target_function) {
927 args_count =
sig->parameter_count();
939 if (ref_args_count > 0) {
940 ref_args.
reserve(ref_args_count);
943 uint8_t* p = interpreter_fp + rets_slots_size *
kSlotSize;
946 const uint8_t* stack_limit = thread->StackLimitAddress();
949 size_t additional_required_size =
950 p + (ref_rets_count + ref_args_count) *
sizeof(
WasmRef) - stack_limit;
951 if (!thread->ExpandStack(additional_required_size)) {
956 const pc_t trap_pc = 0;
957 SetTrap(TrapReason::kTrapUnreachable, trap_pc);
958 thread->FinishActivation();
963 if (argument_values) {
966 for (
size_t i = 0;
i < argument_values->size();
i++) {
967 const WasmValue& value = (*argument_values)[
i];
968 switch (value.type().kind()) {
971 value.to<int32_t>());
972 p +=
sizeof(int32_t);
976 value.to<int64_t>());
977 p +=
sizeof(int64_t);
1003 for (
size_t i = 0;
i < args_count;
i++) {
1004 switch (
sig->GetParam(
i).kind()) {
1006 p +=
sizeof(int32_t);
1009 p +=
sizeof(int64_t);
1015 p +=
sizeof(double);
1024 reinterpret_cast<Address>(p));
1040 if (ref_rets_count + ref_args_count > 0) {
1047 uint32_t ref_stack_arg_index = ref_rets_count;
1048 for (uint32_t ref_arg_index = 0; ref_arg_index < ref_args_count;
1050 StoreWasmRef(ref_stack_arg_index++, ref_args[ref_arg_index]);
1057 bool called_from_js) {
1063 const uint8_t* code =
nullptr;
1066 uint32_t return_count = 0;
1068 if (target_function) {
1080 return_count =
static_cast<uint32_t
>(
sig->return_count());
1082 static_cast<uint32_t
>(
sig->parameter_count()), 0, 0,
1089 uint32_t ref_result_slot_index = 0;
1092 if (return_count > 0) {
1093 uint32_t* dst =
reinterpret_cast<uint32_t*
>(
current_frame_.current_sp_);
1095 if (called_from_js) {
1100 for (
size_t index = 0; index < return_count; index++) {
1103 switch (ret_value_type.
kind()) {
1107 reinterpret_cast<Address>(dst)));
1113 reinterpret_cast<Address>(dst)));
1119 reinterpret_cast<Address>(dst)));
1125 reinterpret_cast<Address>(dst)));
1144 for (
size_t index = 0; index < return_count; index++) {
1145 switch (
sig->GetReturn(index).kind()) {
1179 if (ref_result_slot_index > 0) {
1181 ref_result_slot_index);
1191 thread->RaiseException(
isolate_, message_id);
1199 thread->FinishActivation();
1200 const FrameState* frame_state = thread->GetCurrentActivationFor(
this);
1206 uint32_t index = ref_stack_index +
current_frame_.ref_array_current_sp_;
1216 static_cast<int>(ref_stack_index) +
current_frame_.ref_array_current_sp_;
1226 uint32_t*
sp, uint32_t slot_offset, uint32_t rets_size, uint32_t args_size,
1227 uint32_t rets_refs, uint32_t args_refs, uint32_t ref_stack_fp_offset) {
1265 uint8_t* next_sp =
reinterpret_cast<uint8_t*
>(
sp);
1266 uint8_t* prev_sp = next_sp + slot_offset;
1270 ::memmove(next_sp + rets_size, prev_sp, args_size);
1281 for (uint32_t
i = 0;
i < args_refs;
i++) {
1284 if (ref_stack_fp_offset > rets_refs + args_refs) {
1287 ref_stack_fp_offset - rets_refs - args_refs);
1302 size_t args_count =
sig->parameter_count();
1304 for (
size_t i = 0;
i < args_count;
i++) {
1305 switch (
sig->GetParam(
i).kind()) {
1308 sp +=
sizeof(int32_t);
1312 sp +=
sizeof(int64_t);
1332 size_t rets_count =
sig->return_count();
1333 for (
size_t i = 0;
i < rets_count;
i++) {
1334 switch (
sig->GetReturn(
i).kind()) {
1337 sp +=
sizeof(int32_t);
1341 sp +=
sizeof(int64_t);
1361 const uint8_t*& code, uint32_t func_index, uint32_t current_stack_size,
1362 uint32_t ref_stack_fp_offset, uint32_t slot_offset,
1363 uint32_t return_slot_offset,
bool is_tail_call) {
1371 thread->SetCurrentActivationFrame(
1372 reinterpret_cast<uint32_t*
>(
current_frame_.current_sp_ + slot_offset),
1373 slot_offset, current_stack_size,
1375 ref_stack_fp_offset);
1379 reinterpret_cast<uint32_t*
>(
current_frame_.current_sp_ + slot_offset),
1380 current_stack_size, ref_stack_fp_offset, slot_offset);
1386 if (exception_handling_result ==
1400 RedirectCodeToUnwindHandler(code);
1405 RedirectCodeToUnwindHandler(code);
1411 int64_t
r0,
double fp0) {
1419 uint32_t ref_stack_index =
1439 uint32_t func_index,
1440 uint32_t current_stack_size,
1441 uint32_t return_slot_offset) {
1452#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1459 if (
v8_flags.trace_drumbrake_execution) {
1460 Trace(
"\nTailCallFunction: %d\n", func_index);
1470 const uint8_t* stack_limit =
current_frame_.thread_->StackLimitAddress();
1476 size_t additional_required_space =
1480 if (!
current_frame_.thread_->ExpandStack(additional_required_space) ||
1487 SetTrap(TrapReason::kTrapUnreachable, code);
1495 uint32_t ref_array_length =
1501#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1502 uint32_t shadow_stack_offset = 0;
1503 if (
v8_flags.trace_drumbrake_execution) {
1505 for (uint32_t
i = 0;
i < target_function->
args_count();
i++) {
1506 shadow_stack_offset +=
1507 TracePush(target_function->
arg_type(
i).
kind(), shadow_stack_offset);
1513 shadow_stack_offset +=
1514 TracePush(target_function->
local_type(
i).
kind(), shadow_stack_offset);
1519 code = target_function->
GetCode();
1523 uint32_t func_index,
1524 uint32_t current_stack_size,
1525 uint32_t ref_stack_fp_offset,
1526 uint32_t slot_offset,
1527 uint32_t return_slot_offset) {
1532#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1533 ShadowStack* prev_shadow_stack = shadow_stack_;
1534 ShadowStack shadow_stack;
1535 if (
v8_flags.trace_drumbrake_execution) {
1536 shadow_stack_ = &shadow_stack;
1552#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1554 (current_stack_size - target_function->
args_count());
1561#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1569 if (
v8_flags.trace_drumbrake_execution) {
1570 Trace(
"\nCallFunction: %d\n", func_index);
1580 const uint8_t* stack_limit =
current_frame_.thread_->StackLimitAddress();
1586 size_t additional_required_space =
1590 if (!
current_frame_.thread_->ExpandStack(additional_required_space) ||
1597 SetTrap(TrapReason::kTrapUnreachable, code);
1606 uint32_t ref_array_length =
1612#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1613 uint32_t shadow_stack_offset = 0;
1614 if (
v8_flags.trace_drumbrake_execution) {
1616 for (uint32_t
i = 0;
i < target_function->
args_count();
i++) {
1617 shadow_stack_offset +=
1618 TracePush(target_function->
arg_type(
i).
kind(), shadow_stack_offset);
1624 shadow_stack_offset +=
1625 TracePush(target_function->
local_type(
i).
kind(), shadow_stack_offset);
1630 const uint8_t* callee_code = target_function->
GetCode();
1636 callee_code,
reinterpret_cast<uint32_t*
>(
current_frame_.current_sp_),
1639 uint32_t ref_slots_to_clear =
1644 ref_slots_to_clear);
1647#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1648 shadow_stack_ = prev_shadow_stack;
1650 if (
v8_flags.trace_drumbrake_execution && shadow_stack_ !=
nullptr &&
1651 prev_frame_state.current_function_) {
1652 for (
size_t i = 0;
i < target_function->
args_count();
i++) {
1657 return_slot_offset +=
1670 switch (current_state) {
1676 RedirectCodeToUnwindHandler(code);
1684 RedirectCodeToUnwindHandler(code);
1690 RedirectCodeToUnwindHandler(code);
1718 uint32_t table_index, uint32_t entry_index) {
1720 WasmTrustedInstanceData::GetOrCreateInterpreterObject(instance);
1724 handle->interpreter()->GetWasmRuntime();
1727 wasm_runtime->indirect_call_tables_[table_index].size());
1728 wasm_runtime->indirect_call_tables_[table_index][entry_index] = {};
1734 uint32_t table_index) {
1736 WasmTrustedInstanceData::GetOrCreateInterpreterObject(instance);
1740 handle->interpreter()->GetWasmRuntime();
1745 uint32_t table_index, uint32_t entry_index, uint32_t sig_index)
const {
1747 bool needs_type_check =
1752 bool needs_null_check = table.type.is_nullable();
1758 if (needs_type_check || needs_null_check) {
1762 dispatch_table[entry_index].sig_index;
1765 if (!needs_type_check) {
1767 if (!real_sig_id.
valid())
return false;
1768 }
else if (!
module_->types[sig_index].is_final) {
1769 if (real_sig_id == canonical_sig_id)
return true;
1770 if (needs_null_check && !real_sig_id.
valid())
return false;
1773 ->wasm_canonical_rtts()
1774 ->get(real_sig_id.
index)
1775 .GetHeapObjectAssumeWeak());
1779 if (real_sig_id != canonical_sig_id)
return false;
1787 const uint8_t*& current_code, uint32_t table_index, uint32_t sig_index,
1788 uint32_t entry_index, uint32_t stack_pos, uint32_t*
sp,
1789 uint32_t ref_stack_fp_offset, uint32_t slot_offset,
1790 uint32_t return_slot_offset,
bool is_tail_call) {
1801 if (entry_index >= table.size()) {
1802 SetTrap(TrapReason::kTrapTableOutOfBounds, current_code);
1806 if (!table[entry_index]) {
1814 if (IsWasmTrustedInstanceData(*object_implicit_arg)) {
1835 SetTrap(TrapReason::kTrapFuncSigMismatch, current_code);
1845 return_slot_offset);
1848 ref_stack_fp_offset, slot_offset, return_slot_offset);
1852 RedirectCodeToUnwindHandler(current_code);
1866 thread->SetCurrentActivationFrame(
1867 sp, slot_offset, stack_pos,
1869 ref_stack_fp_offset);
1876 if (IsWasmTrustedInstanceData(*object_implicit_arg)) {
1892 WasmTrustedInstanceData::GetOrCreateInterpreterObject(
1903 uint8_t* fp =
reinterpret_cast<uint8_t*
>(
sp) + slot_offset;
1913#ifdef V8_ENABLE_DRUMBRAKE_TRACING
1915 if (
v8_flags.trace_drumbrake_execution && shadow_stack_ !=
nullptr) {
1916 for (
size_t i = 0;
i < indirect_call.
signature->parameter_count();
1921 for (
size_t i = 0;
i < indirect_call.
signature->return_count();
1923 return_slot_offset +=
1924 TracePush(indirect_call.
signature->GetReturn(
i).kind(),
1925 return_slot_offset);
1931 RedirectCodeToUnwindHandler(current_code);
1941 uint8_t* fp =
reinterpret_cast<uint8_t*
>(
sp) + slot_offset;
1957 RedirectCodeToUnwindHandler(current_code);
1967 RedirectCodeToUnwindHandler(current_code);
1973 const uint8_t*& current_code,
WasmRef func_ref, uint32_t sig_index,
1974 uint32_t stack_pos, uint32_t*
sp, uint32_t ref_stack_fp_offset,
1975 uint32_t slot_offset, uint32_t return_slot_offset,
bool is_tail_call) {
1976 if (IsWasmFuncRef(*func_ref)) {
1980 if (IsWasmInternalFunction(*func_ref)) {
1983 Tagged<Object> implicit_arg = wasm_internal_function->implicit_arg();
1984 if (IsWasmImportData(implicit_arg)) {
1987 DCHECK(IsWasmTrustedInstanceData(implicit_arg));
1990 DCHECK(IsJSFunction(*func_ref) || IsUndefined(*func_ref));
2004 thread->SetCurrentActivationFrame(
2005 sp, slot_offset, stack_pos,
2007 ref_stack_fp_offset);
2015 uint8_t* fp =
reinterpret_cast<uint8_t*
>(
sp) + slot_offset;
2019 sp + slot_offset /
kSlotSize, return_slot_offset);
2029 RedirectCodeToUnwindHandler(current_code);
2036 RedirectCodeToUnwindHandler(current_code);
2041 const uint8_t*& current_code, uint32_t function_index, uint32_t*
sp,
2042 uint32_t current_stack_size, uint32_t ref_stack_fp_offset,
2043 uint32_t current_slot_offset) {
2050 int target_function_index = entry.function_index_in_called_module();
2051 if (target_function_index >= 0) {
2057 ->instance_object()),
2063 WasmTrustedInstanceData::GetOrCreateInterpreterObject(target_instance);
2073 uint8_t* fp =
reinterpret_cast<uint8_t*
>(
sp);
2085 isolate_, frame_pointer, target_instance, target_function_index, fp);
2089#ifdef V8_ENABLE_DRUMBRAKE_TRACING
2091 if (
v8_flags.trace_drumbrake_execution && shadow_stack_ !=
nullptr) {
2092 for (
size_t i = 0;
i <
sig->parameter_count();
i++) {
2096 for (
size_t i = 0;
i <
sig->return_count();
i++) {
2097 current_slot_offset +=
2098 TracePush(
sig->GetReturn(
i).kind(), current_slot_offset);
2118 uint8_t* fp =
reinterpret_cast<uint8_t*
>(
sp);
2122 sp, current_slot_offset);
2150 if (IsWasmImportData(*object_ref)) {
2154 callable = object_ref;
2155 DCHECK(!IsUndefined(*callable));
2160 while (IsJSBoundFunction(*js_function,
isolate_)) {
2161 if (IsJSBoundFunction(*js_function,
isolate_)) {
2167 if (IsJSProxy(*js_function,
isolate_)) {
2171 }
while (IsJSProxy(*js_function,
isolate_));
2174 if (!IsJSFunction(*js_function,
isolate_)) {
2179 MessageTemplate::kWasmTrapJSTypeError));
2188 Address saved_c_entry_fp = *isolate->c_entry_fp_address();
2189 Address saved_js_entry_sp = *isolate->js_entry_sp_address();
2194 stack_handler.
next = isolate->thread_local_top()->handler_;
2195#ifdef V8_USE_ADDRESS_SANITIZER
2202 isolate->thread_local_top()->handler_ =
2203 saved_c_entry_fp ?
reinterpret_cast<Address>(&stack_handler)
2210 RCS_SCOPE(isolate, RuntimeCallCounterId::kJS_Execution);
2212 (*js_function).ptr(), packed_args, isolate->isolate_root(),
sig,
2213 saved_c_entry_fp, (*callable).ptr());
2214 if (
result != WasmToJSInterpreterFrameConstants::kSuccess) {
2227 isolate->thread_local_top()->handler_ = stack_handler.
next;
2229 *isolate->js_entry_sp_address() = saved_js_entry_sp;
2231 *isolate->c_entry_fp_address() = saved_c_entry_fp;
2235 const uint8_t*& current_code,
const WasmModule* module,
2237 uint32_t return_slot_offset) {
2245 MessageTemplate::kWasmTrapJSTypeError));
2249#ifdef V8_ENABLE_DRUMBRAKE_TRACING
2250 if (
v8_flags.trace_drumbrake_execution) {
2251 Trace(
" => Calling external function\n");
2258 for (
size_t i = 0;
i <
sig->parameter_count(); ++
i) {
2259 switch (
sig->GetParam(
i).kind()) {
2306#ifdef V8_ENABLE_DRUMBRAKE_TRACING
2307 if (
v8_flags.trace_drumbrake_execution) {
2308 Trace(
" => External wasm function returned%s\n",
2318 if (
sig->return_count() > 0) {
2320 for (
size_t i = 0;
i <
sig->return_count();
i++) {
2321 switch (
sig->GetReturn(
i).kind()) {
2324 packer.
Pop<uint32_t>());
2329 packer.
Pop<uint64_t>());
2334 packer.
Pop<
float>());
2339 packer.
Pop<
double>());
2345#ifdef V8_COMPRESS_POINTERS
2372#ifdef V8_ENABLE_DRUMBRAKE_TRACING
2373 if (
v8_flags.trace_drumbrake_execution && shadow_stack_ !=
nullptr) {
2374 for (
size_t i = 0;
i <
sig->parameter_count();
i++) {
2378 for (
size_t i = 0;
i <
sig->return_count();
i++) {
2379 return_slot_offset +=
2380 TracePush(
sig->GetReturn(
i).kind(), return_slot_offset);
2396std::pair<DirectHandle<WasmStruct>,
const StructType*>
2400 return {
isolate_->
factory()->NewWasmStructUninitialized(struct_type, rtt),
2404std::pair<DirectHandle<WasmArray>,
const ArrayType*>
2406 uint32_t array_index)
const {
2409 static_cast<int>(length) >
2421 uint32_t segment_index,
2435 constexpr size_t kArgsLength = 5;
2446 Runtime_WasmArrayNewSegment(kArgsLength, first_arg_addr,
isolate_);
2454 uint32_t array_offset,
2468 constexpr size_t kArgsLength = 6;
2471 IntToSmi(array_offset), (*wasm_array).ptr(),
2479 Runtime_WasmArrayInitSegment(kArgsLength, first_arg_addr,
isolate_);
2484 uint32_t dest_index,
2498 constexpr size_t kArgsLength = 5;
2500 (*src_wasm_array).ptr(),
IntToSmi(dest_index),
2501 (*dest_wasm_array).ptr()};
2508 Runtime_WasmArrayCopy(kArgsLength, first_arg_addr,
isolate_);
2521 constexpr size_t kArgsLength = 2;
2531 Runtime_WasmJSToWasmObject(kArgsLength, first_arg_addr,
isolate_);
2540 const char* error_message;
2554 MessageTemplate::kWasmTrapJSTypeError));
2560 if (IsWasmFuncRef(*value)) {
2564 if (IsWasmInternalFunction(*value)) {
2569 if (IsWasmNull(*value)) {
2579 uint32_t type_index)
const {
2586 uint32_t rtt_depth =
2589 static_cast<uint32_t
>(type_info->supertypes_length()) <= rtt_depth) {
2595 if (formal_rtt != supertype)
return false;
2629 if (*obj_map != *rtt) {
2635 if (*obj_map == *rtt) {
2639 if (is_cast_from_any) {
2642 if (obj_type1 < FIRST_WASM_OBJECT_TYPE ||
2643 obj_type1 > LAST_WASM_OBJECT_TYPE) {
2656template <TypeChecker type_checker>
2663 return type_checker(obj);
2672 return instance_type >= FIRST_WASM_OBJECT_TYPE &&
2673 instance_type <= LAST_WASM_OBJECT_TYPE;
2694 return instance_type == WASM_STRUCT_TYPE;
2708 return instance_type == WASM_ARRAY_TYPE;
2744 const uint8_t*& code) {
2749 RedirectCodeToUnwindHandler(code);
2756std::vector<WasmInterpreterStackEntry>
2801 int64_t
r0,
double fp0) {
2802#ifdef V8_ENABLE_DRUMBRAKE_TRACING
2803 if (tracer_ && tracer_->ShouldTraceFunction(
2813#ifdef V8_ENABLE_DRUMBRAKE_TRACING
2814InterpreterTracer* WasmInterpreterRuntime::GetTracer() {
2815 if (tracer_ ==
nullptr) tracer_.reset(
new InterpreterTracer(-1));
2816 return tracer_.get();
2819void WasmInterpreterRuntime::Trace(
const char* format, ...) {
2824 InterpreterTracer* tracer = GetTracer();
2825 if (tracer->ShouldTraceFunction(
2828 va_start(arguments, format);
2829 base::OS::VFPrint(tracer->file(), format, arguments);
2831 tracer->CheckFileSize();
2840 NativeModule* native_module = wasm_instance->module_object()->native_module();
2850 interpreter_(isolate,
module_, GetBytes(*interpreter_object),
2852 *interpreter_object),
2861 bool finished =
false;
2903 const std::vector<WasmValue>& argument_values,
2904 std::vector<WasmValue>& return_values) {
2907 DCHECK_EQ(
sig->parameter_count(), argument_values.size());
2910 thread->StartExecutionTimer();
2912 thread->NextFrameAddress(),
2913 thread->NextRefStackOffset(), argument_values);
2916 thread->StopExecutionTimer();
2921 for (
unsigned i = 0;
i <
sig->return_count(); ++
i) {
2927 for (
unsigned i = 0;
i <
sig->return_count(); ++
i) {
2941 Address frame_pointer, uint32_t func_index,
2942 uint8_t* interpreter_fp) {
2954 WasmInterpreterEntryFrame* frame =
2955 WasmInterpreterEntryFrame::cast(it.frame());
2963 instance_obj->trusted_data(
isolate_)->interpreter_object()))
2965 return instance_obj;
void push_back(const DirectHandle< T > &x)
V8_INLINE bool is_null() const
V8_INLINE bool is_identical_to(Handle< S > other) const
static V8_EXPORT_PRIVATE Tagged< Object > WaitWasm64(Isolate *isolate, DirectHandle< JSArrayBuffer > array_buffer, size_t addr, int64_t value, int64_t rel_timeout_ns)
static V8_EXPORT_PRIVATE Tagged< Object > WaitWasm32(Isolate *isolate, DirectHandle< JSArrayBuffer > array_buffer, size_t addr, int32_t value, int64_t rel_timeout_ns)
static V8_EXPORT_PRIVATE int Wake(Tagged< JSArrayBuffer > array_buffer, size_t addr, uint32_t num_waiters_to_wake)
static GeneratedCode FromAddress(Isolate *isolate, Address addr)
DISABLE_CFI_ICALL Return Call(Args... args)
Tagged< Object > implicit_arg()
static constexpr int BuiltinEntrySlotOffset(Builtin id)
Tagged< Object > Throw(Tagged< Object > exception, MessageLocation *location=nullptr)
Tagged< Object > exception()
Handle< NativeContext > native_context()
bool is_catchable_by_wasm(Tagged< Object > exception)
v8::internal::Factory * factory()
Tagged< Object > StackOverflow()
bool allow_atomics_wait()
static DirectHandle< Managed< CppType > > From(Isolate *isolate, size_t estimated_size, std::shared_ptr< CppType > shared_ptr, AllocationType allocation_type=AllocationType::kYoung)
T GetReturn(size_t index=0) const
static constexpr int MaxLength(uint32_t element_size_bytes)
static DirectHandle< WasmExceptionPackage > New(Isolate *isolate, DirectHandle< WasmExceptionTag > exception_tag, int encoded_size)
static DirectHandle< Object > GetExceptionValues(Isolate *isolate, DirectHandle< WasmExceptionPackage > exception_package)
static uint32_t GetEncodedSize(const wasm::WasmTagSig *tag)
static DirectHandle< Object > GetExceptionTag(Isolate *isolate, DirectHandle< WasmExceptionPackage > exception_package)
static V8_EXPORT_PRIVATE DirectHandle< JSFunction > GetOrCreateExternal(DirectHandle< WasmInternalFunction > internal)
static Tagged< Object > get_interpreter_handle(Tagged< Tuple2 > interpreter_object)
static void set_interpreter_handle(Tagged< Tuple2 > interpreter_object, Tagged< Object > interpreter_handle)
static Tagged< WasmInstanceObject > get_wasm_instance(Tagged< Tuple2 > interpreter_object)
static bool RunInterpreter(Isolate *isolate, Address frame_pointer, DirectHandle< WasmInstanceObject > instance, int func_index, const std::vector< wasm::WasmValue > &argument_values, std::vector< wasm::WasmValue > &return_values)
static V8_EXPORT_PRIVATE int32_t Grow(Isolate *, DirectHandle< WasmMemoryObject >, uint32_t pages)
static V8_EXPORT_PRIVATE DirectHandle< Object > Get(Isolate *isolate, DirectHandle< WasmTableObject > table, uint32_t index)
static V8_EXPORT_PRIVATE void Fill(Isolate *isolate, DirectHandle< WasmTableObject > table, uint32_t start, DirectHandle< Object > entry, uint32_t count)
static V8_EXPORT_PRIVATE void Set(Isolate *isolate, DirectHandle< WasmTableObject > table, uint32_t index, DirectHandle< Object > entry)
static V8_EXPORT_PRIVATE int Grow(Isolate *isolate, DirectHandle< WasmTableObject > table, uint32_t count, DirectHandle< Object > init_value)
static std::optional< MessageTemplate > InitTableEntries(Isolate *isolate, DirectHandle< WasmTrustedInstanceData > trusted_instance_data, DirectHandle< WasmTrustedInstanceData > shared_trusted_instance_data, uint32_t table_index, uint32_t segment_index, uint32_t dst, uint32_t src, uint32_t count) V8_WARN_UNUSED_RESULT
static bool CopyTableEntries(Isolate *isolate, DirectHandle< WasmTrustedInstanceData > trusted_instance_data, uint32_t table_dst_index, uint32_t table_src_index, uint32_t dst, uint32_t src, uint32_t count) V8_WARN_UNUSED_RESULT
static int TotalSize(const CanonicalSig *sig)
wasm::CanonicalTypeIndex sig_id() const
uint32_t function_index() const
WasmCodePointer target() const
Tagged< Object > implicit_arg() const
DirectHandle< WasmDispatchTable > const table_
IndirectFunctionTableEntry(DirectHandle< WasmInstanceObject >, int table_index, int entry_index)
static ModuleWireBytes GetBytes(Tagged< Tuple2 > interpreter_object)
int GetFunctionIndex(Address frame_pointer, int index) const
WasmInterpreter interpreter_
const WasmModule * module() const
void SetTrapFunctionIndex(int32_t func_index)
WasmInterpreterThread::State RunExecutionLoop(WasmInterpreterThread *thread, bool called_from_js)
std::vector< WasmInterpreterStackEntry > GetInterpretedStack(Address frame_pointer)
bool Execute(WasmInterpreterThread *thread, Address frame_pointer, uint32_t func_index, const std::vector< WasmValue > &argument_values, std::vector< WasmValue > &return_values)
WasmInterpreterThread::State ContinueExecution(WasmInterpreterThread *thread, bool called_from_js)
InterpreterHandle(Isolate *isolate, DirectHandle< Tuple2 > interpreter_object)
DirectHandle< WasmInstanceObject > GetInstanceObject()
WasmInterpreter * interpreter()
base::Vector< const uint8_t > wire_bytes() const
V8_EXPORT_PRIVATE const CanonicalSig * LookupFunctionSignature(CanonicalTypeIndex index) const
constexpr ValueKind kind() const
constexpr bool is_reference() const
constexpr bool is_nullable() const
constexpr uint32_t raw_bit_field() const
static constexpr ValueType Ref(ModuleTypeIndex index, bool shared, RefTypeKind kind)
static int ElementSizeInBytes(ValueType type)
uint32_t return_count() const
uint32_t args_count() const
ValueType return_type(size_t index) const
const FunctionSig * GetFunctionSignature() const
bool InitializeSlots(uint8_t *sp, size_t stack_space) const
uint32_t locals_count() const
uint32_t ref_slots_count() const
static uint32_t RetsSizeInSlots(const FunctionSig *sig)
ValueType local_type(size_t index) const
uint32_t ref_rets_count() const
static bool ContainsSimd(const FunctionSig *sig)
ValueType arg_type(size_t index) const
uint32_t rets_slots_size() const
uint32_t ref_args_count() const
uint32_t const_slots_size_in_bytes() const
const CanonicalSig * GetCanonicalFunctionSignature() const
const uint8_t * GetCode() const
uint32_t ref_locals_count() const
static uint32_t RefArgsCount(const FunctionSig *sig)
static uint32_t RefRetsCount(const FunctionSig *sig)
std::vector< IndirectCallValue > IndirectCallTable
void SetTrap(TrapReason trap_reason, pc_t trap_pc)
std::vector< WasmInterpreterStackEntry > GetInterpretedStack(Address frame_pointer)
void TableCopy(const uint8_t *¤t_code, uint32_t dst_table_index, uint32_t src_table_index, uint32_t dst, uint32_t src, uint32_t size)
void PrepareTailCall(const uint8_t *&code, uint32_t func_index, uint32_t current_stack_size, uint32_t return_slot_offset)
DirectHandle< WasmTrustedInstanceData > wasm_trusted_instance_data() const
bool WasmArrayCopy(WasmRef dest_wasm_array, uint32_t dest_index, WasmRef src_wasm_array, uint32_t src_index, uint32_t length)
void BeginExecution(WasmInterpreterThread *thread, uint32_t function_index, Address frame_pointer, uint8_t *interpreter_fp, uint32_t ref_stack_offset, const std::vector< WasmValue > *argument_values=nullptr)
static void ClearIndirectCallCacheEntry(Isolate *isolate, DirectHandle< WasmInstanceObject > instance, uint32_t table_index, uint32_t entry_index)
void StoreRefArgsIntoStackSlots(uint8_t *sp, uint32_t ref_stack_fp_offset, const FunctionSig *sig)
int32_t MemoryGrow(uint32_t delta_pages)
void UnwindCurrentStackFrame(uint32_t *sp, uint32_t slot_offset, uint32_t rets_size, uint32_t args_size, uint32_t rets_refs, uint32_t args_refs, uint32_t ref_stack_fp_offset)
void RethrowException(const uint8_t *&code, uint32_t *sp, uint32_t catch_block_index)
bool MemoryInit(const uint8_t *¤t_code, uint32_t data_segment_index, uint64_t dst, uint64_t src, uint64_t size)
WasmInterpreterThread * thread() const
std::pair< DirectHandle< WasmArray >, const ArrayType * > ArrayNewUninitialized(uint32_t length, uint32_t array_index) const
void TableSet(const uint8_t *¤t_code, uint32_t table_index, uint32_t entry_index, DirectHandle< Object > ref)
void ExecuteFunction(const uint8_t *&code, uint32_t function_index, uint32_t current_stack_size, uint32_t ref_stack_fp_offset, uint32_t slot_offset, uint32_t return_slot_offset)
WasmRef JSToWasmObject(WasmRef extern_ref, ValueType value_type) const
std::vector< uint8_t * > global_addresses_
bool RefIsArray(const WasmRef obj, const ValueType obj_type, bool null_succeeds) const
bool RefIsString(const WasmRef obj, const ValueType obj_type, bool null_succeeds) const
uint32_t TableGrow(uint32_t table_index, uint32_t delta, DirectHandle< Object > value)
static void UpdateIndirectCallTable(Isolate *isolate, DirectHandle< WasmInstanceObject > instance, uint32_t table_index)
IndirectHandle< WasmInstanceObject > instance_object_
ExternalCallResult CallExternalJSFunction(const uint8_t *¤t_code, const WasmModule *module, DirectHandle< Object > object_ref, const FunctionSig *sig, uint32_t *sp, uint32_t return_slot_offset)
WasmBytecode * GetFunctionBytecode(uint32_t func_index)
void ThrowException(const uint8_t *&code, uint32_t *sp, Tagged< Object > exception_object)
void ExecuteImportedFunction(const uint8_t *&code, uint32_t func_index, uint32_t current_stack_size, uint32_t ref_stack_fp_offset, uint32_t slot_offset, uint32_t return_slot_offset, bool is_tail_call=false)
std::vector< IndirectCallTable > indirect_call_tables_
void StoreWasmRef(uint32_t ref_stack_index, const WasmRef &ref)
void PurgeIndirectCallCache(uint32_t table_index)
Isolate * GetIsolate() const
const WasmModule * module_
static void UpdateMemoryAddress(DirectHandle< WasmInstanceObject > instance)
static bool IsNull(Isolate *isolate, const WasmRef obj, const ValueType obj_type)
ExternalCallResult CallImportedFunction(const uint8_t *¤t_code, uint32_t function_index, uint32_t *sp, uint32_t current_stack_size, uint32_t ref_stack_fp_index, uint32_t current_slot_offset)
WasmInterpreterThread * current_thread_
bool MemoryCopy(const uint8_t *¤t_code, uint64_t dst, uint64_t src, uint64_t size)
bool SubtypeCheck(const WasmRef obj, const ValueType obj_type, const DirectHandle< Map > rtt, const ModuleTypeIndex target_type, bool null_succeeds) const
GeneratedCode< WasmToJSCallSig > generic_wasm_to_js_interpreter_wrapper_fn_
void InitializeRefLocalsRefs(const WasmBytecode *target_function)
bool CheckIndirectCallSignature(uint32_t table_index, uint32_t entry_index, uint32_t sig_index) const
void InitMemoryAddresses()
WasmRef WasmArrayNewSegment(uint32_t array_index, uint32_t segment_index, uint32_t offset, uint32_t length)
bool RefIsI31(const WasmRef obj, const ValueType obj_type, bool null_succeeds) const
DirectHandle< Map > RttCanon(uint32_t type_index) const
WasmInterpreterThread::ExceptionHandlingResult HandleException(uint32_t *sp, const uint8_t *¤t_code)
int GetFunctionIndex(Address frame_pointer, int index) const
bool RefIsStruct(const WasmRef obj, const ValueType obj_type, bool null_succeeds) const
WasmInterpreterRuntime(const WasmModule *module, Isolate *isolate, IndirectHandle< WasmInstanceObject > instance_object, WasmInterpreter::CodeMap *codemap)
void PrintStack(uint32_t *sp, RegMode reg_mode, int64_t r0, double fp0)
const ArrayType * GetArrayType(uint32_t array_index) const
void ExecuteCallRef(const uint8_t *¤t_code, WasmRef func_ref, uint32_t sig_index, uint32_t stack_pos, uint32_t *sp, uint32_t ref_stack_fp_offset, uint32_t slot_offset, uint32_t return_slot_offset, bool is_tail_call)
bool RefIsEq(const WasmRef obj, const ValueType obj_type, bool null_succeeds) const
int32_t AtomicNotify(uint64_t effective_index, int32_t val)
bool TableGet(const uint8_t *¤t_code, uint32_t table_index, uint32_t entry_index, DirectHandle< Object > *result)
PWasmOp *const * instruction_table_
void InitGlobalAddressCache()
bool WasmStackCheck(const uint8_t *current_bytecode, const uint8_t *&code)
void InitIndirectFunctionTables()
WasmInterpreterThread::State state() const
FrameState current_frame_
void TableFill(const uint8_t *¤t_code, uint32_t table_index, uint32_t count, DirectHandle< Object > value, uint32_t start)
bool BoundsCheckMemRange(uint64_t index, uint64_t *size, Address *out_address) const
std::pair< DirectHandle< WasmStruct >, const StructType * > StructNewUninitialized(uint32_t index) const
void StoreRefResultsIntoRefStack(uint8_t *sp, uint32_t ref_stack_fp_offset, const FunctionSig *sig)
int32_t I32AtomicWait(uint64_t effective_index, int32_t val, int64_t timeout)
WasmRef ExtractWasmRef(uint32_t ref_stack_index)
void ExecuteIndirectCall(const uint8_t *¤t_code, uint32_t table_index, uint32_t sig_index, uint32_t entry_index, uint32_t stack_pos, uint32_t *sp, uint32_t ref_stack_fp_offset, uint32_t slot_offset, uint32_t return_slot_offset, bool is_tail_call)
bool MemoryFill(const uint8_t *¤t_code, uint64_t dst, uint32_t value, uint64_t size)
Address(Address js_function, Address packed_args, Address saved_c_entry_fp, const FunctionSig *sig, Address c_entry_fp, Address callable) WasmToJSCallSig
void ContinueExecution(WasmInterpreterThread *thread, bool called_from_js)
bool AllowsAtomicsWait() const
WasmRef WasmJSToWasmObject(WasmRef extern_ref, ValueType value_type, uint32_t canonical_index) const
static int instruction_table_offset()
int32_t I64AtomicWait(uint64_t effective_index, int64_t val, int64_t timeout)
void TableInit(const uint8_t *¤t_code, uint32_t table_index, uint32_t element_segment_index, uint32_t dst, uint32_t src, uint32_t size)
DirectHandle< FixedArray > reference_stack() const
uint32_t TableSize(uint32_t table_index)
void SetTrapFunctionIndex(int32_t func_index)
const WasmTag & GetWasmTag(uint32_t tag_index) const
std::vector< WasmValue > function_result_
DirectHandle< WasmExceptionPackage > CreateWasmExceptionPackage(uint32_t tag_index) const
static int memory_start_offset()
bool WasmArrayInitSegment(uint32_t segment_index, WasmRef wasm_array, uint32_t array_offset, uint32_t segment_offset, uint32_t length)
WasmRef WasmToJSObject(WasmRef ref) const
void CallWasmToJSBuiltin(Isolate *isolate, DirectHandle< Object > object_ref, Address packed_args, const FunctionSig *sig)
void ResetCurrentHandleScope()
void UnpackException(uint32_t *sp, const WasmTag &tag, DirectHandle< Object > exception_object, uint32_t first_param_slot_index, uint32_t first_param_ref_stack_index)
uint32_t start_function_index_
int GetFunctionIndex(int index) const
std::vector< WasmInterpreterStackEntry > GetStackTrace()
void Trap(TrapReason trap_reason, int trap_function_index, int trap_pc, const FrameState ¤t_frame)
void StopExecutionTimer()
WasmInterpreterThread::Activation * GetActivation(Address frame_pointer) const
void StartExecutionTimer()
void EnsureRefStackSpace(size_t new_size)
void ClearRefStackValues(size_t index, size_t count)
void SetCurrentFrame(const FrameState &frame_state)
std::vector< WasmInterpreterStackEntry > GetInterpretedStack(Address frame_pointer)
WasmInterpreterRuntime * GetWasmRuntime()
int GetFunctionIndex(Address frame_pointer, int index) const
void SetTrapFunctionIndex(int32_t func_index)
void BeginExecution(WasmInterpreterThread *thread, uint32_t function_index, Address frame_pointer, uint8_t *interpreter_fp, uint32_t ref_stack_offset, const std::vector< WasmValue > &argument_values)
WasmValue GetReturnValue(int index) const
static constexpr MessageTemplate TrapReasonToMessageId(TrapReason)
#define RUNTIME_FUNCTION(Name)
base::Vector< const DirectHandle< Object > > args
ZoneVector< RpoNumber > & result
LiftoffAssembler::CacheState state
static V ReadUnalignedValue(Address p)
constexpr bool IsInBounds(T index, T length, T max)
static void WriteUnalignedValue(Address p, V value)
WordWithBits< 128 > Simd128
TH_DISABLE_ASAN bool IsThreadInWasm()
static bool StringCheck(const WasmRef obj)
V8_EXPORT_PRIVATE InterpreterHandle * GetInterpreterHandle(Isolate *isolate, DirectHandle< Tuple2 > interpreter_object)
static ValueType value_type()
static const size_t kSlotSize
static bool EqCheck(const WasmRef obj)
PWasmOp * kInstructionTable[kInstructionTableSize]
int GetSubtypingDepth(const WasmModule *module, ModuleTypeIndex type_index)
constexpr IndependentHeapType kWasmNullExternRef
constexpr uint32_t kMinimumSupertypeArraySize
MaybeDirectHandle< Object > JSToWasmObject(Isolate *isolate, DirectHandle< Object > value, CanonicalValueType expected, const char **error_message)
bool AbstractTypeCast(Isolate *isolate, const WasmRef obj, const ValueType obj_type, bool null_succeeds)
InstructionHandler ReadFnId(const uint8_t *&code)
uint32_t WasmInterpreterRuntime int64_t r0
constexpr IndependentHeapType kWasmAnyRef
V8_NOINLINE bool EquivalentTypes(ValueType type1, ValueType type2, const WasmModule *module1, const WasmModule *module2)
TypeCanonicalizer * GetTypeCanonicalizer()
uint32_t WasmInterpreterRuntime * wasm_runtime
V8_EXPORT_PRIVATE InterpreterHandle * GetOrCreateInterpreterHandle(Isolate *isolate, DirectHandle< Tuple2 > interpreter_object)
DISABLE_CFI_ICALL void CallThroughDispatchTable(const uint8_t *code, uint32_t *sp, WasmInterpreterRuntime *wasm_runtime, int64_t r0, double fp0)
constexpr IndependentHeapType kWasmExternRef
bool IsJSCompatibleSignature(const CanonicalSig *sig)
static bool I31Check(const WasmRef obj)
uint32_t WasmInterpreterRuntime int64_t double fp0
DirectHandle< Object > WasmRef
static bool StructCheck(const WasmRef obj)
constexpr IndependentHeapType kWasmFuncRef
constexpr IndependentHeapType kWasmRefI31
static constexpr uint32_t kInstructionTableMask
bool(*)(const WasmRef obj) TypeChecker
InstructionHandler s_unwind_code
V8_INLINE bool IsSubtypeOf(ValueType subtype, ValueType supertype, const WasmModule *sub_module, const WasmModule *super_module)
static bool ArrayCheck(const WasmRef obj)
constexpr IndependentValueType kWasmS128
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
void DecodeI32ExceptionValue(DirectHandle< FixedArray > encoded_values, uint32_t *encoded_index, uint32_t *value)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
kWasmInternalFunctionIndirectPointerTag kProtectedInstanceDataOffset sig
constexpr int kSystemPointerSize
kMemory0SizeOffset Address kNewAllocationLimitAddressOffset Address kOldAllocationLimitAddressOffset uint8_t kGlobalsStartOffset kJumpTableStartOffset std::atomic< uint32_t > kTieringBudgetArrayOffset kDataSegmentStartsOffset kElementSegmentsOffset kInstanceObjectOffset kMemoryObjectsOffset kTaggedGlobalsBufferOffset tables
uintptr_t GetCurrentStackPosition()
void DecodeI64ExceptionValue(DirectHandle< FixedArray > encoded_values, uint32_t *encoded_index, uint64_t *value)
int32_t NumberToInt32(Tagged< Object > number)
V8_INLINE constexpr bool IsHeapObject(TaggedImpl< kRefType, StorageType > obj)
V8_EXPORT_PRIVATE FlagValues v8_flags
kMemory0SizeOffset Address kNewAllocationLimitAddressOffset Address kOldAllocationLimitAddressOffset uint8_t kGlobalsStartOffset kJumpTableStartOffset std::atomic< uint32_t > kTieringBudgetArrayOffset kDataSegmentStartsOffset kElementSegmentsOffset kInstanceObjectOffset kMemoryObjectsOffset kTaggedGlobalsBufferOffset kTablesOffset dispatch_table0
static constexpr Address kNullAddress
kMemory0SizeOffset Address kNewAllocationLimitAddressOffset Address kOldAllocationLimitAddressOffset uint8_t kGlobalsStartOffset kJumpTableStartOffset std::atomic< uint32_t > kTieringBudgetArrayOffset kDataSegmentStartsOffset kElementSegmentsOffset instance_object
static V8_INLINE constexpr Address IntToSmi(int value)
constexpr uint32_t kSlotsZapValue
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
SourcePositionTable *const table_
const size_t segment_offset
#define DCHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
#define DISABLE_CFI_ICALL
#define V8_EXPORT_PRIVATE
#define OFFSET_OF(type, field)
constexpr bool valid() const
std::vector< CatchHandler > catch_handlers
const FunctionSig * signature
#define V8_UNLIKELY(condition)
const wasm::WasmModule * module_
#define CASE_RET_TYPE(type, ctype)
#define CASE_ARG_TYPE(type, ctype)