174 {
176 auto object_store = thread->isolate_group()->object_store();
177 Zone* zone = thread->zone();
181 switch (cls.id()) {
182 case kArrayCid:
183 return object_store->allocate_array_stub();
184#if !defined(TARGET_ARCH_IA32)
185 case kGrowableObjectArrayCid:
186 return object_store->allocate_growable_array_stub();
187#endif
188 case kContextCid:
189 return object_store->allocate_context_stub();
190 case kUnhandledExceptionCid:
191 return object_store->allocate_unhandled_exception_stub();
192 case kMintCid:
193 return object_store->allocate_mint_stub();
194 case kDoubleCid:
195 return object_store->allocate_double_stub();
196 case kFloat32x4Cid:
197 return object_store->allocate_float32x4_stub();
198 case kFloat64x2Cid:
199 return object_store->allocate_float64x2_stub();
200 case kInt32x4Cid:
201 return object_store->allocate_int32x4_stub();
202 case kClosureCid:
203 return object_store->allocate_closure_stub();
204 case kRecordCid:
205 return object_store->allocate_record_stub();
206 }
208 if (stub.IsNull()) {
209 compiler::ObjectPoolBuilder object_pool_builder;
211
212 compiler::ObjectPoolBuilder* wrapper =
213 precompiler != nullptr ? precompiler->global_object_pool_builder()
214 : &object_pool_builder;
215
216 const auto pool_attachment = FLAG_precompiled_mode
219
220 auto zone = thread->zone();
221 auto object_store = thread->isolate_group()->object_store();
224 if (FLAG_precompiled_mode) {
225 allocate_object_stub = object_store->allocate_object_stub();
226 allocate_object_parametrized_stub =
227 object_store->allocate_object_parametrized_stub();
228 }
229
230 compiler::Assembler assembler(wrapper);
231 CompilerState compiler_state(thread, FLAG_precompiled_mode,
232 false);
234 const char*
name = cls.ToCString();
235 compiler::StubCodeCompiler stubCodeCompiler(&assembler, nullptr);
236 stubCodeCompiler.GenerateAllocationStubForClass(
237 &unresolved_calls, cls, allocate_object_stub,
238 allocate_object_parametrized_stub);
239
240 const auto& static_calls_table =
242 zone, &unresolved_calls));
243
244 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
245
246 auto mutator_fun = [&]() {
248 false,
249 nullptr);
250
252 stub.set_owner(cls);
253 if (!static_calls_table.IsNull()) {
254 stub.set_static_calls_target_table(static_calls_table);
255 }
256 cls.set_allocation_stub(stub);
257 }
258 };
259
260
261
262
263
264 thread->isolate_group()->RunWithStoppedMutators(mutator_fun,
265 true);
266
267
268
270#ifndef PRODUCT
271 if (FLAG_support_disassembler && FLAG_disassemble_stubs) {
273 }
274#endif
275 }
276 return stub.ptr();
277}
static void NotifyCodeObservers(const Code &code, bool optimized)
static CodePtr FinalizeCode(FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized, CodeStatistics *stats)
static Object & ZoneHandle()
static Precompiler * Instance()
static ArrayPtr BuildStaticCallsTable(Zone *zone, compiler::UnresolvedPcRelativeCalls *unresolved_calls)
const uint8_t uint32_t uint32_t GError ** error
GrowableArray< UnresolvedPcRelativeCall * > UnresolvedPcRelativeCalls