30using StringBuilder = wasm::StringBuilder;
31DirectHandle<String> ToInternalString(StringBuilder& sb, Isolate* isolate) {
32 return isolate->factory()->InternalizeString(
41 kLastInstanceProxyId = kTablesProxy,
48 kLastProxyId = kArrayProxy,
50 kNumProxies = kLastProxyId + 1,
51 kNumInstanceProxies = kLastInstanceProxyId + 1
54constexpr int kWasmValueMapIndex = kNumProxies;
55constexpr int kNumDebugMaps = kWasmValueMapIndex + 1;
57DirectHandle<FixedArray> GetOrCreateDebugMaps(Isolate* isolate) {
58 DirectHandle<FixedArray> maps = isolate->wasm_debug_maps();
59 if (maps->length() == 0) {
60 maps = isolate->factory()->NewFixedArrayWithHoles(kNumDebugMaps);
61 isolate->native_context()->set_wasm_debug_maps(*maps);
72DirectHandle<Map> GetOrCreateDebugProxyMap(
73 Isolate* isolate, DebugProxyId
id,
75 bool make_non_extensible =
true) {
76 auto maps = GetOrCreateDebugMaps(isolate);
77 CHECK_LE(kNumProxies, maps->length());
78 if (!maps->is_the_hole(isolate,
id)) {
87 if (make_non_extensible) {
88 map->set_is_extensible(
false);
96template <
typename T, DebugProxyId
id,
typename Prov
ider>
97struct IndexedDebugProxy {
98 static constexpr DebugProxyId
kId = id;
100 static DirectHandle<JSObject> Create(Isolate* isolate,
101 DirectHandle<Provider> provider,
102 bool make_map_non_extensible =
true) {
103 auto object_map = GetOrCreateDebugProxyMap(isolate,
kId, &T::CreateTemplate,
104 make_map_non_extensible);
105 auto object = isolate->factory()->NewFastOrSlowJSObjectFromMap(
108 object->SetEmbedderField(kProviderField, *provider);
121 templ->InstanceTemplate()->SetInternalFieldCount(T::kFieldCount);
122 templ->InstanceTemplate()->SetHandler(
124 &T::IndexedGetter, {}, &T::IndexedQuery, {}, &T::IndexedEnumerator,
125 {}, &T::IndexedDescriptor, {},
130 template <
typename V>
131 static Isolate* GetIsolate(
const PropertyCallbackInfo<V>& info) {
132 return reinterpret_cast<Isolate*
>(info.GetIsolate());
135 template <
typename V>
136 static DirectHandle<JSObject> GetHolder(
const PropertyCallbackInfo<V>& info) {
140 static DirectHandle<Provider> GetProvider(DirectHandle<JSObject> holder,
143 Cast<Provider>(holder->GetEmbedderField(kProviderField)), isolate);
146 template <
typename V>
147 static DirectHandle<Provider> GetProvider(
148 const PropertyCallbackInfo<V>& info) {
149 return GetProvider(GetHolder(info), GetIsolate(info));
153 uint32_t index,
const PropertyCallbackInfo<v8::Value>& info) {
154 auto isolate = GetIsolate(info);
155 auto provider = GetProvider(info);
156 if (index < T::Count(isolate, provider)) {
157 auto value = T::Get(isolate, provider, index);
158 info.GetReturnValue().Set(Utils::ToLocal(value));
165 uint32_t index,
const PropertyCallbackInfo<v8::Value>& info) {
166 auto isolate = GetIsolate(info);
167 auto provider = GetProvider(info);
168 if (index < T::Count(isolate, provider)) {
169 PropertyDescriptor descriptor;
170 descriptor.set_configurable(
false);
171 descriptor.set_enumerable(
true);
172 descriptor.set_writable(
false);
173 descriptor.set_value(
Cast<JSAny>(T::Get(isolate, provider, index)));
174 info.GetReturnValue().Set(Utils::ToLocal(descriptor.ToObject(isolate)));
181 uint32_t index,
const PropertyCallbackInfo<v8::Integer>& info) {
182 if (index < T::Count(GetIsolate(info), GetProvider(info))) {
191 static void IndexedEnumerator(
const PropertyCallbackInfo<v8::Array>& info) {
192 auto isolate = GetIsolate(info);
193 auto count = T::Count(isolate, GetProvider(info));
194 auto indices = isolate->factory()->NewFixedArray(count);
195 for (uint32_t index = 0; index <
count; ++
index) {
198 info.GetReturnValue().Set(
199 Utils::ToLocal(isolate->factory()->NewJSArrayWithElements(
208template <
typename T, DebugProxyId
id,
typename Prov
ider = WasmInstanceObject>
209struct NamedDebugProxy : IndexedDebugProxy<T, id, Provider> {
211 auto templ = IndexedDebugProxy<T, id, Provider>::CreateTemplate(isolate);
213 &T::NamedGetter, {}, &T::NamedQuery, {}, &T::NamedEnumerator, {},
218 static void IndexedEnumerator(
const PropertyCallbackInfo<v8::Array>& info) {
222 static DirectHandle<NameDictionary> GetNameTable(
223 DirectHandle<JSObject> holder, Isolate* isolate) {
224 DirectHandle<Symbol> symbol =
225 isolate->factory()->wasm_debug_proxy_names_symbol();
226 DirectHandle<Object> table_or_undefined =
227 JSObject::GetProperty(isolate, holder, symbol).ToHandleChecked();
228 if (!IsUndefined(*table_or_undefined, isolate)) {
231 auto provider = T::GetProvider(holder, isolate);
232 auto count = T::Count(isolate, provider);
234 for (uint32_t index = 0; index <
count; ++
index) {
235 HandleScope scope(isolate);
236 auto key = T::GetName(isolate, provider, index);
237 if (table->FindEntry(isolate,
key).is_found())
continue;
239 table = NameDictionary::Add(isolate, table,
key, value,
246 template <
typename V>
247 static std::optional<uint32_t> FindName(Local<v8::Name> name,
248 const PropertyCallbackInfo<V>& info) {
249 if (!name->IsString())
return {};
251 if (name_str->length() == 0 || name_str->Get(0) !=
'$')
return {};
252 auto isolate = T::GetIsolate(info);
253 auto table = GetNameTable(T::GetHolder(info), isolate);
254 auto entry = table->FindEntry(isolate, name_str);
255 if (entry.is_found())
return Smi::ToInt(table->ValueAt(entry));
260 Local<v8::Name> name,
const PropertyCallbackInfo<v8::Value>& info) {
261 if (
auto index = FindName(name, info)) {
262 return T::IndexedGetter(*index, info);
268 Local<v8::Name> name,
const PropertyCallbackInfo<v8::Integer>& info) {
269 if (
auto index = FindName(name, info)) {
270 return T::IndexedQuery(*index, info);
276 Local<v8::Name> name,
const PropertyCallbackInfo<v8::Value>& info) {
277 if (
auto index = FindName(name, info)) {
278 return T::IndexedDescriptor(*index, info);
283 static void NamedEnumerator(
const PropertyCallbackInfo<v8::Array>& info) {
284 auto isolate = T::GetIsolate(info);
285 auto table = GetNameTable(T::GetHolder(info), isolate);
286 auto names = NameDictionary::IterationIndices(isolate, table);
287 for (
int i = 0;
i < names->
length(); ++
i) {
289 names->set(
i, table->NameAt(entry));
291 info.GetReturnValue().Set(Utils::ToLocal(
297struct FunctionsProxy : NamedDebugProxy<FunctionsProxy, kFunctionsProxy> {
300 static uint32_t Count(Isolate* isolate,
301 DirectHandle<WasmInstanceObject> instance) {
302 return static_cast<uint32_t
>(instance->module()->functions.size());
305 static DirectHandle<Object>
Get(Isolate* isolate,
306 DirectHandle<WasmInstanceObject> instance,
309 instance->trusted_data(isolate), isolate};
310 DirectHandle<WasmFuncRef> func_ref =
313 DirectHandle<WasmInternalFunction> internal_function{
314 func_ref->internal(isolate), isolate};
318 static DirectHandle<String> GetName(Isolate* isolate,
319 DirectHandle<WasmInstanceObject> instance,
322 instance->trusted_data(isolate), isolate};
328struct GlobalsProxy : NamedDebugProxy<GlobalsProxy, kGlobalsProxy> {
329 static constexpr char const*
kClassName =
"Globals";
331 static uint32_t Count(Isolate* isolate,
332 DirectHandle<WasmInstanceObject> instance) {
333 return static_cast<uint32_t
>(instance->module()->globals.size());
336 static DirectHandle<Object>
Get(Isolate* isolate,
337 DirectHandle<WasmInstanceObject> instance,
340 isolate, instance->trusted_data(isolate)->GetGlobalValue(
341 isolate, instance->module()->globals[index]));
344 static DirectHandle<String> GetName(Isolate* isolate,
345 DirectHandle<WasmInstanceObject> instance,
347 wasm::NamesProvider* names =
348 instance->module_object()->native_module()->GetNamesProvider();
350 names->PrintGlobalName(sb, index);
351 return ToInternalString(sb, isolate);
356struct MemoriesProxy : NamedDebugProxy<MemoriesProxy, kMemoriesProxy> {
357 static constexpr char const*
kClassName =
"Memories";
359 static uint32_t Count(Isolate* isolate,
360 DirectHandle<WasmInstanceObject> instance) {
361 return instance->trusted_data(isolate)->memory_objects()->length();
364 static DirectHandle<Object>
Get(Isolate* isolate,
365 DirectHandle<WasmInstanceObject> instance,
367 return direct_handle(instance->trusted_data(isolate)->memory_object(index),
371 static DirectHandle<String> GetName(Isolate* isolate,
372 DirectHandle<WasmInstanceObject> instance,
374 wasm::NamesProvider* names =
375 instance->module_object()->native_module()->GetNamesProvider();
377 names->PrintMemoryName(sb, index);
378 return ToInternalString(sb, isolate);
383struct TablesProxy : NamedDebugProxy<TablesProxy, kTablesProxy> {
384 static constexpr char const*
kClassName =
"Tables";
386 static uint32_t Count(Isolate* isolate,
387 DirectHandle<WasmInstanceObject> instance) {
388 return instance->trusted_data(isolate)->tables()->length();
391 static DirectHandle<Object>
Get(Isolate* isolate,
392 DirectHandle<WasmInstanceObject> instance,
394 return direct_handle(instance->trusted_data(isolate)->tables()->get(index),
398 static DirectHandle<String> GetName(Isolate* isolate,
399 DirectHandle<WasmInstanceObject> instance,
401 wasm::NamesProvider* names =
402 instance->module_object()->native_module()->GetNamesProvider();
404 names->PrintTableName(sb, index);
405 return ToInternalString(sb, isolate);
410struct LocalsProxy : NamedDebugProxy<LocalsProxy, kLocalsProxy, FixedArray> {
411 static constexpr char const*
kClassName =
"Locals";
413 static DirectHandle<JSObject> Create(WasmFrame* frame) {
414 auto isolate = frame->isolate();
415 auto debug_info = frame->native_module()->GetDebugInfo();
417 int count = debug_info->GetNumLocals(frame->pc(), isolate);
418 auto function = debug_info->GetFunctionAtAddress(frame->pc(), isolate);
419 auto values = isolate->factory()->NewFixedArray(count + 2);
422 isolate, debug_info->GetLocalValue(
i, frame->pc(), frame->fp(),
423 frame->callee_fp(), isolate));
424 values->set(
i, *value);
426 values->set(count + 0, frame->wasm_instance()->module_object());
427 values->set(count + 1,
Smi::FromInt(function.func_index));
428 return NamedDebugProxy::Create(isolate, values);
431 static uint32_t Count(Isolate* isolate, DirectHandle<FixedArray> values) {
432 return values->length() - 2;
435 static DirectHandle<Object>
Get(Isolate* isolate,
436 DirectHandle<FixedArray> values,
441 static DirectHandle<String> GetName(Isolate* isolate,
442 DirectHandle<FixedArray> values,
444 uint32_t count = Count(isolate, values);
448 wasm::NamesProvider* names = native_module->GetNamesProvider();
450 names->PrintLocalName(sb, function_index, index);
451 return ToInternalString(sb, isolate);
456struct StackProxy : IndexedDebugProxy<StackProxy, kStackProxy, FixedArray> {
457 static constexpr char const*
kClassName =
"Stack";
459 static DirectHandle<JSObject> Create(WasmFrame* frame) {
460 auto isolate = frame->isolate();
462 frame->trusted_instance_data()->native_module()->GetDebugInfo();
463 int count = debug_info->GetStackDepth(frame->pc(), isolate);
464 auto values = isolate->factory()->NewFixedArray(count);
467 isolate, debug_info->GetStackValue(
i, frame->pc(), frame->fp(),
468 frame->callee_fp(), isolate));
469 values->set(
i, *value);
471 return IndexedDebugProxy::Create(isolate, values);
474 static uint32_t Count(Isolate* isolate, DirectHandle<FixedArray> values) {
475 return values->length();
478 static DirectHandle<Object>
Get(Isolate* isolate,
479 DirectHandle<FixedArray> values,
489DirectHandle<FixedArray> GetOrCreateInstanceProxyCache(
490 Isolate* isolate, DirectHandle<WasmInstanceObject> instance) {
491 DirectHandle<Object> cache;
492 DirectHandle<Symbol> symbol =
493 isolate->factory()->wasm_debug_proxy_cache_symbol();
495 IsUndefined(*cache, isolate)) {
496 cache = isolate->factory()->NewFixedArrayWithHoles(kNumInstanceProxies);
504template <
typename Proxy>
505DirectHandle<JSObject> GetOrCreateInstanceProxy(
506 Isolate* isolate, DirectHandle<WasmInstanceObject> instance) {
507 static_assert(Proxy::kId < kNumInstanceProxies);
508 DirectHandle<FixedArray> proxies =
509 GetOrCreateInstanceProxyCache(isolate, instance);
510 if (!proxies->is_the_hole(isolate, Proxy::kId)) {
513 DirectHandle<JSObject> proxy = Proxy::Create(isolate, instance);
514 proxies->set(Proxy::kId, *proxy);
559class ContextProxyPrototype {
561 static DirectHandle<JSObject> Create(Isolate* isolate) {
563 GetOrCreateDebugProxyMap(isolate, kContextProxy, &CreateTemplate);
564 return isolate->factory()->NewJSObjectFromMap(
573 &NamedGetter, {}, {}, {}, {}, {}, {}, {},
575 static_cast<unsigned>(
577 static_cast<unsigned>(
582 static MaybeDirectHandle<Object> GetNamedProperty(
583 Isolate* isolate, DirectHandle<JSObject>
receiver,
584 DirectHandle<String> name) {
585 if (name->length() != 0 && name->Get(0) ==
'$') {
586 const char* kDelegateNames[] = {
"memories",
"locals",
"tables",
587 "functions",
"globals"};
588 for (
auto delegate_name : kDelegateNames) {
589 DirectHandle<JSAny> delegate;
592 isolate,
receiver, delegate_name)));
593 if (!IsUndefined(*delegate, isolate)) {
594 DirectHandle<Object>
value;
597 if (!IsUndefined(*value, isolate))
return value;
605 Local<v8::Name> name,
const PropertyCallbackInfo<v8::Value>& info) {
607 auto isolate =
reinterpret_cast<Isolate*
>(info.GetIsolate());
609 DirectHandle<Object>
value;
610 if (GetNamedProperty(isolate,
receiver, name_string).ToHandle(&value)) {
611 info.GetReturnValue().Set(Utils::ToLocal(value));
620 static DirectHandle<JSObject> Create(WasmFrame* frame) {
621 Isolate* isolate = frame->isolate();
622 auto object = isolate->factory()->NewSlowJSObjectWithNullProto();
623 DirectHandle<WasmInstanceObject> instance(frame->wasm_instance(), isolate);
625 DirectHandle<WasmModuleObject> module_object(instance->module_object(),
628 auto locals = LocalsProxy::Create(frame);
630 auto stack = StackProxy::Create(frame);
632 auto memories = GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance);
634 auto tables = GetOrCreateInstanceProxy<TablesProxy>(isolate, instance);
636 auto globals = GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance);
639 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance);
641 DirectHandle<JSObject> prototype = ContextProxyPrototype::Create(isolate);
648class DebugWasmScopeIterator final :
public debug::ScopeIterator {
650 explicit DebugWasmScopeIterator(WasmFrame* frame)
652 type_(debug::ScopeIterator::ScopeTypeWasmExpressionStack) {
655 if (!frame->is_inspectable()) {
656 type_ = debug::ScopeIterator::ScopeTypeModule;
660 bool Done()
override {
return type_ == ScopeTypeWith; }
662 void Advance()
override {
665 case ScopeTypeWasmExpressionStack:
671 case ScopeTypeModule:
683 Isolate* isolate =
frame_->isolate();
686 DirectHandle<WasmInstanceObject> instance{
frame_->wasm_instance(),
688 DirectHandle<JSObject>
object =
689 isolate->factory()->NewSlowJSObjectWithNullProto();
691 DirectHandle<JSObject> module_object(instance->module_object(),
694 if (FunctionsProxy::Count(isolate, instance) != 0) {
696 isolate,
object,
"functions",
697 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance),
700 if (GlobalsProxy::Count(isolate, instance) != 0) {
702 isolate,
object,
"globals",
703 GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance),
706 if (MemoriesProxy::Count(isolate, instance) != 0) {
708 isolate,
object,
"memories",
709 GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance),
712 if (TablesProxy::Count(isolate, instance) != 0) {
714 isolate,
object,
"tables",
715 GetOrCreateInstanceProxy<TablesProxy>(isolate, instance),
FROZEN);
717 return Utils::ToLocal(
object);
720 return Utils::ToLocal(LocalsProxy::Create(frame_));
723 auto object = isolate->factory()->NewSlowJSObjectWithNullProto();
724 auto stack = StackProxy::Create(frame_);
726 return Utils::ToLocal(
object);
733 return Utils::ToLocal(
frame_->isolate()->factory()->empty_string());
736 int GetScriptId()
override {
return -1; }
738 bool HasLocationInfo()
override {
return false; }
740 debug::Location GetStartLocation()
override {
return {}; }
742 debug::Location GetEndLocation()
override {
return {}; }
754#if V8_ENABLE_DRUMBRAKE
755class DebugWasmInterpreterScopeIterator final :
public debug::ScopeIterator {
757 explicit DebugWasmInterpreterScopeIterator(WasmInterpreterEntryFrame* frame)
758 :
frame_(frame),
type_(debug::ScopeIterator::ScopeTypeModule) {
763 bool Done()
override {
return type_ == ScopeTypeWith; }
765 void Advance()
override {
768 case ScopeTypeModule:
770 type_ = debug::ScopeIterator::ScopeTypeWith;
772 case ScopeTypeWasmExpressionStack:
782 Isolate* isolate =
frame_->isolate();
784 case debug::ScopeIterator::ScopeTypeModule: {
785 DirectHandle<WasmInstanceObject> instance(
frame_->wasm_instance(),
787 DirectHandle<JSObject>
object =
788 isolate->factory()->NewSlowJSObjectWithNullProto();
789 JSObject::AddProperty(isolate,
object,
"instance", instance, FROZEN);
790 DirectHandle<JSObject> module_object(instance->module_object(),
792 JSObject::AddProperty(isolate,
object,
"module", module_object, FROZEN);
793 if (FunctionsProxy::Count(isolate, instance) != 0) {
794 JSObject::AddProperty(
795 isolate,
object,
"functions",
796 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance),
799 if (GlobalsProxy::Count(isolate, instance) != 0) {
800 JSObject::AddProperty(
801 isolate,
object,
"globals",
802 GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance),
805 if (MemoriesProxy::Count(isolate, instance) != 0) {
806 JSObject::AddProperty(
807 isolate,
object,
"memories",
808 GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance),
811 if (TablesProxy::Count(isolate, instance) != 0) {
812 JSObject::AddProperty(
813 isolate,
object,
"tables",
814 GetOrCreateInstanceProxy<TablesProxy>(isolate, instance), FROZEN);
816 return Utils::ToLocal(
object);
818 case debug::ScopeIterator::ScopeTypeLocal:
819 case debug::ScopeIterator::ScopeTypeWasmExpressionStack:
825 return Utils::ToLocal(
frame_->isolate()->factory()->empty_string());
828 int GetScriptId()
override {
return -1; }
830 bool HasLocationInfo()
override {
return false; }
832 debug::Location GetStartLocation()
override {
return {}; }
834 debug::Location GetEndLocation()
override {
return {}; }
842 WasmInterpreterEntryFrame*
const frame_;
847DirectHandle<String> WasmSimd128ToString(Isolate* isolate,
Simd128 s128) {
850 base::EmbeddedVector<char, 50> buffer;
851 auto i32x4 = s128.to_i32x4();
852 SNPrintF(buffer,
"i32x4 0x%08X 0x%08X 0x%08X 0x%08X", i32x4.val[0],
853 i32x4.val[1], i32x4.val[2], i32x4.val[3]);
854 return isolate->factory()->NewStringFromAsciiChecked(buffer.data());
857DirectHandle<String> GetRefTypeName(Isolate* isolate,
858 wasm::CanonicalValueType type) {
861 return ToInternalString(name, isolate);
870 auto maps = GetOrCreateDebugMaps(isolate);
871 if (maps->is_the_hole(isolate, kWasmValueMapIndex)) {
873 isolate->factory()->NewContextfulMapForCurrentContext(
874 WASM_VALUE_OBJECT_TYPE, WasmValueObject::kSize,
877 map->SetConstructor(*isolate->object_function());
883 map->AppendDescriptor(isolate, &d);
888 isolate->factory()->InternalizeString(
891 map->AppendDescriptor(isolate, &d);
893 map->set_is_extensible(
false);
894 maps->set(kWasmValueMapIndex, *map);
900 object->set_type(*type);
901 object->set_value(*value);
906struct StructProxy : NamedDebugProxy<StructProxy, kStructProxy, WasmStruct> {
911 return NamedDebugProxy::Create(isolate, value);
916 obj->map()->wasm_type_info()->type().ref_index();
932 obj->map()->wasm_type_info()->type().ref_index();
936 return ToInternalString(sb, isolate);
941struct ArrayProxy : IndexedDebugProxy<ArrayProxy, kArrayProxy, WasmArray> {
947 isolate, value,
false );
948 uint32_t length = value->length();
950 isolate->factory()->NewNumberFromUint(length);
960 IndexedDebugProxy::CreateTemplate(isolate);
961 templ->InstanceTemplate()->Set(isolate,
"length",
967 return array->length();
982 switch (value.type().kind()) {
987 v = isolate->factory()->NewNumber(value.to_i8_unchecked());
994 v = isolate->factory()->NewNumber(value.to_i16_unchecked());
999 v = isolate->factory()->NewNumberFromInt(value.to_i32_unchecked());
1011 v = isolate->factory()->NewNumber(value.to_f16_unchecked());
1016 v = isolate->factory()->NewNumber(value.to_f32_unchecked());
1021 v = isolate->factory()->NewNumber(value.to_f64_unchecked());
1026 v = WasmSimd128ToString(isolate, value.to_s128_unchecked());
1029 case wasm::kRefNull:
1033 t = isolate->factory()->InternalizeString(
1036 }
else if (IsWasmStruct(*ref)) {
1039 t = GetRefTypeName(isolate, type_info->type());
1041 }
else if (IsWasmArray(*ref)) {
1044 t = GetRefTypeName(isolate, type_info->type());
1046 }
else if (IsWasmFuncRef(*ref)) {
1050 t = GetRefTypeName(isolate, value.type());
1051 }
else if (IsWasmNull(*ref)) {
1052 v = isolate->factory()->null_value();
1053 t = GetRefTypeName(isolate, value.type());
1054 }
else if (IsJSFunction(*ref) ||
IsSmi(*ref) ||
IsNull(*ref) ||
1058 t = GetRefTypeName(isolate, value.type());
1063 int len = SNPrintF(error,
"unimplemented object type: %d",
1065 t = GetRefTypeName(isolate, value.type());
1066 v = isolate->factory()->InternalizeString(error.SubVector(0, len));
1075 return New(isolate, t, v);
1079 return ContextProxy::Create(frame);
1083 return std::make_unique<DebugWasmScopeIterator>(frame);
1086#if V8_ENABLE_DRUMBRAKE
1087std::unique_ptr<debug::ScopeIterator> GetWasmInterpreterScopeIterator(
1088 WasmInterpreterEntryFrame* frame) {
1089 return std::make_unique<DebugWasmInterpreterScopeIterator>(frame);
1095 uint32_t func_index) {
1100 is_asmjs_module(native_module->
module())
1103 names->PrintFunctionName(sb, func_index, behavior);
1104 return ToInternalString(sb, isolate);
1112 isolate->factory()->NewStringFromAsciiChecked(
"[[Module]]"),
1115 if (FunctionsProxy::Count(isolate, instance) != 0) {
1118 isolate->factory()->NewStringFromAsciiChecked(
"[[Functions]]"),
1119 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance));
1122 if (GlobalsProxy::Count(isolate, instance) != 0) {
1125 isolate->factory()->NewStringFromAsciiChecked(
"[[Globals]]"),
1126 GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance));
1129 if (MemoriesProxy::Count(isolate, instance) != 0) {
1132 isolate->factory()->NewStringFromAsciiChecked(
"[[Memories]]"),
1133 GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance));
1136 if (TablesProxy::Count(isolate, instance) != 0) {
1139 isolate->factory()->NewStringFromAsciiChecked(
"[[Tables]]"),
1140 GetOrCreateInstanceProxy<TablesProxy>(isolate, instance));
1151 isolate->factory()->NewStringFromStaticChars(
"[[Exports]]"),
1155 isolate->factory()->NewStringFromStaticChars(
"[[Imports]]"),
1163 int length = table->current_length();
1168 if (table->has_trusted_data()) {
1169 mod = table->trusted_data(isolate)->module();
1180 isolate->factory()->null_value(),
false,
kDontThrow)
1183 isolate->factory()->NewStringFromStaticChars(
"[[Entries]]");
static Local< Array > New(Isolate *isolate, int length=0)
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const CFunction *c_function=nullptr, uint16_t instance_type=0, uint16_t allowed_receiver_instance_type_range_start=0, uint16_t allowed_receiver_instance_type_range_end=0)
static Local< Integer > New(Isolate *isolate, int32_t value)
static Local< Number > New(Isolate *isolate, double value)
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=NewStringType::kNormal, int length=-1)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
static v8::internal::DirectHandle< To > OpenDirectHandle(v8::Local< From > handle)
@ ScopeTypeWasmExpressionStack
static V8_WARN_UNUSED_RESULT MaybeHandle< JSFunction > InstantiateFunction(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< FunctionTemplateInfo > data, MaybeDirectHandle< Name > maybe_name={})
static V8_EXPORT_PRIVATE DirectHandle< ArrayList > Add(Isolate *isolate, DirectHandle< ArrayList > array, Tagged< Smi > obj, AllocationType allocation=AllocationType::kYoung)
static V8_EXPORT_PRIVATE Handle< BigInt > FromInt64(Isolate *isolate, int64_t n)
static Descriptor DataField(Isolate *isolate, DirectHandle< Name > key, int field_index, PropertyAttributes attributes, Representation representation)
static V8_INLINE const DirectHandle null()
static V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT MaybeHandle< Map > GetDerivedMap(Isolate *isolate, DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target)
static V8_EXPORT_PRIVATE void AddProperty(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Isolate *isolate, DirectHandle< JSObject > object, DirectHandle< Object > value, bool from_javascript, ShouldThrow should_throw)
static V8_EXPORT_PRIVATE void EnsureDescriptorSlack(Isolate *isolate, DirectHandle< Map > map, int slack)
static V8_EXPORT_PRIVATE void SetPrototype(Isolate *isolate, DirectHandle< Map > map, DirectHandle< JSPrototype > prototype, bool enable_prototype_setup_mode=true)
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)
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 >())
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it, bool is_global_reference=false)
static constexpr PropertyDetails Empty(PropertyCellType cell_type=PropertyCellType::kNoCell)
static constexpr Representation Tagged()
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > FromInt(int value)
static V8_EXPORT_PRIVATE DirectHandle< JSFunction > GetOrCreateExternal(DirectHandle< WasmInternalFunction > internal)
static V8_EXPORT_PRIVATE DirectHandle< Object > Get(Isolate *isolate, DirectHandle< WasmTableObject > table, uint32_t index)
static DirectHandle< WasmFuncRef > GetOrCreateFuncRef(Isolate *isolate, DirectHandle< WasmTrustedInstanceData > trusted_instance_data, int function_index)
static constexpr int kTypeIndex
static DirectHandle< WasmValueObject > New(Isolate *isolate, DirectHandle< String > type, DirectHandle< Object > value)
static constexpr int kValueIndex
void PrintValueType(StringBuilder &out, CanonicalValueType type)
void PrintFieldName(StringBuilder &out, CanonicalTypeIndex struct_index, uint32_t field_index)
const WasmModule * module() const
NamesProvider * GetNamesProvider()
V8_EXPORT_PRIVATE const CanonicalStructType * LookupStruct(CanonicalTypeIndex index) const
static constexpr DebugProxyId kId
static constexpr char const * kClassName
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call)
ZoneVector< RpoNumber > & result
ZoneVector< Entry > entries
int SNPrintF(Vector< char > str, const char *format,...)
constexpr Vector< const char > StaticCharVector(const char(&array)[N])
constexpr Vector< T > VectorOf(T *start, size_t size)
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
WordWithBits< 128 > Simd128
TypeCanonicalizer * GetTypeCanonicalizer()
CanonicalTypeNamesProvider * GetCanonicalTypeNamesProvider()
DirectHandle< JSArray > GetImports(Isolate *isolate, DirectHandle< WasmModuleObject > module_object)
DirectHandle< JSArray > GetExports(Isolate *isolate, DirectHandle< WasmModuleObject > module_object)
DirectHandle< ArrayList > AddWasmModuleObjectInternalProperties(Isolate *isolate, DirectHandle< ArrayList > result, DirectHandle< WasmModuleObject > module_object)
std::unique_ptr< debug::ScopeIterator > GetWasmScopeIterator(WasmFrame *frame)
kWasmInternalFunctionIndirectPointerTag instance_data
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
@ 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
kMemory0SizeOffset Address kNewAllocationLimitAddressOffset Address kOldAllocationLimitAddressOffset uint8_t kGlobalsStartOffset kJumpTableStartOffset std::atomic< uint32_t > kTieringBudgetArrayOffset kDataSegmentStartsOffset kElementSegmentsOffset kInstanceObjectOffset kMemoryObjectsOffset kTaggedGlobalsBufferOffset tables
DirectHandle< JSObject > GetWasmDebugProxy(WasmFrame *frame)
DirectHandle< ArrayList > AddWasmInstanceObjectInternalProperties(Isolate *isolate, DirectHandle< ArrayList > result, DirectHandle< WasmInstanceObject > instance)
DirectHandle< ArrayList > AddWasmTableObjectInternalProperties(Isolate *isolate, DirectHandle< ArrayList > result, DirectHandle< WasmTableObject > table)
kInstanceDescriptorsOffset kTransitionsOrPrototypeInfoOffset IsNull(value)||IsJSProxy(value)||IsWasmObject(value)||(IsJSObject(value) &&(HeapLayout
DirectHandle< String > GetWasmFunctionDebugName(Isolate *isolate, DirectHandle< WasmTrustedInstanceData > instance_data, uint32_t func_index)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Maybe< T > Just(const T &t)
#define CHECK_LE(lhs, rhs)
#define DCHECK(condition)
static DirectHandle< JSObject > Create(Isolate *isolate, DirectHandle< WasmArray > value)
static constexpr char const * kClassName
static DirectHandle< Object > Get(Isolate *isolate, DirectHandle< WasmArray > array, uint32_t index)
static uint32_t Count(Isolate *isolate, DirectHandle< WasmArray > array)
static v8::Local< v8::FunctionTemplate > CreateTemplate(v8::Isolate *isolate)
static constexpr char const * kClassName
static uint32_t Count(Isolate *isolate, DirectHandle< WasmStruct > obj)
static DirectHandle< String > GetName(Isolate *isolate, DirectHandle< WasmStruct > obj, uint32_t index)
static DirectHandle< JSObject > Create(Isolate *isolate, DirectHandle< WasmStruct > value)
static DirectHandle< Object > Get(Isolate *isolate, DirectHandle< WasmStruct > obj, uint32_t index)