Lines Matching defs:isolate

23 Handle<String> GetNameOrDefault(Isolate* isolate,
29 name = isolate->factory()
31 isolate->factory()->NewStringFromAsciiChecked("$"), name)
33 return isolate->factory()->InternalizeString(name);
37 return isolate->factory()->InternalizeString(value.SubVector(0, len));
41 Isolate* isolate, Handle<WasmInstanceObject> instance,
57 return isolate->factory()->NewStringFromUtf8(
64 return isolate->factory()->NewStringFromUtf8(name);
91 Handle<FixedArray> GetOrCreateDebugMaps(Isolate* isolate) {
92 Handle<FixedArray> maps = isolate->wasm_debug_maps();
94 maps = isolate->factory()->NewFixedArrayWithHoles(kNumDebugMaps);
95 isolate->native_context()->set_wasm_debug_maps(*maps);
107 Isolate* isolate, DebugProxyId id,
110 auto maps = GetOrCreateDebugMaps(isolate);
112 if (!maps->is_the_hole(isolate, id)) {
113 return handle(Map::cast(maps->get(id)), isolate);
115 auto tmp = (*create_template_fn)(reinterpret_cast<v8::Isolate*>(isolate));
118 auto map = JSFunction::GetDerivedMap(isolate, fun, fun).ToHandleChecked();
119 Map::SetPrototype(isolate, map, isolate->factory()->null_value());
133 static Handle<JSObject> Create(Isolate* isolate, Handle<Provider> provider,
135 auto object_map = GetOrCreateDebugProxyMap(isolate, kId, &T::CreateTemplate,
137 auto object = isolate->factory()->NewJSObjectFromMap(object_map);
147 static v8::Local<v8::FunctionTemplate> CreateTemplate(v8::Isolate* isolate) {
148 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
150 v8::String::NewFromUtf8(isolate, T::kClassName).ToLocalChecked());
171 Isolate* isolate) {
173 isolate);
183 auto isolate = GetIsolate(info);
185 if (index < T::Count(isolate, provider)) {
186 auto value = T::Get(isolate, provider, index);
193 auto isolate = GetIsolate(info);
195 if (index < T::Count(isolate, provider)) {
200 descriptor.set_value(T::Get(isolate, provider, index));
201 info.GetReturnValue().Set(Utils::ToLocal(descriptor.ToObject(isolate)));
215 auto isolate = GetIsolate(info);
216 auto count = T::Count(isolate, GetProvider(info));
217 auto indices = isolate->factory()->NewFixedArray(count);
222 Utils::ToLocal(isolate->factory()->NewJSArrayWithElements(
233 static v8::Local<v8::FunctionTemplate> CreateTemplate(v8::Isolate* isolate) {
234 auto templ = IndexedDebugProxy<T, id, Provider>::CreateTemplate(isolate);
246 Isolate* isolate) {
247 Handle<Symbol> symbol = isolate->factory()->wasm_debug_proxy_names_symbol();
249 JSObject::GetProperty(isolate, holder, symbol).ToHandleChecked();
250 if (!table_or_undefined->IsUndefined(isolate)) {
253 auto provider = T::GetProvider(holder, isolate);
254 auto count = T::Count(isolate, provider);
255 auto table = NameDictionary::New(isolate, count);
257 HandleScope scope(isolate);
258 auto key = T::GetName(isolate, provider, index);
259 if (table->FindEntry(isolate, key).is_found()) continue;
260 Handle<Smi> value(Smi::FromInt(index), isolate);
261 table = NameDictionary::Add(isolate, table, key, value,
264 Object::SetProperty(isolate, holder, symbol, table).Check();
274 auto isolate = T::GetIsolate(info);
275 auto table = GetNameTable(T::GetHolder(info), isolate);
276 auto entry = table->FindEntry(isolate, name_str);
297 auto isolate = T::GetIsolate(info);
298 auto table = GetNameTable(T::GetHolder(info), isolate);
299 auto names = NameDictionary::IterationIndices(isolate, table);
305 isolate->factory()->NewJSArrayWithElements(names, PACKED_ELEMENTS)));
313 static uint32_t Count(Isolate* isolate, Handle<WasmInstanceObject> instance) {
317 static Handle<Object> Get(Isolate* isolate,
321 isolate, instance, index)
323 isolate);
326 static Handle<String> GetName(Isolate* isolate,
329 return GetWasmFunctionDebugName(isolate, instance, index);
337 static uint32_t Count(Isolate* isolate, Handle<WasmInstanceObject> instance) {
341 static Handle<Object> Get(Isolate* isolate,
344 Handle<WasmModuleObject> module(instance->module_object(), isolate);
346 isolate,
352 static Handle<String> GetName(Isolate* isolate,
356 isolate,
358 isolate, instance, wasm::ImportExportKindCode::kExternalGlobal,
368 static uint32_t Count(Isolate* isolate, Handle<WasmInstanceObject> instance) {
372 static Handle<Object> Get(Isolate* isolate,
375 return handle(instance->memory_object(), isolate);
378 static Handle<String> GetName(Isolate* isolate,
382 isolate,
384 isolate, instance, wasm::ImportExportKindCode::kExternalMemory,
394 static uint32_t Count(Isolate* isolate, Handle<WasmInstanceObject> instance) {
398 static Handle<Object> Get(Isolate* isolate,
401 return handle(instance->tables().get(index), isolate);
404 static Handle<String> GetName(Isolate* isolate,
408 isolate,
410 isolate, instance, wasm::ImportExportKindCode::kExternalTable,
421 auto isolate = frame->isolate();
426 auto values = isolate->factory()->NewFixedArray(count + 2);
428 frame->wasm_instance().module_object(), isolate);
431 isolate,
433 frame->callee_fp(), isolate),
439 return NamedDebugProxy::Create(isolate, values);
442 static uint32_t Count(Isolate* isolate, Handle<FixedArray> values) {
446 static Handle<Object> Get(Isolate* isolate, Handle<FixedArray> values,
448 return handle(values->get(index), isolate);
451 static Handle<String> GetName(Isolate* isolate, Handle<FixedArray> values,
453 uint32_t count = Count(isolate, values);
461 isolate,
463 : isolate->factory()->NewStringFromUtf8(name_vec),
473 auto isolate = frame->isolate();
477 auto values = isolate->factory()->NewFixedArray(count);
479 frame->wasm_instance().module_object(), isolate);
482 isolate,
484 frame->callee_fp(), isolate),
488 return IndexedDebugProxy::Create(isolate, values);
491 static uint32_t Count(Isolate* isolate, Handle<FixedArray> values) {
495 static Handle<Object> Get(Isolate* isolate, Handle<FixedArray> values,
497 return handle(values->get(index), isolate);
506 Isolate* isolate, Handle<WasmInstanceObject> instance) {
508 Handle<Symbol> symbol = isolate->factory()->wasm_debug_proxy_cache_symbol();
509 if (!Object::GetProperty(isolate, instance, symbol).ToHandle(&cache) ||
510 cache->IsUndefined(isolate)) {
511 cache = isolate->factory()->NewFixedArrayWithHoles(kNumInstanceProxies);
512 Object::SetProperty(isolate, instance, symbol, cache).Check();
520 Handle<JSObject> GetOrCreateInstanceProxy(Isolate* isolate,
523 Handle<FixedArray> proxies = GetOrCreateInstanceProxyCache(isolate, instance);
524 if (!proxies->is_the_hole(isolate, Proxy::kId)) {
525 return handle(JSObject::cast(proxies->get(Proxy::kId)), isolate);
527 Handle<JSObject> proxy = Proxy::Create(isolate, instance);
575 static Handle<JSObject> Create(Isolate* isolate) {
577 GetOrCreateDebugProxyMap(isolate, kContextProxy, &CreateTemplate);
578 return isolate->factory()->NewJSObjectFromMap(object_map);
582 static v8::Local<v8::FunctionTemplate> CreateTemplate(v8::Isolate* isolate) {
583 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
594 static MaybeHandle<Object> GetNamedProperty(Isolate* isolate,
603 isolate, delegate,
604 JSObject::GetProperty(isolate, receiver, delegate_name), Object);
605 if (!delegate->IsUndefined(isolate)) {
608 isolate, value, Object::GetProperty(isolate, delegate, name),
610 if (!value->IsUndefined(isolate)) return value;
620 auto isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
623 if (GetNamedProperty(isolate, receiver, name_string).ToHandle(&value)) {
632 Isolate* isolate = frame->isolate();
633 auto object = isolate->factory()->NewSlowJSObjectWithNullProto();
634 Handle<WasmInstanceObject> instance(frame->wasm_instance(), isolate);
635 JSObject::AddProperty(isolate, object, "instance", instance, FROZEN);
636 Handle<WasmModuleObject> module_object(instance->module_object(), isolate);
637 JSObject::AddProperty(isolate, object, "module", module_object, FROZEN);
639 JSObject::AddProperty(isolate, object, "locals", locals, FROZEN);
641 JSObject::AddProperty(isolate, object, "stack", stack, FROZEN);
642 auto memories = GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance);
643 JSObject::AddProperty(isolate, object, "memories", memories, FROZEN);
644 auto tables = GetOrCreateInstanceProxy<TablesProxy>(isolate, instance);
645 JSObject::AddProperty(isolate, object, "tables", tables, FROZEN);
646 auto globals = GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance);
647 JSObject::AddProperty(isolate, object, "globals", globals, FROZEN);
649 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance);
650 JSObject::AddProperty(isolate, object, "functions", functions, FROZEN);
651 Handle<JSObject> prototype = ContextProxyPrototype::Create(isolate);
652 JSObject::SetPrototype(isolate, object, prototype, false, kDontThrow)
693 Isolate* isolate = frame_->isolate();
696 Handle<WasmInstanceObject> instance(frame_->wasm_instance(), isolate);
698 isolate->factory()->NewSlowJSObjectWithNullProto();
699 JSObject::AddProperty(isolate, object, "instance", instance, FROZEN);
700 Handle<JSObject> module_object(instance->module_object(), isolate);
701 JSObject::AddProperty(isolate, object, "module", module_object, FROZEN);
702 if (FunctionsProxy::Count(isolate, instance) != 0) {
704 isolate, object, "functions",
705 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance),
708 if (GlobalsProxy::Count(isolate, instance) != 0) {
710 isolate, object, "globals",
711 GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance),
714 if (MemoriesProxy::Count(isolate, instance) != 0) {
716 isolate, object, "memories",
717 GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance),
720 if (TablesProxy::Count(isolate, instance) != 0) {
722 isolate, object, "tables",
723 GetOrCreateInstanceProxy<TablesProxy>(isolate, instance), FROZEN);
731 auto object = isolate->factory()->NewSlowJSObjectWithNullProto();
733 JSObject::AddProperty(isolate, object, "stack", stack, FROZEN);
741 return Utils::ToLocal(frame_->isolate()->factory()->empty_string());
762 Handle<String> WasmSimd128ToString(Isolate* isolate, wasm::Simd128 s128) {
769 return isolate->factory()->NewStringFromAsciiChecked(buffer.data());
772 Handle<String> GetRefTypeName(Isolate* isolate, wasm::ValueType type,
790 return isolate->factory()->InternalizeString(base::VectorOf(name.str()));
796 Handle<WasmValueObject> WasmValueObject::New(Isolate* isolate,
799 auto maps = GetOrCreateDebugMaps(isolate);
800 if (maps->is_the_hole(isolate, kWasmValueMapIndex)) {
801 Handle<Map> map = isolate->factory()->NewMap(
804 Map::EnsureDescriptorSlack(isolate, map, 2);
805 map->SetConstructor(*isolate->object_function());
808 isolate,
809 isolate->factory()->InternalizeString(base::StaticCharVector("type")),
811 map->AppendDescriptor(isolate, &d);
815 isolate,
816 isolate->factory()->InternalizeString(
819 map->AppendDescriptor(isolate, &d);
825 handle(Map::cast(maps->get(kWasmValueMapIndex)), isolate);
827 isolate->factory()->NewJSObjectFromMap(value_map));
842 static Handle<JSObject> Create(Isolate* isolate, const wasm::WasmValue& value,
844 Handle<FixedArray> data = isolate->factory()->NewFixedArray(kLength);
849 return NamedDebugProxy::Create(isolate, data);
852 static uint32_t Count(Isolate* isolate, Handle<FixedArray> data) {
856 static Handle<Object> Get(Isolate* isolate, Handle<FixedArray> data,
858 Handle<WasmStruct> obj(WasmStruct::cast(data->get(kObjectIndex)), isolate);
860 WasmModuleObject::cast(data->get(kModuleIndex)), isolate);
861 return WasmValueObject::New(isolate, obj->GetFieldValue(index), module);
864 static Handle<String> GetName(Isolate* isolate, Handle<FixedArray> data,
873 isolate,
875 : isolate->factory()->NewStringFromUtf8(name_vec),
888 static Handle<JSObject> Create(Isolate* isolate, const wasm::WasmValue& value,
890 Handle<FixedArray> data = isolate->factory()->NewFixedArray(kLength);
894 isolate, data, false /* leave map extensible */);
896 Handle<Object> length_obj = isolate->factory()->NewNumberFromUint(length);
897 Object::SetProperty(isolate, proxy, isolate->factory()->length_string(),
904 static v8::Local<v8::FunctionTemplate> CreateTemplate(v8::Isolate* isolate) {
906 IndexedDebugProxy::CreateTemplate(isolate);
907 templ->InstanceTemplate()->Set(isolate, "length",
908 v8::Number::New(isolate, 0));
912 static uint32_t Count(Isolate* isolate, Handle<FixedArray> data) {
916 static Handle<Object> Get(Isolate* isolate, Handle<FixedArray> data,
918 Handle<WasmArray> array(WasmArray::cast(data->get(kObjectIndex)), isolate);
920 WasmModuleObject::cast(data->get(kModuleIndex)), isolate);
921 return WasmValueObject::New(isolate, array->GetElement(index), module);
927 Isolate* isolate, const wasm::WasmValue& value,
935 t = isolate->factory()->InternalizeString(base::StaticCharVector("i8"));
936 v = isolate->factory()->NewNumber(value.to_i8_unchecked());
942 t = isolate->factory()->InternalizeString(base::StaticCharVector("i16"));
943 v = isolate->factory()->NewNumber(value.to_i16_unchecked());
947 t = isolate->factory()->InternalizeString(base::StaticCharVector("i32"));
948 v = isolate->factory()->NewNumberFromInt(value.to_i32_unchecked());
952 t = isolate->factory()->InternalizeString(base::StaticCharVector("i64"));
953 v = BigInt::FromInt64(isolate, value.to_i64_unchecked());
957 t = isolate->factory()->InternalizeString(base::StaticCharVector("f32"));
958 v = isolate->factory()->NewNumber(value.to_f32_unchecked());
962 t = isolate->factory()->InternalizeString(base::StaticCharVector("f64"));
963 v = isolate->factory()->NewNumber(value.to_f64_unchecked());
967 t = isolate->factory()->InternalizeString(base::StaticCharVector("v128"));
968 v = WasmSimd128ToString(isolate, value.to_s128_unchecked());
973 t = GetRefTypeName(isolate, value.type(), module_object->native_module());
976 v = StructProxy::Create(isolate, value, module_object);
978 v = ArrayProxy::Create(isolate, value, module_object);
981 isolate);
990 v = isolate->factory()->InternalizeString(error.SubVector(0, len));
996 t = isolate->factory()->InternalizeString(base::StaticCharVector("rtt"));
997 v = isolate->factory()->InternalizeString(
1005 return New(isolate, t, v);
1016 Handle<String> GetWasmFunctionDebugName(Isolate* isolate,
1019 Handle<WasmModuleObject> module_object(instance->module_object(), isolate);
1021 isolate, module_object, func_index);
1028 isolate, instance, wasm::ImportExportKindCode::kExternalFunction,
1031 return GetNameOrDefault(isolate, maybe_name, "$func", func_index);
1035 Isolate* isolate, Handle<ArrayList> result,
1038 isolate, result,
1039 isolate->factory()->NewStringFromAsciiChecked("[[Module]]"),
1040 handle(instance->module_object(), isolate));
1042 if (FunctionsProxy::Count(isolate, instance) != 0) {
1044 isolate, result,
1045 isolate->factory()->NewStringFromAsciiChecked("[[Functions]]"),
1046 GetOrCreateInstanceProxy<FunctionsProxy>(isolate, instance));
1049 if (GlobalsProxy::Count(isolate, instance) != 0) {
1051 isolate, result,
1052 isolate->factory()->NewStringFromAsciiChecked("[[Globals]]"),
1053 GetOrCreateInstanceProxy<GlobalsProxy>(isolate, instance));
1056 if (MemoriesProxy::Count(isolate, instance) != 0) {
1058 isolate, result,
1059 isolate->factory()->NewStringFromAsciiChecked("[[Memories]]"),
1060 GetOrCreateInstanceProxy<MemoriesProxy>(isolate, instance));
1063 if (TablesProxy::Count(isolate, instance) != 0) {
1065 isolate, result,
1066 isolate->factory()->NewStringFromAsciiChecked("[[Tables]]"),
1067 GetOrCreateInstanceProxy<TablesProxy>(isolate, instance));
1074 Isolate* isolate, Handle<ArrayList> result,
1077 isolate, result,
1078 isolate->factory()->NewStringFromStaticChars("[[Exports]]"),
1079 wasm::GetExports(isolate, module_object));
1081 isolate, result,
1082 isolate->factory()->NewStringFromStaticChars("[[Imports]]"),
1083 wasm::GetImports(isolate, module_object));
1088 Isolate* isolate, Handle<ArrayList> result, Handle<WasmTableObject> table) {
1090 Handle<FixedArray> entries = isolate->factory()->NewFixedArray(length);
1092 Handle<Object> entry = WasmTableObject::Get(isolate, table, i);
1095 isolate);
1099 Handle<JSArray> final_entries = isolate->factory()->NewJSArrayWithElements(
1101 JSObject::SetPrototype(isolate, final_entries,
1102 isolate->factory()->null_value(), false, kDontThrow)
1105 isolate->factory()->NewStringFromStaticChars("[[Entries]]");
1106 result = ArrayList::Add(isolate, result, entries_string, final_entries);