37 std::optional<TimedHistogramScope> wasm_compile_function_time_scope;
38 std::optional<TimedHistogramScope> wasm_compile_huge_function_time_scope;
40 if (func_body.end - func_body.start >= 100 * KB) {
42 counters, env->
module->origin,
wasm, huge_function_size_bytes);
43 huge_size_histogram->AddSample(
44 static_cast<int>(func_body.end - func_body.start));
45 wasm_compile_huge_function_time_scope.emplace(
46 counters->wasm_compile_huge_function_time());
49 wasm_compile, function_time);
50 wasm_compile_function_time_scope.emplace(timed_histogram);
63 v8_flags.experimental_wasm_pgo_from_file ||
64 v8_flags.experimental_wasm_compilation_hints);
67 env->
module, detected, func_body)
84#if V8_ENABLE_DRUMBRAKE
85 case ExecutionTier::kInterpreter:
93 bool try_liftoff =
true;
95 bool must_use_liftoff =
98 bool tiering_requested =
99 declared_index < 32 &&
100 (
v8_flags.wasm_tier_mask_for_testing & (1 << declared_index));
101 if (!must_use_liftoff && tiering_requested) try_liftoff =
false;
108 .set_counters(counters)
109 .set_detected_features(detected);
112 std::unique_ptr<DebugSideTable> unused_debug_sidetable;
114 (
v8_flags.wasm_debug_mask_for_testing &
115 (1 << declared_index)) != 0)) {
116 options.set_debug_sidetable(&unused_debug_sidetable);
120 if (
result.succeeded())
break;
135 data.wire_bytes_storage = wire_bytes_storage;
137 env, data, detected, counters);
150 counters->wasm_generated_code_size()->Increment(
151 result.code_desc.instr_size);
152 counters->wasm_reloc_size()->Increment(
result.code_desc.reloc_size);
153 counters->wasm_deopt_data_size()->Increment(
154 static_cast<int>(
result.deopt_data.size()));
169 bool is_shared = native_module->
module()->type(function->sig_index).is_shared;
170 FunctionBody function_body{function->sig, function->code.offset(),
171 wire_bytes.
start() + function->code.offset(),
172 wire_bytes.
start() + function->code.end_offset(),
198 sig_index_(sig_index),
201 : compiler::NewJSToWasmCompilationJob(isolate,
sig)) {
203 OptimizedCompilationInfo* info =
204 static_cast<compiler::turboshaft::TurboshaftCompilationJob*>(job_.get())
205 ->compilation_info();
206 if (info->trace_turbo_graph()) {
209 isolate->GetCodeTracer();
214JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit() =
default;
216void JSToWasmWrapperCompilationUnit::Execute() {
218 "wasm.CompileJSToWasmWrapper");
226#if V8_ENABLE_DRUMBRAKE
229 Builtin::kGenericJSToWasmInterpreterWrapper);
241 info->GetDebugName().get());
247 DCHECK(cache->get(sig_index_.index).IsCleared());
249 cache->set(sig_index_.index,
MakeWeak(code->wrapper()));
251 counters->wasm_generated_code_size()->Increment(code->body_size());
252 counters->wasm_reloc_size()->Increment(code->relocation_size());
253 counters->wasm_compiled_export_wrapper()->Increment(1);
263 return unit.Finalize();
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
static bool IsHighResolution()
V8_EXPORT_PRIVATE Handle< Code > code_handle(Builtin builtin)
Handle< String > NewStringFromAsciiChecked(const char *str, AllocationType allocation=AllocationType::kYoung)
bool IsLoggingCodeCreation() const
v8::internal::Factory * factory()
OptimizedCompilationInfo * compilation_info() const
std::shared_ptr< WireBytesStorage > GetWireBytesStorage() const
JSToWasmWrapperCompilationUnit(Isolate *isolate, const CanonicalSig *sig, CanonicalTypeIndex sig_index)
CompilationState * compilation_state() const
uint32_t num_functions() const
const WasmModule * module() const
base::Vector< const uint8_t > wire_bytes() const
WasmCode * PublishCode(UnpublishedWasmCode)
V8_WARN_UNUSED_RESULT UnpublishedWasmCode AddCompiledCode(WasmCompilationResult &)
const CompileTimeImports & compile_imports() const
uint32_t num_imported_functions() const
WasmCompilationResult ExecuteCompilation(CompilationEnv *, const WireBytesStorage *, Counters *, WasmDetectedFeatures *detected)
ForDebugging for_debugging_
static void CompileWasmFunction(Counters *, NativeModule *, WasmDetectedFeatures *detected, const WasmFunction *, ExecutionTier)
AccountingAllocator * allocator()
virtual base::Vector< const uint8_t > GetCode(WireBytesRef) const =0
#define PROFILE(the_isolate, Call)
ZoneVector< RpoNumber > & result
wasm::WasmCompilationResult ExecuteTurboshaftWasmCompilation(wasm::CompilationEnv *env, compiler::WasmCompilationData &data, wasm::WasmDetectedFeatures *detected, Counters *counters)
WasmCompilationResult ExecuteLiftoffCompilation(CompilationEnv *env, const FunctionBody &func_body, const LiftoffOptions &compiler_options)
DecodeResult ValidateFunctionBody(Zone *zone, WasmEnabledFeatures enabled, const WasmModule *module, WasmDetectedFeatures *detected, const FunctionBody &body)
WasmEngine * GetWasmEngine()
int declared_function_index(const WasmModule *module, int func_index)
const char * ExecutionTierToString(ExecutionTier tier)
void PrintF(const char *format,...)
kWasmInternalFunctionIndirectPointerTag kProtectedInstanceDataOffset sig
Tagged< MaybeWeak< T > > MakeWeak(Tagged< T > value)
V8_EXPORT_PRIVATE FlagValues v8_flags
JSArrayBuffer::IsDetachableBit is_shared
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_LE(v1, v2)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
const WasmEnabledFeatures enabled_features
static CompilationEnv ForModule(const NativeModule *native_module)
const WasmModule *const module
const uint8_t * start() const
ModuleTypeIndex sig_index
#define TRACE_EVENT0(category_group, name)
#define TRACE_DISABLED_BY_DEFAULT(name)
#define V8_LIKELY(condition)
#define V8_UNLIKELY(condition)
#define SELECT_WASM_COUNTER(counters, origin, prefix, suffix)