Lines Matching refs:instance
144 Handle<WasmInstanceObject> instance) {
147 // We have to use the variable size sentinel because the instance size
156 instance);
171 Handle<WasmInstanceObject> instance) {
175 // Wasm Arrays don't have a static instance size.
181 instance);
198 Handle<WasmInstanceObject> instance) {
206 kNullAddress, opt_rtt_parent, instance_size, instance);
214 int type_index, Handle<WasmInstanceObject> instance,
244 CreateMapForType(isolate, module, supertype, instance, maps);
250 map = CreateStructMap(isolate, module, type_index, rtt_parent, instance);
253 map = CreateArrayMap(isolate, module, type_index, rtt_parent, instance);
256 map = CreateFuncRefMap(isolate, module, rtt_parent, instance);
276 // Build an instance, in all of its glory.
341 void LoadDataSegments(Handle<WasmInstanceObject> instance);
354 bool ProcessImportedFunction(Handle<WasmInstanceObject> instance,
362 Handle<WasmInstanceObject> instance, int table_index, int import_index,
366 bool ProcessImportedTable(Handle<WasmInstanceObject> instance,
372 bool ProcessImportedMemory(Handle<WasmInstanceObject> instance,
377 bool ProcessImportedGlobal(Handle<WasmInstanceObject> instance,
383 bool ProcessImportedWasmGlobalObject(Handle<WasmInstanceObject> instance,
392 void CompileImportWrappers(Handle<WasmInstanceObject> instance);
397 int ProcessImports(Handle<WasmInstanceObject> instance);
403 void InitGlobals(Handle<WasmInstanceObject> instance);
407 void ProcessExports(Handle<WasmInstanceObject> instance);
409 void InitializeNonDefaultableTables(Handle<WasmInstanceObject> instance);
411 void LoadTableSegments(Handle<WasmInstanceObject> instance);
415 void InitializeTags(Handle<WasmInstanceObject> instance);
426 auto instance = builder.Build();
427 if (!instance.is_null() && builder.ExecuteStartFunction()) {
428 return instance;
452 // Build an instance, in all of its glory.
469 // Record build time into correct bucket, then build instance.
533 Handle<WasmInstanceObject> instance =
537 // Attach the memory to the instance.
541 if (!instance->has_memory_object()) {
542 instance->set_memory_object(*memory_object_);
544 // Add the instance object to the list of instances for this memory.
545 WasmMemoryObject::AddInstance(isolate_, memory_object_, instance);
547 // Double-check the {memory} array buffer matches the instance.
549 CHECK_EQ(instance->memory_size(), memory->byte_length());
550 CHECK_EQ(instance->memory_start(), memory->backing_store());
554 // Set up the globals for the new instance.
568 instance->set_untagged_globals_buffer(*untagged_globals_);
569 instance->set_globals_start(
577 instance->set_tagged_globals_buffer(*tagged_globals_);
589 instance->set_imported_mutable_globals_buffers(*buffers_array);
599 instance->set_tags_table(*tag_table);
625 isolate_, instance, table.type, table.initial_size,
630 instance->set_tables(*tables);
643 instance->set_indirect_function_tables(*tables);
646 instance->SetIndirectFunctionTableShortcuts(isolate_);
652 int num_imported_functions = ProcessImports(instance);
676 CreateMapForType(isolate_, module_, index, instance, maps);
678 instance->set_managed_object_maps(*maps);
688 instance->set_feedback_vectors(*vectors);
707 InitGlobals(instance);
721 instance, table_index, table.initial_size);
724 WasmTableObject::cast(instance->tables().get(table_index)), isolate_);
725 WasmTableObject::AddDispatchTable(isolate_, table_object, instance,
734 InitializeNonDefaultableTables(instance);
741 InitializeTags(instance);
745 // Set up the exports object for the new instance.
747 ProcessExports(instance);
754 LoadTableSegments(instance);
762 LoadDataSegments(instance);
779 isolate_, instance, start_index,
783 ImportedFunctionEntry entry(instance, module_->start_function_index);
800 TRACE("Successfully built instance for module %p\n",
808 return instance;
902 Handle<WasmInstanceObject> instance,
915 WasmInstanceObject::GetOrCreateWasmInternalFunction(isolate, instance,
923 instance->module_object().native_module()->wire_bytes();
932 // instance of WasmFullDecoder, which would cost us >50Kb binary code
936 decoder(zone, instance->module(), WasmFeatures::All(), &detected,
937 body, instance->module(), isolate, instance);
999 void InstanceBuilder::LoadDataSegments(Handle<WasmInstanceObject> instance) {
1012 isolate_, instance, thrower_)
1017 DCHECK_GT(std::numeric_limits<size_t>::max(), instance->memory_size());
1023 isolate_, instance, thrower_)
1028 if (!base::IsInBounds<size_t>(dest_offset, size, instance->memory_size())) {
1033 std::memcpy(instance->memory_start() + dest_offset,
1099 Handle<WasmInstanceObject> instance, int import_index, int func_index,
1108 // Store any {WasmExternalFunction} callable in the instance before the call
1113 isolate_, instance, func_index,
1130 // The imported function is a Wasm function from another instance.
1133 imported_function->instance(), isolate_);
1134 // The import reference is the instance object itself.
1136 ImportedFunctionEntry entry(instance, func_index);
1141 NativeModule* native_module = instance->module_object().native_module();
1163 ImportedFunctionEntry entry(instance, func_index);
1171 NativeModule* native_module = instance->module_object().native_module();
1178 ImportedFunctionEntry entry(instance, func_index);
1194 NativeModule* native_module = instance->module_object().native_module();
1202 ImportedFunctionEntry entry(instance, func_index);
1210 entry.SetWasmToWasm(*instance, wasm_code->instruction_start());
1219 Handle<WasmInstanceObject> instance, int table_index, int import_index,
1224 instance, table_index, imported_table_size);
1245 isolate_, instance, table_index, i, js_function);
1260 instance->GetIndirectFunctionTable(isolate_, table_index)
1267 bool InstanceBuilder::ProcessImportedTable(Handle<WasmInstanceObject> instance,
1311 !table_object->instance().IsUndefined()
1312 ? WasmInstanceObject::cast(table_object->instance()).module()
1313 : instance->module();
1323 !InitializeImportedIndirectFunctionTable(instance, table_index,
1328 instance->tables().set(table_index, *value);
1332 bool InstanceBuilder::ProcessImportedMemory(Handle<WasmInstanceObject> instance,
1345 CHECK_EQ(instance->memory_object(), *memory_object);
1386 Handle<WasmInstanceObject> instance, int import_index,
1396 !global_object->instance().IsUndefined()
1397 ? WasmInstanceObject::cast(global_object->instance()).module()
1398 : instance->module();
1403 global_type_module, instance->module())
1405 instance->module());
1432 instance->imported_mutable_globals_buffers().set(global.index, *buffer);
1433 instance->imported_mutable_globals()[global.index] = address_or_offset;
1468 bool InstanceBuilder::ProcessImportedGlobal(Handle<WasmInstanceObject> instance,
1477 // referenced by this instance, and store the address of the imported
1515 return ProcessImportedWasmGlobalObject(instance, import_index, module_name,
1568 Handle<WasmInstanceObject> instance) {
1572 NativeModule* native_module = instance->module_object().native_module();
1634 int InstanceBuilder::ProcessImports(Handle<WasmInstanceObject> instance) {
1640 CompileImportWrappers(instance);
1653 if (!ProcessImportedFunction(instance, index, func_index, module_name,
1663 if (!ProcessImportedTable(instance, index, table_index, module_name,
1672 if (!ProcessImportedMemory(instance, index, module_name, import_name,
1679 if (!ProcessImportedGlobal(instance, index, import.index, module_name,
1698 DCHECK(instance->tags_table().get(import.index).IsUndefined());
1699 instance->tags_table().set(import.index, tag);
1716 void InstanceBuilder::InitGlobals(Handle<WasmInstanceObject> instance) {
1724 isolate_, instance, thrower_);
1735 // Allocate memory for a module instance as a new JSArrayBuffer.
1757 void InstanceBuilder::ProcessExports(Handle<WasmInstanceObject> instance) {
1762 // WebAssembly functions in the instance, and all imported globals in a map
1771 isolate_, instance, import.index,
1796 instance->set_exports_object(*exports_object);
1814 isolate_, instance, exp.index);
1822 export_to = instance;
1827 desc.set_value(handle(instance->tables().get(exp.index), isolate_));
1834 DCHECK(instance->has_memory_object());
1836 Handle<WasmMemoryObject>(instance->memory_object(), isolate_));
1854 instance->imported_mutable_globals_buffers(), isolate_);
1860 Address addr = instance->imported_mutable_globals()[global.index];
1869 instance->imported_mutable_globals()[global.index];
1880 tagged_buffer = handle(instance->tagged_globals_buffer(), isolate_);
1883 handle(instance->untagged_globals_buffer(), isolate_);
1891 WasmGlobalObject::New(isolate_, instance, untagged_buffer,
1903 HeapObject::cast(instance->tags_table().get(exp.index)),
1936 Handle<WasmInstanceObject> instance,
1940 const WasmModule* module = instance->module();
1943 WasmInstanceObject::GetWasmInternalFunction(isolate, instance,
1949 isolate, table_object, entry_index, instance, func_index);
1955 function, *instance);
1967 Handle<WasmInstanceObject> instance) {
1973 WasmTableObject::cast(instance->tables().get(table_index)), isolate_);
1979 SetFunctionTablePlaceholder(isolate_, instance, table_object,
1991 table.type, isolate_, instance, thrower_);
2005 Handle<WasmInstanceObject> instance,
2009 DCHECK_LT(segment_index, instance->module()->elem_segments.size());
2010 auto& elem_segment = instance->module()->elem_segments[segment_index];
2017 instance->dropped_elem_segments()[segment_index] == 0
2024 IsSubtypeOf(table_object->type(), kWasmFuncRef, instance->module());
2032 SetFunctionTablePlaceholder(isolate, instance, table_object, entry_index,
2039 isolate, instance, &thrower);
2048 void InstanceBuilder::LoadTableSegments(Handle<WasmInstanceObject> instance) {
2051 auto& elem_segment = instance->module()->elem_segments[segment_index];
2058 isolate_, instance, thrower_)
2065 &init_expr_zone_, isolate_, instance,
2067 instance->tables().get(elem_segment.table_index)),
2072 instance->dropped_elem_segments()[segment_index] = 1;
2080 void InstanceBuilder::InitializeTags(Handle<WasmInstanceObject> instance) {
2081 Handle<FixedArray> tags_table(instance->tags_table(), isolate_);
2089 bool LoadElemSegment(Isolate* isolate, Handle<WasmInstanceObject> instance,
2098 &zone, isolate, instance,
2099 handle(WasmTableObject::cast(instance->tables().get(table_index)),