v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
setup-builtins-internal.cc
Go to the documentation of this file.
1// Copyright 2017 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <fstream>
6
15#include "src/common/globals.h"
23#include "src/heap/heap-inl.h"
30#include "src/objects/smi.h"
31
32#if V8_ENABLE_WEBASSEMBLY
34#endif
35
36namespace v8 {
37namespace internal {
38
39// Forward declarations for C++ builtins.
40#define FORWARD_DECLARE(Name, Argc) \
41 Address Builtin_##Name(int argc, Address* args, Isolate* isolate);
43#undef FORWARD_DECLARE
44
45namespace {
46
47using BuiltinCompilationScheduler =
48 compiler::CodeAssembler::BuiltinCompilationScheduler;
49
50const int kBufferSize = 128 * KB;
51
52AssemblerOptions BuiltinAssemblerOptions(Isolate* isolate, Builtin builtin) {
53 AssemblerOptions options = AssemblerOptions::Default(isolate);
54 CHECK(!options.isolate_independent_code);
55 CHECK(!options.collect_win64_unwind_info);
56
57#if V8_ENABLE_WEBASSEMBLY
59 builtin == Builtin::kJSToWasmWrapper ||
60 builtin == Builtin::kJSToWasmHandleReturns ||
61 builtin == Builtin::kWasmToJsWrapperCSA) {
62 options.is_wasm = true;
63 }
64#endif
65 if (!isolate->IsGeneratingEmbeddedBuiltins()) {
66 return options;
67 }
68
69 const base::AddressRegion& code_region = isolate->heap()->code_region();
70 bool pc_relative_calls_fit_in_code_range =
71 !code_region.is_empty() &&
72 std::ceil(static_cast<float>(code_region.size() / MB)) <=
74
75 // Mksnapshot ensures that the code range is small enough to guarantee that
76 // PC-relative call/jump instructions can be used for builtin to builtin
77 // calls/tail calls. The embedded builtins blob generator also ensures that.
78 // However, there are serializer tests, where we force isolate creation at
79 // runtime and at this point, Code space isn't restricted to a
80 // size s.t. PC-relative calls may be used. So, we fall back to an indirect
81 // mode.
82 options.use_pc_relative_calls_and_jumps_for_mksnapshot =
83 pc_relative_calls_fit_in_code_range;
84
85 options.builtin_call_jump_mode = BuiltinCallJumpMode::kForMksnapshot;
86 options.isolate_independent_code = true;
87 options.collect_win64_unwind_info = true;
88
89 if (builtin == Builtin::kInterpreterEntryTrampolineForProfiling) {
90 // InterpreterEntryTrampolineForProfiling must be generated in a position
91 // independent way because it might be necessary to create a copy of the
92 // builtin in the code space if the v8_flags.interpreted_frames_native_stack
93 // is enabled.
94 options.builtin_call_jump_mode = BuiltinCallJumpMode::kIndirect;
95 }
96
97 return options;
98}
99
100using MacroAssemblerGenerator = void (*)(MacroAssembler*);
102 void (*)(compiler::turboshaft::PipelineData*, Isolate*,
103 compiler::turboshaft::Graph&, Zone*);
104using CodeAssemblerGenerator = compiler::Pipeline::CodeAssemblerGenerator;
105using CodeAssemblerInstaller = compiler::Pipeline::CodeAssemblerInstaller;
106
107DirectHandle<Code> BuildPlaceholder(Isolate* isolate, Builtin builtin) {
108 HandleScope scope(isolate);
109 uint8_t buffer[kBufferSize];
110 MacroAssembler masm(isolate, CodeObjectRequired::kYes,
111 ExternalAssemblerBuffer(buffer, kBufferSize));
112 DCHECK(!masm.has_frame());
113 {
114 FrameScope frame_scope(&masm, StackFrame::NO_FRAME_TYPE);
115 // The contents of placeholder don't matter, as long as they don't create
116 // embedded constants or external references.
119 }
120 CodeDesc desc;
121 masm.GetCode(isolate, &desc);
122 Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
123 .set_self_reference(masm.CodeObject())
124 .set_builtin(builtin)
125 .Build();
126 return scope.CloseAndEscape(code);
127}
128
129V8_NOINLINE Tagged<Code> BuildWithMacroAssembler(
130 Isolate* isolate, Builtin builtin, MacroAssemblerGenerator generator,
131 const char* s_name) {
132 HandleScope scope(isolate);
133 uint8_t buffer[kBufferSize];
134
135 MacroAssembler masm(isolate, BuiltinAssemblerOptions(isolate, builtin),
137 ExternalAssemblerBuffer(buffer, kBufferSize));
138 masm.set_builtin(builtin);
139 DCHECK(!masm.has_frame());
140 masm.CodeEntry();
141 generator(&masm);
142
143 int handler_table_offset = 0;
144
145 // JSEntry builtins are a special case and need to generate a handler table.
146 DCHECK_EQ(Builtins::KindOf(Builtin::kJSEntry), Builtins::ASM);
147 DCHECK_EQ(Builtins::KindOf(Builtin::kJSConstructEntry), Builtins::ASM);
148 DCHECK_EQ(Builtins::KindOf(Builtin::kJSRunMicrotasksEntry), Builtins::ASM);
149 if (Builtins::IsJSEntryVariant(builtin)) {
150 handler_table_offset = HandlerTable::EmitReturnTableStart(&masm);
152 &masm, 0, isolate->builtins()->js_entry_handler_offset());
153#if V8_ENABLE_DRUMBRAKE
154 } else if (builtin == Builtin::kWasmInterpreterCWasmEntry) {
155 handler_table_offset = HandlerTable::EmitReturnTableStart(&masm);
157 &masm, 0,
158 isolate->builtins()->cwasm_interpreter_entry_handler_offset());
159#endif // V8_ENABLE_DRUMBRAKE
160 }
161#if V8_ENABLE_WEBASSEMBLY && \
162 (V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_IA32 || \
163 V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_LOONG64 || \
164 V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_S390X || V8_TARGET_ARCH_RISCV32)
165 if (builtin == Builtin::kWasmReturnPromiseOnSuspendAsm) {
166 handler_table_offset = HandlerTable::EmitReturnTableStart(&masm);
168 &masm, 0, isolate->builtins()->jspi_prompt_handler_offset());
169 }
170#endif
171
172 CodeDesc desc;
173 masm.GetCode(isolate->main_thread_local_isolate(), &desc,
174 MacroAssembler::kNoSafepointTable, handler_table_offset);
175
176 DirectHandle<Code> code =
177 Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
178 .set_self_reference(masm.CodeObject())
179 .set_builtin(builtin)
180 .Build();
181#if defined(V8_OS_WIN64)
182 isolate->SetBuiltinUnwindData(builtin, masm.GetUnwindInfo());
183#endif // V8_OS_WIN64
184 return *code;
185}
186
187Tagged<Code> BuildAdaptor(Isolate* isolate, Builtin builtin,
188 Address builtin_address, const char* name) {
189 HandleScope scope(isolate);
190 uint8_t buffer[kBufferSize];
191 MacroAssembler masm(isolate, BuiltinAssemblerOptions(isolate, builtin),
193 ExternalAssemblerBuffer(buffer, kBufferSize));
194 masm.set_builtin(builtin);
195 DCHECK(!masm.has_frame());
196 int formal_parameter_count = Builtins::GetFormalParameterCount(builtin);
197 Builtins::Generate_Adaptor(&masm, formal_parameter_count, builtin_address);
198 CodeDesc desc;
199 masm.GetCode(isolate, &desc);
200 DirectHandle<Code> code =
201 Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
202 .set_self_reference(masm.CodeObject())
203 .set_builtin(builtin)
204 .set_parameter_count(formal_parameter_count)
205 .Build();
206 return *code;
207}
208
209// Builder for builtins implemented in Turboshaft with JS linkage.
210V8_NOINLINE Tagged<Code> BuildWithTurboshaftAssemblerJS(
211 Isolate* isolate, Builtin builtin,
213 const char* name) {
214 HandleScope scope(isolate);
215 DirectHandle<Code> code =
217 isolate, builtin, generator,
218 [argc](Zone* zone) {
220 zone, false, argc, compiler::CallDescriptor::kCanUseRoots);
221 },
222 name, BuiltinAssemblerOptions(isolate, builtin));
223 return *code;
224}
225
226void CompileJSLinkageCodeStubBuiltin(Isolate* isolate, Builtin builtin,
227 CodeAssemblerGenerator generator,
228 CodeAssemblerInstaller installer, int argc,
229 const char* name, int finalize_order,
230 BuiltinCompilationScheduler& scheduler) {
231 // TODO(nicohartmann): Remove this once `BuildWithTurboshaftAssemblerJS` has
232 // an actual use.
233 USE(&BuildWithTurboshaftAssemblerJS);
234 std::unique_ptr<TurbofanCompilationJob> job(
236 isolate, builtin, generator, installer,
237 BuiltinAssemblerOptions(isolate, builtin), argc, name,
238 ProfileDataFromFile::TryRead(name), finalize_order));
239 scheduler.CompileCode(isolate, std::move(job));
240}
241
242// Builder for builtins implemented in Turboshaft with CallStub linkage.
243V8_NOINLINE Tagged<Code> BuildWithTurboshaftAssemblerCS(
244 Isolate* isolate, Builtin builtin,
246 CallDescriptors::Key interface_descriptor, const char* name) {
247 HandleScope scope(isolate);
248 DirectHandle<Code> code =
250 isolate, builtin, generator,
251 [interface_descriptor](Zone* zone) {
252 CallInterfaceDescriptor descriptor(interface_descriptor);
253 DCHECK_LE(0, descriptor.GetRegisterParameterCount());
255 zone, descriptor, descriptor.GetStackParameterCount(),
258 },
259 name, BuiltinAssemblerOptions(isolate, builtin));
260 return *code;
261}
262
263// Builder for builtins implemented in TurboFan with CallStub linkage.
264void CompileCSLinkageCodeStubBuiltin(Isolate* isolate, Builtin builtin,
265 CodeAssemblerGenerator generator,
266 CodeAssemblerInstaller installer,
267 CallDescriptors::Key interface_descriptor,
268 const char* name, int finalize_order,
269 BuiltinCompilationScheduler& scheduler) {
270 // TODO(nicohartmann): Remove this once `BuildWithTurboshaftAssemblerCS` has
271 // an actual use.
272 USE(&BuildWithTurboshaftAssemblerCS);
273 std::unique_ptr<TurbofanCompilationJob> job(
275 isolate, builtin, generator, installer,
276 BuiltinAssemblerOptions(isolate, builtin), interface_descriptor, name,
277 ProfileDataFromFile::TryRead(name), finalize_order));
278 scheduler.CompileCode(isolate, std::move(job));
279}
280
281void CompileBytecodeHandler(
282 Isolate* isolate, Builtin builtin, interpreter::OperandScale operand_scale,
283 interpreter::Bytecode bytecode,
284 compiler::Pipeline::CodeAssemblerInstaller installer, int finalize_order,
285 BuiltinCompilationScheduler& scheduler) {
286 DCHECK(interpreter::Bytecodes::BytecodeHasHandler(bytecode, operand_scale));
287 const char* name = Builtins::name(builtin);
288 auto generator = [bytecode,
289 operand_scale](compiler::CodeAssemblerState* state) {
290 interpreter::GenerateBytecodeHandler(state, bytecode, operand_scale);
291 };
292 std::unique_ptr<TurbofanCompilationJob> job(
294 isolate, builtin, generator, installer,
295 BuiltinAssemblerOptions(isolate, builtin), name,
296 ProfileDataFromFile::TryRead(name), finalize_order));
297 scheduler.CompileCode(isolate, std::move(job));
298}
299
300} // anonymous namespace
301
302// static
304 Tagged<Code> code) {
305 DCHECK_EQ(builtin, code->builtin_id());
306 builtins->set_code(builtin, code);
307}
308
309// static
311 // Fill the builtins list with placeholders. References to these placeholder
312 // builtins are eventually replaced by the actual builtins. This is to
313 // support circular references between builtins.
314 Builtins* builtins = isolate->builtins();
315 HandleScope scope(isolate);
316 for (Builtin builtin = Builtins::kFirst; builtin <= Builtins::kLast;
317 ++builtin) {
318 DirectHandle<Code> placeholder = BuildPlaceholder(isolate, builtin);
319 AddBuiltin(builtins, builtin, *placeholder);
320 }
321}
322
323// static
325 // Replace references from all builtin code objects to placeholders.
326 Builtins* builtins = isolate->builtins();
328 static const int kRelocMask =
333 PtrComprCageBase cage_base(isolate);
334 for (Builtin builtin = Builtins::kFirst; builtin <= Builtins::kLast;
335 ++builtin) {
336 Tagged<Code> code = builtins->code(builtin);
337 Tagged<InstructionStream> istream = code->instruction_stream();
339 istream.address(), istream->Size(),
341 bool flush_icache = false;
342 for (WritableRelocIterator it(jit_allocation, istream,
343 code->constant_pool(), kRelocMask);
344 !it.done(); it.next()) {
345 WritableRelocInfo* rinfo = it.rinfo();
346 if (RelocInfo::IsCodeTargetMode(rinfo->rmode())) {
347 Tagged<Code> target_code =
351 Builtins::IsIsolateIndependent(target_code->builtin_id()));
352 if (!target_code->is_builtin()) continue;
353 Tagged<Code> new_target = builtins->code(target_code->builtin_id());
354 rinfo->set_target_address(istream, new_target->instruction_start(),
356 } else {
358 Tagged<Object> object = rinfo->target_object(cage_base);
359 if (!IsCode(object, cage_base)) continue;
360 Tagged<Code> target = Cast<Code>(object);
361 if (!target->is_builtin()) continue;
362 Tagged<Code> new_target = builtins->code(target->builtin_id());
365 }
366 flush_icache = true;
367 }
368 if (flush_icache) {
369 FlushInstructionCache(code->instruction_start(),
370 code->instruction_size());
371 }
372 }
373}
374
375// static
377 Builtins* builtins = isolate->builtins();
378 DCHECK(!builtins->initialized_);
379
380 if (v8_flags.dump_builtins_hashes_to_file) {
381 // Create an empty file.
382 std::ofstream(v8_flags.dump_builtins_hashes_to_file, std::ios_base::trunc);
383 }
384
386
387 // Create a scope for the handles in the builtins.
388 HandleScope scope(isolate);
389
390 // Generated builtins are temporarily stored in this array to avoid data races
391 // on the isolate's builtin table.
392 std::array<Handle<Code>, Builtins::kBuiltinCount> generated_builtins;
393 auto install_generated_builtin = [&generated_builtins, isolate](
395 DCHECK_EQ(ThreadId::Current(), isolate->thread_id());
396 USE(isolate);
397 generated_builtins[Builtins::ToInt(builtin)] = code;
398 };
399
400 int builtins_built_without_job_count = 0;
401 int job_creation_order = 0;
402 BuiltinCompilationScheduler scheduler;
404
405#define BUILD_CPP_WITHOUT_JOB(Name, Argc) \
406 code = BuildAdaptor(isolate, Builtin::k##Name, \
407 FUNCTION_ADDR(Builtin_##Name), #Name); \
408 generated_builtins[Builtins::ToInt(Builtin::k##Name)] = \
409 handle(code, isolate); \
410 builtins_built_without_job_count++;
411
412#define BUILD_TSJ_WITHOUT_JOB(Name, Argc, ...) \
413 code = BuildWithTurboshaftAssemblerJS( \
414 isolate, Builtin::k##Name, &Builtins::Generate_##Name, Argc, #Name); \
415 AddBuiltin(builtins, Builtin::k##Name, code); \
416 builtins_built_without_job_count++;
417
418#define BUILD_TFJ_WITH_JOB(Name, Argc, ...) \
419 CompileJSLinkageCodeStubBuiltin(isolate, Builtin::k##Name, \
420 &Builtins::Generate_##Name, \
421 install_generated_builtin, Argc, #Name, \
422 job_creation_order++, scheduler);
423
424#define BUILD_TSC_WITHOUT_JOB(Name, InterfaceDescriptor) \
425 /* Return size is from the provided CallInterfaceDescriptor. */ \
426 code = BuildWithTurboshaftAssemblerCS( \
427 isolate, Builtin::k##Name, &Builtins::Generate_##Name, \
428 CallDescriptors::InterfaceDescriptor, #Name); \
429 generated_builtins[Builtins::ToInt(Builtin::k##Name)] = \
430 handle(code, isolate); \
431 builtins_built_without_job_count++;
432
433#define BUILD_TFC_WITH_JOB(Name, InterfaceDescriptor) \
434 /* Return size is from the provided CallInterfaceDescriptor. */ \
435 CompileCSLinkageCodeStubBuiltin( \
436 isolate, Builtin::k##Name, &Builtins::Generate_##Name, \
437 install_generated_builtin, CallDescriptors::InterfaceDescriptor, #Name, \
438 job_creation_order++, scheduler);
439
440#define BUILD_TFS_WITH_JOB(Name, ...) \
441 /* Return size for generic TF builtins (stub linkage) is always 1. */ \
442 CompileCSLinkageCodeStubBuiltin( \
443 isolate, Builtin::k##Name, &Builtins::Generate_##Name, \
444 install_generated_builtin, CallDescriptors::Name, #Name, \
445 job_creation_order++, scheduler);
446
447#define BUILD_TFH_WITH_JOB(Name, InterfaceDescriptor) \
448 /* Return size for IC builtins/handlers is always 1. */ \
449 CompileCSLinkageCodeStubBuiltin( \
450 isolate, Builtin::k##Name, &Builtins::Generate_##Name, \
451 install_generated_builtin, CallDescriptors::InterfaceDescriptor, #Name, \
452 job_creation_order++, scheduler);
453
454#define BUILD_BCH_WITH_JOB(Name, OperandScale, Bytecode) \
455 CompileBytecodeHandler(isolate, Builtin::k##Name, OperandScale, Bytecode, \
456 install_generated_builtin, job_creation_order++, \
457 scheduler);
458
459#define BUILD_ASM_WITHOUT_JOB(Name, InterfaceDescriptor) \
460 code = BuildWithMacroAssembler(isolate, Builtin::k##Name, \
461 Builtins::Generate_##Name, #Name); \
462 generated_builtins[Builtins::ToInt(Builtin::k##Name)] = \
463 handle(code, isolate); \
464 builtins_built_without_job_count++;
465
466#define NOP(...)
467
468 // Build all builtins without jobs first. When concurrent builtin generation
469 // is enabled, allocations needs to be deterministic. Having main-thread
470 // generated builtins in the middle of the list breaks determinism.
476
477#undef BUILD_CPP_WITHOUT_JOB
478#undef BUILD_TSJ_WITHOUT_JOB
479#undef BUILD_TFJ_WITH_JOB
480#undef BUILD_TSC_WITHOUT_JOB
481#undef BUILD_TFC_WITH_JOB
482#undef BUILD_TFS_WITH_JOB
483#undef BUILD_TFH_WITH_JOB
484#undef BUILD_BCH_WITH_JOB
485#undef BUILD_ASM_WITHOUT_JOB
486#undef NOP
487
488 scheduler.AwaitAndFinalizeCurrentBatch(isolate);
489 CHECK_EQ(Builtins::kBuiltinCount, builtins_built_without_job_count +
490 scheduler.builtins_installed_count());
491
492 // Add the generated builtins to the isolate.
493 for (Builtin builtin = Builtins::kFirst; builtin <= Builtins::kLast;
494 ++builtin) {
495 AddBuiltin(builtins, builtin,
496 *generated_builtins[Builtins::ToInt(builtin)]);
497 }
498
499 ReplacePlaceholders(isolate);
500
501 builtins->MarkInitialized();
502}
503
504} // namespace internal
505} // namespace v8
friend Zone
Definition asm-types.cc:195
#define BUILTIN_LIST_C(V)
interpreter::Bytecode bytecode
Definition builtins.cc:43
#define FORWARD_DECLARE(Name, Argc)
Definition builtins.cc:30
static constexpr SafepointTableBuilderBase * kNoSafepointTable
static V8_EXPORT_PRIVATE Kind KindOf(Builtin builtin)
Definition builtins.cc:471
static constexpr bool IsJSEntryVariant(Builtin builtin)
static constexpr int kBuiltinCount
Definition builtins.h:105
static constexpr Builtin kFirst
Definition builtins.h:112
static int GetFormalParameterCount(Builtin builtin)
static void Generate_Adaptor(MacroAssembler *masm, int formal_parameter_count, Address builtin_address)
static constexpr bool IsIsolateIndependent(Builtin builtin)
Definition builtins.h:266
static constexpr int ToInt(Builtin id)
Definition builtins.h:144
static constexpr Builtin kLast
Definition builtins.h:113
static V8_EXPORT_PRIVATE const char * name(Builtin builtin)
Definition builtins.cc:226
static Tagged< Code > FromTargetAddress(Address address)
Definition code-inl.h:671
static void EmitReturnEntry(Assembler *masm, int offset, int handler)
static int EmitReturnTableStart(Assembler *masm)
static const ProfileDataFromFile * TryRead(const char *name)
static constexpr bool IsRelativeCodeTarget(Mode mode)
Definition reloc-info.h:200
static constexpr bool IsCodeTargetMode(Mode mode)
Definition reloc-info.h:197
static constexpr int ModeMask(Mode mode)
Definition reloc-info.h:272
V8_INLINE Address target_address()
static constexpr bool IsEmbeddedObjectMode(Mode mode)
Definition reloc-info.h:209
V8_INLINE Tagged< HeapObject > target_object(PtrComprCageBase cage_base)
static void SetupBuiltinsInternal(Isolate *isolate)
static void ReplacePlaceholders(Isolate *isolate)
static void PopulateWithPlaceholders(Isolate *isolate)
static void AddBuiltin(Builtins *builtins, Builtin builtin, Tagged< Code > code)
static constexpr Tagged< Smi > zero()
Definition smi.h:99
static ThreadId Current()
Definition thread-id.h:32
static WritableJitAllocation LookupJitAllocation(Address addr, size_t size, JitAllocationType type, bool enforce_write_api=false)
V8_INLINE void set_target_object(Tagged< InstructionStream > host, Tagged< HeapObject > target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
void set_target_address(Tagged< InstructionStream > host, Address target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
static CallDescriptor * GetStubCallDescriptor(Zone *zone, const CallInterfaceDescriptor &descriptor, int stack_parameter_count, CallDescriptor::Flags flags, Operator::Properties properties=Operator::kNoProperties, StubCallMode stub_mode=StubCallMode::kCallCodeObject)
Definition linkage.cc:587
static CallDescriptor * GetJSCallDescriptor(Zone *zone, bool is_osr, int parameter_count, CallDescriptor::Flags flags, Operator::Properties properties=Operator::kNoProperties)
Definition linkage.cc:507
static std::unique_ptr< TurbofanCompilationJob > NewBytecodeHandlerCompilationJob(Isolate *isolate, Builtin builtin, CodeAssemblerGenerator generator, CodeAssemblerInstaller installer, const AssemblerOptions &assembler_options, const char *name, const ProfileDataFromFile *profile_data, int finalize_order)
Definition pipeline.cc:2487
std::function< void(Builtin builtin, Handle< Code > code)> CodeAssemblerInstaller
Definition pipeline.h:77
static std::unique_ptr< TurbofanCompilationJob > NewCSLinkageCodeStubBuiltinCompilationJob(Isolate *isolate, Builtin builtin, CodeAssemblerGenerator generator, CodeAssemblerInstaller installer, const AssemblerOptions &assembler_options, CallDescriptors::Key interface_descriptor, const char *name, const ProfileDataFromFile *profile_data, int finalize_order)
Definition pipeline.cc:2448
std::function< void(compiler::CodeAssemblerState *)> CodeAssemblerGenerator
Definition pipeline.h:75
static std::unique_ptr< TurbofanCompilationJob > NewJSLinkageCodeStubBuiltinCompilationJob(Isolate *isolate, Builtin builtin, CodeAssemblerGenerator generator, CodeAssemblerInstaller installer, const AssemblerOptions &assembler_options, int argc, const char *name, const ProfileDataFromFile *profile_data, int finalize_order)
Definition pipeline.cc:2470
static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale)
Definition bytecodes.cc:333
static bool IsWasmBuiltinId(Builtin id)
Handle< Code > code
DirectHandle< Object > new_target
Definition execution.cc:75
Isolate * isolate
DirectHandle< JSReceiver > options
Builtin builtin
LiftoffAssembler::CacheState state
DirectHandle< Code > BuildWithTurboshaftAssemblerImpl(Isolate *isolate, Builtin builtin, TurboshaftAssemblerGenerator generator, std::function< compiler::CallDescriptor *(Zone *)> call_descriptor_builder, const char *name, const AssemblerOptions &options, CodeKind code_kind, std::optional< BytecodeHandlerData > bytecode_handler_data)
void(*)(compiler::turboshaft::PipelineData *, Isolate *, compiler::turboshaft::Graph &, Zone *) TurboshaftAssemblerGenerator
void GenerateBytecodeHandler(compiler::CodeAssemblerState *state, Bytecode bytecode, OperandScale operand_scale)
@ UPDATE_WRITE_BARRIER
Definition objects.h:55
Tagged(T object) -> Tagged< T >
void FlushInstructionCache(void *start, size_t size)
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
Definition flags.cc:2086
refactor address components for immediate indexing make OptimizeMaglevOnNextCall optimize to turbofan instead of maglev filter for tracing turbofan compilation trace turbo cfg trace TurboFan s graph trimmer trace TurboFan s control equivalence trace TurboFan s register allocator trace stack load store counters for optimized code in run fuzzing &&concurrent_recompilation trace_turbo trace_turbo_scheduled trace_turbo_stack_accesses verify TurboFan machine graph of code stubs enable FixedArray bounds checks print TurboFan statistics of wasm compilations maximum cumulative size of bytecode considered for inlining scale factor of bytecode size used to calculate the inlining budget * KB
Definition flags.cc:1366
constexpr size_t kMaxPCRelativeCodeRangeInMB
V8_EXPORT_PRIVATE FlagValues v8_flags
constexpr Register kJavaScriptCallCodeStartRegister
std::unique_ptr< AssemblerBuffer > ExternalAssemblerBuffer(void *start, int size)
Definition assembler.cc:161
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
Local< T > Handle
#define BUILD_TFJ_WITH_JOB(Name, Argc,...)
#define BUILD_TSJ_WITHOUT_JOB(Name, Argc,...)
#define BUILD_BCH_WITH_JOB(Name, OperandScale, Bytecode)
#define BUILD_TFC_WITH_JOB(Name, InterfaceDescriptor)
#define BUILD_TSC_WITHOUT_JOB(Name, InterfaceDescriptor)
#define BUILD_ASM_WITHOUT_JOB(Name, InterfaceDescriptor)
#define BUILD_CPP_WITHOUT_JOB(Name, Argc)
#define BUILD_TFH_WITH_JOB(Name, InterfaceDescriptor)
#define BUILD_TFS_WITH_JOB(Name,...)
#define DCHECK_LE(v1, v2)
Definition logging.h:490
#define CHECK(condition)
Definition logging.h:124
#define DCHECK_IMPLIES(v1, v2)
Definition logging.h:493
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define USE(...)
Definition macros.h:293
static AssemblerOptions Default(Isolate *isolate)
Definition assembler.cc:53
#define V8_NOINLINE
Definition v8config.h:586