17#if V8_ENABLE_WEBASSEMBLY
28 : isolate_unsafe_(isolate),
29 code_kind_(code_kind),
30 osr_offset_(osr_offset),
32 optimization_id_(isolate->NextOptimizationId()) {
34 DCHECK(shared->is_compiled());
45 if (isolate->NeedsDetailedOptimizedCodeLineInfo()) {
49 set_source_positions();
56 if (isolate->node_observer()) {
64 : isolate_unsafe_(nullptr),
65 code_kind_(code_kind),
68 optimization_id_(kNoOptimizationId),
69 debug_name_(debug_name) {
80 if (
v8_flags.turbo_inline_js_wasm_calls) set_inline_js_wasm_calls();
83 set_shadow_stack_compliant_lazy_deopt();
87 case CodeKind::TURBOFAN_JS:
88 set_called_with_code_start_register();
89 set_switch_jump_table();
90 if (
v8_flags.analyze_environment_liveness) {
91 set_analyze_environment_liveness();
93 if (
v8_flags.turbo_splitting) set_splitting();
95 case CodeKind::BYTECODE_HANDLER:
96 set_called_with_code_start_register();
97 if (
v8_flags.turbo_splitting) set_splitting();
98 if (
v8_flags.enable_allocation_folding) set_allocation_folding();
100 case CodeKind::BUILTIN:
101#ifdef V8_ENABLE_BUILTIN_JUMP_TABLE_SWITCH
102 set_switch_jump_table();
105 case CodeKind::FOR_TESTING:
106 if (
v8_flags.turbo_splitting) set_splitting();
107 if (
v8_flags.enable_allocation_folding) set_allocation_folding();
108#if ENABLE_GDB_JIT_INTERFACE && DEBUG
109 set_source_positions();
112 case CodeKind::WASM_FUNCTION:
113 case CodeKind::WASM_TO_CAPI_FUNCTION:
114 set_switch_jump_table();
116 case CodeKind::C_WASM_ENTRY:
117 case CodeKind::JS_TO_WASM_FUNCTION:
118 case CodeKind::WASM_TO_JS_FUNCTION:
120 case CodeKind::BASELINE:
121 case CodeKind::MAGLEV:
122 case CodeKind::INTERPRETED_FUNCTION:
123 case CodeKind::REGEXP:
150 DCHECK_NE(reason, BailoutReason::kNoReason);
154 set_disable_future_optimization();
158 DCHECK_NE(reason, BailoutReason::kNoReason);
159 if (disable_future_optimization())
return;
169 std::unique_ptr<char[]>
name(
new char[name_vec.
length() + 1]);
170 memcpy(name.get(), name_vec.
begin(), name_vec.
length());
171 name[name_vec.
length()] =
'\0';
177 case CodeKind::FOR_TESTING:
178 case CodeKind::BYTECODE_HANDLER:
179 case CodeKind::BUILTIN:
180 return StackFrame::STUB;
181#if V8_ENABLE_WEBASSEMBLY
182 case CodeKind::WASM_FUNCTION:
183 return StackFrame::WASM;
184 case CodeKind::WASM_TO_CAPI_FUNCTION:
185 return StackFrame::WASM_EXIT;
186 case CodeKind::JS_TO_WASM_FUNCTION:
187 return StackFrame::JS_TO_WASM;
188 case CodeKind::WASM_TO_JS_FUNCTION:
189 return StackFrame::WASM_TO_JS;
190 case CodeKind::C_WASM_ENTRY:
191 return StackFrame::C_WASM_ENTRY;
213 return !
closure().is_null() && !
closure()->native_context().is_null();
218 return closure()->native_context();
240 if (!passes_filter)
return;
241 if (
v8_flags.trace_turbo) set_trace_turbo_json();
242 if (
v8_flags.trace_turbo_graph) set_trace_turbo_graph();
243 if (
v8_flags.trace_turbo_scheduled) set_trace_turbo_scheduled();
244 if (
v8_flags.trace_turbo_alloc) set_trace_turbo_allocation();
245 if (
v8_flags.trace_heap_broker) set_trace_heap_broker();
246 if (
v8_flags.turboshaft_trace_reduction) set_turboshaft_trace_reduction();
256 : shared_info(inlined_shared_info), bytecode_array(inlined_bytecode) {
constexpr bool empty() const
constexpr T * begin() const
static const int kNotInlinedIndex
~OptimizedCompilationInfo()
bool has_global_object() const
bool IsOptimizing() const
StackFrame::Type GetOutputStackFrameType() const
IndirectHandle< Code > code() const
bool has_native_context() const
IndirectHandle< SharedFunctionInfo > shared_info_
Isolate *const isolate_unsafe_
Tagged< NativeContext > native_context() const
void AbortOptimization(BailoutReason reason)
int AddInlinedFunction(IndirectHandle< SharedFunctionInfo > inlined_function, IndirectHandle< BytecodeArray > inlined_bytecode, SourcePosition pos)
IndirectHandle< SharedFunctionInfo > shared_info() const
CodeKind code_kind() const
Tagged< JSGlobalObject > global_object() const
IndirectHandle< BytecodeArray > bytecode_array_
std::unique_ptr< CanonicalHandlesMap > canonical_handles_
IndirectHandle< Code > code_
std::unique_ptr< char[]> GetDebugName() const
void SetTracingFlags(bool passes_filter)
void SetCode(IndirectHandle< Code > code)
IndirectHandle< JSFunction > closure() const
void SetNodeObserver(compiler::NodeObserver *observer)
bool has_shared_info() const
base::Vector< const char > debug_name_
BailoutReason bailout_reason_
InlinedFunctionList inlined_functions_
void RetryOptimization(BailoutReason reason)
const CodeKind code_kind_
IndirectHandle< T > CanonicalHandle(Tagged< T > object, Isolate *isolate)
IndirectHandle< JSFunction > closure_
void ReopenAndCanonicalizeHandlesInNewScope(Isolate *isolate)
OptimizedCompilationInfo(Zone *zone, Isolate *isolate, IndirectHandle< SharedFunctionInfo > shared, IndirectHandle< JSFunction > closure, CodeKind code_kind, BytecodeOffset osr_offset)
std::atomic< bool > was_cancelled_
Tagged< Context > context() const
BailoutReason bailout_reason() const
SharedFunctionInfoRef shared
constexpr Vector< T > ArrayVector(T(&arr)[N])
Vector< const char > CStrVector(const char *data)
V8_INLINE IndirectHandle< T > 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
bool PassesFilter(base::Vector< const char > name, base::Vector< const char > filter)
V8_EXPORT_PRIVATE FlagValues v8_flags
#define DCHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
InlinedFunctionHolder(IndirectHandle< SharedFunctionInfo > inlined_shared_info, IndirectHandle< BytecodeArray > inlined_bytecode, SourcePosition pos)
InliningPosition position