[wasm] Introduce v8.wasm.detailed trace event category
This CL repurposes the v8.wasm trace event category, and introduces additionally the v8.wasm.detailed category. The v8.wasm category is enabled by default and captures core wasm events like validation, compilation, instantiation, and important operations like grow-memory and tier-up timings. The v8.wasm.detailed category is disabled by default. It captures all events the previous v8.wasm category captured, like compilation of single functions, time needed for register allocation, ... This CL splits these categories to allow enabling the v8.wasm category in telemetry benchmarks to calculate compile time and other metrics from traces of telemetry runs. R=ecmziegler@chromium.org Bug: chromium:1084929 Change-Id: Ida58b8f344b0ccb6ee1210e259c3e0e993eff497 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2210230 Commit-Queue: Andreas Haas <ahaas@chromium.org> Reviewed-by: Clemens Backes <clemensb@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Reviewed-by: Emanuel Ziegler <ecmziegler@chromium.org> Cr-Commit-Position: refs/heads/master@{#68156}
This commit is contained in:
parent
b96855f1b5
commit
d529da0128
@ -18,10 +18,10 @@ namespace compiler {
|
||||
namespace {
|
||||
|
||||
// We log detailed phase information about the pipeline
|
||||
// in both the v8.turbofan and the v8.wasm categories.
|
||||
// in both the v8.turbofan and the v8.wasm.detailed categories.
|
||||
constexpr const char kTraceCategory[] = // --
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.turbofan") "," // --
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.wasm");
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed");
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -6530,8 +6530,8 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
|
||||
const wasm::FunctionSig* sig) {
|
||||
DCHECK_EQ(1, sig->return_count());
|
||||
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"CompileWasmMathIntrinsic");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.CompileWasmMathIntrinsic");
|
||||
|
||||
Zone zone(wasm_engine->allocator(), ZONE_NAME);
|
||||
|
||||
@ -6604,8 +6604,8 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
|
||||
return CompileWasmMathIntrinsic(wasm_engine, kind, sig);
|
||||
}
|
||||
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"CompileWasmImportCallWrapper");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.CompileWasmImportCallWrapper");
|
||||
//----------------------------------------------------------------------------
|
||||
// Create the Graph
|
||||
//----------------------------------------------------------------------------
|
||||
@ -6647,7 +6647,8 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine* wasm_engine,
|
||||
wasm::NativeModule* native_module,
|
||||
const wasm::FunctionSig* sig,
|
||||
Address address) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "CompileWasmCapiFunction");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.CompileWasmCapiFunction");
|
||||
|
||||
Zone zone(wasm_engine->allocator(), ZONE_NAME);
|
||||
|
||||
@ -6858,9 +6859,9 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
|
||||
wasm::WasmEngine* wasm_engine, wasm::CompilationEnv* env,
|
||||
const wasm::FunctionBody& func_body, int func_index, Counters* counters,
|
||||
wasm::WasmFeatures* detected) {
|
||||
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"ExecuteTurbofanCompilation", "func_index", func_index,
|
||||
"body_size", func_body.end - func_body.start);
|
||||
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.CompileTopTier", "func_index", func_index, "body_size",
|
||||
func_body.end - func_body.start);
|
||||
Zone zone(wasm_engine->allocator(), ZONE_NAME);
|
||||
MachineGraph* mcgraph = new (&zone) MachineGraph(
|
||||
new (&zone) Graph(&zone), new (&zone) CommonOperatorBuilder(&zone),
|
||||
|
@ -272,8 +272,7 @@ Object StackGuard::HandleInterrupts() {
|
||||
}
|
||||
|
||||
if (TestAndClear(&interrupt_flags, GROW_SHARED_MEMORY)) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"V8.WasmGrowSharedMemory");
|
||||
TRACE_EVENT0("v8.wasm", "V8.WasmGrowSharedMemory");
|
||||
BackingStore::UpdateSharedWasmMemoryObjects(isolate_);
|
||||
}
|
||||
|
||||
@ -297,12 +296,12 @@ Object StackGuard::HandleInterrupts() {
|
||||
}
|
||||
|
||||
if (TestAndClear(&interrupt_flags, LOG_WASM_CODE)) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "LogCode");
|
||||
TRACE_EVENT0("v8.wasm", "V8.LogCode");
|
||||
isolate_->wasm_engine()->LogOutstandingCodesForIsolate(isolate_);
|
||||
}
|
||||
|
||||
if (TestAndClear(&interrupt_flags, WASM_CODE_GC)) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "WasmCodeGC");
|
||||
TRACE_EVENT0("v8.wasm", "V8.WasmCodeGC");
|
||||
isolate_->wasm_engine()->ReportLiveCodeFromStackForGC(isolate_);
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ PERFETTO_DEFINE_CATEGORIES(
|
||||
perfetto::Category("v8.console"),
|
||||
perfetto::Category("v8.execute"),
|
||||
perfetto::Category("v8.runtime"),
|
||||
perfetto::Category("v8.wasm"),
|
||||
perfetto::Category::Group("devtools.timeline,v8"),
|
||||
perfetto::Category::Group("devtools.timeline,"
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.gc")),
|
||||
@ -46,11 +47,11 @@ PERFETTO_DEFINE_CATEGORIES(
|
||||
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats")),
|
||||
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats_sampling")),
|
||||
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.turbofan")),
|
||||
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.wasm")),
|
||||
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed")),
|
||||
perfetto::Category(TRACE_DISABLED_BY_DEFAULT("v8.zone_stats")),
|
||||
perfetto::Category::Group("v8,devtools.timeline"),
|
||||
perfetto::Category::Group(TRACE_DISABLED_BY_DEFAULT("v8.turbofan") ","
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.wasm")));
|
||||
TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed")));
|
||||
// clang-format on
|
||||
|
||||
#endif // defined(V8_USE_PERFETTO)
|
||||
|
@ -3710,9 +3710,9 @@ WasmCompilationResult ExecuteLiftoffCompilation(
|
||||
std::unique_ptr<DebugSideTable>* debug_sidetable,
|
||||
Vector<int> extra_source_pos) {
|
||||
int func_body_size = static_cast<int>(func_body.end - func_body.start);
|
||||
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"ExecuteLiftoffCompilation", "func_index", func_index,
|
||||
"body_size", func_body_size);
|
||||
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.CompileBaseline", "func_index", func_index, "body_size",
|
||||
func_body_size);
|
||||
|
||||
Zone zone(allocator, "LiftoffCompilationZone");
|
||||
auto call_descriptor = compiler::GetWasmCallDescriptor(&zone, func_body.sig);
|
||||
|
@ -278,7 +278,8 @@ JSToWasmWrapperCompilationUnit::JSToWasmWrapperCompilationUnit(
|
||||
JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit() = default;
|
||||
|
||||
void JSToWasmWrapperCompilationUnit::Execute() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "CompileJSToWasmWrapper");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.CompileJSToWasmWrapper");
|
||||
CompilationJob::Status status = job_->ExecuteJob(nullptr);
|
||||
CHECK_EQ(status, CompilationJob::SUCCEEDED);
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ bool ExecuteCompilationUnits(
|
||||
const std::shared_ptr<BackgroundCompileToken>& token, Counters* counters,
|
||||
int task_id, CompileBaselineOnly baseline_only) {
|
||||
TRACE_COMPILE("Compiling (task %d)...\n", task_id);
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "ExecuteCompilationUnits");
|
||||
TRACE_EVENT0("v8.wasm", "wasm.ExecuteCompilationUnits");
|
||||
|
||||
// Execute JS to Wasm wrapper units first, so that they are ready to be
|
||||
// finalized by the main thread when the kFinishedBaselineCompilation event is
|
||||
@ -1108,8 +1108,9 @@ bool ExecuteCompilationUnits(
|
||||
|
||||
auto publish_results = [&results_to_publish](
|
||||
BackgroundCompileScope* compile_scope) {
|
||||
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "PublishResults",
|
||||
"num_results", results_to_publish.size());
|
||||
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.PublishCompilationResults", "num_results",
|
||||
results_to_publish.size());
|
||||
if (results_to_publish.empty()) return;
|
||||
std::vector<std::unique_ptr<WasmCode>> unpublished_code =
|
||||
compile_scope->native_module()->AddCompiledCode(
|
||||
@ -1512,7 +1513,8 @@ AsyncCompileJob::AsyncCompileJob(
|
||||
bytes_copy_(std::move(bytes_copy)),
|
||||
wire_bytes_(bytes_copy_.get(), bytes_copy_.get() + length),
|
||||
resolver_(std::move(resolver)) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "new AsyncCompileJob");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.AsyncCompileJob");
|
||||
CHECK(FLAG_wasm_async_compilation);
|
||||
CHECK(!FLAG_jitless);
|
||||
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
||||
@ -1660,8 +1662,8 @@ void AsyncCompileJob::PrepareRuntimeObjects() {
|
||||
// This function assumes that it is executed in a HandleScope, and that a
|
||||
// context is set on the isolate.
|
||||
void AsyncCompileJob::FinishCompile(bool is_after_cache_hit) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"AsyncCompileJob::FinishCompile");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.FinishAsyncCompile");
|
||||
bool is_after_deserialization = !module_object_.is_null();
|
||||
auto compilation_state = Impl(native_module_->compilation_state());
|
||||
if (!is_after_deserialization) {
|
||||
@ -1693,7 +1695,8 @@ void AsyncCompileJob::FinishCompile(bool is_after_cache_hit) {
|
||||
script->set_source_mapping_url(*src_map_str.ToHandleChecked());
|
||||
}
|
||||
{
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "Debug::OnAfterCompile");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.Debug.OnAfterCompile");
|
||||
isolate_->debug()->OnAfterCompile(script);
|
||||
}
|
||||
|
||||
@ -1740,8 +1743,8 @@ void AsyncCompileJob::AsyncCompileFailed() {
|
||||
}
|
||||
|
||||
void AsyncCompileJob::AsyncCompileSucceeded(Handle<WasmModuleObject> result) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"CompilationResultResolver::OnCompilationSucceeded");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.OnCompilationSucceeded");
|
||||
resolver_->OnCompilationSucceeded(result);
|
||||
}
|
||||
|
||||
@ -1938,8 +1941,8 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
// Decode the module bytes.
|
||||
TRACE_COMPILE("(1) Decoding module...\n");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"AsyncCompileJob::DecodeModule");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.DecodeModule");
|
||||
auto enabled_features = job->enabled_features_;
|
||||
result = DecodeWasmModule(enabled_features, job->wire_bytes_.start(),
|
||||
job->wire_bytes_.end(), false, kWasmOrigin,
|
||||
@ -2446,6 +2449,7 @@ void AsyncStreamingProcessor::OnAbort() {
|
||||
|
||||
bool AsyncStreamingProcessor::Deserialize(Vector<const uint8_t> module_bytes,
|
||||
Vector<const uint8_t> wire_bytes) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.Deserialize");
|
||||
// DeserializeNativeModule and FinishCompile assume that they are executed in
|
||||
// a HandleScope, and that a context is set on the isolate.
|
||||
HandleScope scope(job_->isolate_);
|
||||
@ -2690,8 +2694,9 @@ void CompilationStateImpl::FinalizeJSToWasmWrappers(
|
||||
// TODO(6792): Wrappers below are allocated with {Factory::NewCode}. As an
|
||||
// optimization we keep the code space unlocked to avoid repeated unlocking
|
||||
// because many such wrapper are allocated in sequence below.
|
||||
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "FinalizeJSToWasmWrappers",
|
||||
"num_wrappers", js_to_wasm_wrapper_units_.size());
|
||||
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.FinalizeJSToWasmWrappers", "num_wrappers",
|
||||
js_to_wasm_wrapper_units_.size());
|
||||
CodeSpaceMemoryModificationScope modification_scope(isolate->heap());
|
||||
for (auto& unit : js_to_wasm_wrapper_units_) {
|
||||
Handle<Code> code = unit->Finalize(isolate);
|
||||
@ -2709,8 +2714,8 @@ CompilationStateImpl::GetNextCompilationUnit(
|
||||
}
|
||||
|
||||
void CompilationStateImpl::OnFinishedUnits(Vector<WasmCode*> code_vector) {
|
||||
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "OnFinishedUnits",
|
||||
"num_units", code_vector.size());
|
||||
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.OnFinishedUnits", "num_units", code_vector.size());
|
||||
|
||||
base::MutexGuard guard(&callbacks_mutex_);
|
||||
|
||||
@ -2833,13 +2838,13 @@ void CompilationStateImpl::TriggerCallbacks(
|
||||
|
||||
for (auto event :
|
||||
{std::make_pair(CompilationEvent::kFinishedBaselineCompilation,
|
||||
"BaselineFinished"),
|
||||
"wasm.BaselineFinished"),
|
||||
std::make_pair(CompilationEvent::kFinishedTopTierCompilation,
|
||||
"TopTierFinished"),
|
||||
"wasm.TopTierFinished"),
|
||||
std::make_pair(CompilationEvent::kFinishedRecompilation,
|
||||
"RecompilationFinished")}) {
|
||||
"wasm.RecompilationFinished")}) {
|
||||
if (!triggered_events.contains(event.first)) continue;
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), event.second);
|
||||
TRACE_EVENT0("v8.wasm", event.second);
|
||||
for (auto& callback : callbacks_) {
|
||||
callback(event.first);
|
||||
}
|
||||
|
@ -304,7 +304,8 @@ InstanceBuilder::InstanceBuilder(Isolate* isolate, ErrorThrower* thrower,
|
||||
|
||||
// Build an instance, in all of its glory.
|
||||
MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "InstanceBuilder::Build");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.InstanceBuilder.Build");
|
||||
// Check that an imports argument was provided, if the module requires it.
|
||||
// No point in continuing otherwise.
|
||||
if (!module_->import_table.empty() && ffi_.is_null()) {
|
||||
@ -616,8 +617,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
||||
}
|
||||
|
||||
bool InstanceBuilder::ExecuteStartFunction() {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"),
|
||||
"InstanceBuilder::ExecuteStartFunction");
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm.detailed"),
|
||||
"wasm.ExecuteStartFunction");
|
||||
if (start_function_.is_null()) return true; // No start function.
|
||||
|
||||
HandleScope scope(isolate_);
|
||||
|
@ -409,6 +409,7 @@ WasmEngine::~WasmEngine() {
|
||||
|
||||
bool WasmEngine::SyncValidate(Isolate* isolate, const WasmFeatures& enabled,
|
||||
const ModuleWireBytes& bytes) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.SyncValidate");
|
||||
// TODO(titzer): remove dependency on the isolate.
|
||||
if (bytes.start() == nullptr || bytes.length() == 0) return false;
|
||||
ModuleResult result =
|
||||
@ -421,6 +422,7 @@ MaybeHandle<AsmWasmData> WasmEngine::SyncCompileTranslatedAsmJs(
|
||||
Isolate* isolate, ErrorThrower* thrower, const ModuleWireBytes& bytes,
|
||||
Vector<const byte> asm_js_offset_table_bytes,
|
||||
Handle<HeapNumber> uses_bitset, LanguageMode language_mode) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.SyncCompileTranslatedAsmJs");
|
||||
ModuleOrigin origin = language_mode == LanguageMode::kSloppy
|
||||
? kAsmJsSloppyOrigin
|
||||
: kAsmJsStrictOrigin;
|
||||
@ -464,6 +466,7 @@ Handle<WasmModuleObject> WasmEngine::FinalizeTranslatedAsmJs(
|
||||
MaybeHandle<WasmModuleObject> WasmEngine::SyncCompile(
|
||||
Isolate* isolate, const WasmFeatures& enabled, ErrorThrower* thrower,
|
||||
const ModuleWireBytes& bytes) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.SyncCompile");
|
||||
ModuleResult result =
|
||||
DecodeWasmModule(enabled, bytes.start(), bytes.end(), false, kWasmOrigin,
|
||||
isolate->counters(), allocator());
|
||||
@ -509,6 +512,7 @@ MaybeHandle<WasmInstanceObject> WasmEngine::SyncInstantiate(
|
||||
Isolate* isolate, ErrorThrower* thrower,
|
||||
Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports,
|
||||
MaybeHandle<JSArrayBuffer> memory) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.SyncInstantiate");
|
||||
return InstantiateToInstanceObject(isolate, thrower, module_object, imports,
|
||||
memory);
|
||||
}
|
||||
@ -517,6 +521,7 @@ void WasmEngine::AsyncInstantiate(
|
||||
Isolate* isolate, std::unique_ptr<InstantiationResultResolver> resolver,
|
||||
Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports) {
|
||||
ErrorThrower thrower(isolate, "WebAssembly.instantiate()");
|
||||
TRACE_EVENT0("v8.wasm", "wasm.AsyncInstantiate");
|
||||
// Instantiate a TryCatch so that caught exceptions won't progagate out.
|
||||
// They will still be set as pending exceptions on the isolate.
|
||||
// TODO(clemensb): Avoid TryCatch, use Execution::TryCall internally to invoke
|
||||
@ -552,6 +557,7 @@ void WasmEngine::AsyncCompile(
|
||||
std::shared_ptr<CompilationResultResolver> resolver,
|
||||
const ModuleWireBytes& bytes, bool is_shared,
|
||||
const char* api_method_name_for_errors) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.AsyncCompile");
|
||||
if (!FLAG_wasm_async_compilation) {
|
||||
// Asynchronous compilation disabled; fall back on synchronous compilation.
|
||||
ErrorThrower thrower(isolate, api_method_name_for_errors);
|
||||
@ -600,6 +606,7 @@ std::shared_ptr<StreamingDecoder> WasmEngine::StartStreamingCompilation(
|
||||
Isolate* isolate, const WasmFeatures& enabled, Handle<Context> context,
|
||||
const char* api_method_name,
|
||||
std::shared_ptr<CompilationResultResolver> resolver) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.StartStreamingCompilation");
|
||||
if (FLAG_wasm_async_compilation) {
|
||||
AsyncCompileJob* job = CreateAsyncCompileJob(
|
||||
isolate, enabled, std::unique_ptr<byte[]>(nullptr), 0, context,
|
||||
@ -1170,7 +1177,7 @@ void WasmEngine::SampleTopTierCodeSizeInAllIsolates(
|
||||
|
||||
void WasmEngine::ReportLiveCodeForGC(Isolate* isolate,
|
||||
Vector<WasmCode*> live_code) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "ReportLiveCodeForGC");
|
||||
TRACE_EVENT0("v8.wasm", "wasm.ReportLiveCodeForGC");
|
||||
TRACE_CODE_GC("Isolate %d reporting %zu live code objects.\n", isolate->id(),
|
||||
live_code.size());
|
||||
base::MutexGuard guard(&mutex_);
|
||||
@ -1243,7 +1250,7 @@ void WasmEngine::FreeDeadCode(const DeadCodeMap& dead_code) {
|
||||
}
|
||||
|
||||
void WasmEngine::FreeDeadCodeLocked(const DeadCodeMap& dead_code) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "FreeDeadCode");
|
||||
TRACE_EVENT0("v8.wasm", "wasm.FreeDeadCode");
|
||||
DCHECK(!mutex_.TryLock());
|
||||
for (auto& dead_code_entry : dead_code) {
|
||||
NativeModule* native_module = dead_code_entry.first;
|
||||
|
@ -93,37 +93,48 @@ class WasmStreaming::WasmStreamingImpl {
|
||||
};
|
||||
|
||||
WasmStreaming::WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl)
|
||||
: impl_(std::move(impl)) {}
|
||||
: impl_(std::move(impl)) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.InitializeStreaming");
|
||||
}
|
||||
|
||||
// The destructor is defined here because we have a unique_ptr with forward
|
||||
// declaration.
|
||||
WasmStreaming::~WasmStreaming() = default;
|
||||
|
||||
void WasmStreaming::OnBytesReceived(const uint8_t* bytes, size_t size) {
|
||||
TRACE_EVENT1("v8.wasm", "wasm.OnBytesReceived", "num_bytes", size);
|
||||
impl_->OnBytesReceived(bytes, size);
|
||||
}
|
||||
|
||||
void WasmStreaming::Finish() { impl_->Finish(); }
|
||||
void WasmStreaming::Finish() {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.FinishStreaming");
|
||||
impl_->Finish();
|
||||
}
|
||||
|
||||
void WasmStreaming::Abort(MaybeLocal<Value> exception) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.AbortStreaming");
|
||||
impl_->Abort(exception);
|
||||
}
|
||||
|
||||
bool WasmStreaming::SetCompiledModuleBytes(const uint8_t* bytes, size_t size) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.SetCompiledModuleBytes");
|
||||
return impl_->SetCompiledModuleBytes(bytes, size);
|
||||
}
|
||||
|
||||
void WasmStreaming::SetClient(std::shared_ptr<Client> client) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.WasmStreaming.SetClient");
|
||||
impl_->SetClient(client);
|
||||
}
|
||||
|
||||
void WasmStreaming::SetUrl(const char* url, size_t length) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.SetUrl");
|
||||
impl_->SetUrl(internal::VectorOf(url, length));
|
||||
}
|
||||
|
||||
// static
|
||||
std::shared_ptr<WasmStreaming> WasmStreaming::Unpack(Isolate* isolate,
|
||||
Local<Value> value) {
|
||||
TRACE_EVENT0("v8.wasm", "wasm.WasmStreaming.Unpack");
|
||||
i::HandleScope scope(reinterpret_cast<i::Isolate*>(isolate));
|
||||
auto managed =
|
||||
i::Handle<i::Managed<WasmStreaming>>::cast(Utils::OpenHandle(*value));
|
||||
|
@ -856,7 +856,7 @@ void WasmMemoryObject::update_instances(Isolate* isolate,
|
||||
int32_t WasmMemoryObject::Grow(Isolate* isolate,
|
||||
Handle<WasmMemoryObject> memory_object,
|
||||
uint32_t pages) {
|
||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.wasm"), "GrowMemory");
|
||||
TRACE_EVENT0("v8.wasm", "wasm.GrowMemory");
|
||||
Handle<JSArrayBuffer> old_buffer(memory_object->array_buffer(), isolate);
|
||||
// Any buffer used as an asmjs memory cannot be detached, and
|
||||
// therefore this memory cannot be grown.
|
||||
|
Loading…
Reference in New Issue
Block a user