Commit a42e067e authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[snapshot] Add SnapshotDecompress RCS scope

We do have snapshot decompression trace events, let's also add a
runtime call stats scope for easy comparison.

Bug: chromium:1269494, chromium:1270039
Change-Id: If467cc38f37a0ea9d84e501b4984bf72736c8fa4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3279962
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77898}
parent 76b4ebe1
...@@ -388,13 +388,13 @@ class RuntimeCallTimer final { ...@@ -388,13 +388,13 @@ class RuntimeCallTimer final {
V(BoundFunctionLengthGetter) \ V(BoundFunctionLengthGetter) \
V(BoundFunctionNameGetter) \ V(BoundFunctionNameGetter) \
V(CodeGenerationFromStringsCallbacks) \ V(CodeGenerationFromStringsCallbacks) \
V(CompileBackgroundBaselinePreVisit) \
V(CompileBackgroundBaselineVisit) \
V(CompileBackgroundCompileTask) \ V(CompileBackgroundCompileTask) \
V(CompileBaseline) \ V(CompileBaseline) \
V(CompileBaselineFinalization) \
V(CompileBaselinePreVisit) \ V(CompileBaselinePreVisit) \
V(CompileBaselineVisit) \ V(CompileBaselineVisit) \
V(CompileBackgroundBaselinePreVisit) \
V(CompileBackgroundBaselineVisit) \
V(CompileBaselineFinalization) \
V(CompileCollectSourcePositions) \ V(CompileCollectSourcePositions) \
V(CompileDeserialize) \ V(CompileDeserialize) \
V(CompileEnqueueOnDispatcher) \ V(CompileEnqueueOnDispatcher) \
...@@ -469,6 +469,7 @@ class RuntimeCallTimer final { ...@@ -469,6 +469,7 @@ class RuntimeCallTimer final {
V(PrototypeMap_TransitionToDataProperty) \ V(PrototypeMap_TransitionToDataProperty) \
V(PrototypeObject_DeleteProperty) \ V(PrototypeObject_DeleteProperty) \
V(ReconfigureToDataProperty) \ V(ReconfigureToDataProperty) \
V(SnapshotDecompress) \
V(StringLengthGetter) \ V(StringLengthGetter) \
V(TestCounter1) \ V(TestCounter1) \
V(TestCounter2) \ V(TestCounter2) \
...@@ -476,10 +477,10 @@ class RuntimeCallTimer final { ...@@ -476,10 +477,10 @@ class RuntimeCallTimer final {
V(UpdateProtector) \ V(UpdateProtector) \
V(WebSnapshotDeserialize) \ V(WebSnapshotDeserialize) \
V(WebSnapshotDeserialize_Arrays) \ V(WebSnapshotDeserialize_Arrays) \
V(WebSnapshotDeserialize_Classes) \
V(WebSnapshotDeserialize_Contexts) \ V(WebSnapshotDeserialize_Contexts) \
V(WebSnapshotDeserialize_Exports) \ V(WebSnapshotDeserialize_Exports) \
V(WebSnapshotDeserialize_Functions) \ V(WebSnapshotDeserialize_Functions) \
V(WebSnapshotDeserialize_Classes) \
V(WebSnapshotDeserialize_Maps) \ V(WebSnapshotDeserialize_Maps) \
V(WebSnapshotDeserialize_Objects) \ V(WebSnapshotDeserialize_Objects) \
V(WebSnapshotDeserialize_Strings) V(WebSnapshotDeserialize_Strings)
......
...@@ -120,9 +120,11 @@ class SnapshotImpl : public AllStatic { ...@@ -120,9 +120,11 @@ class SnapshotImpl : public AllStatic {
} // namespace } // namespace
SnapshotData MaybeDecompress(const base::Vector<const byte>& snapshot_data) { SnapshotData MaybeDecompress(Isolate* isolate,
TRACE_EVENT0("v8", "V8.SnapshotDecompress"); const base::Vector<const byte>& snapshot_data) {
#ifdef V8_SNAPSHOT_COMPRESSION #ifdef V8_SNAPSHOT_COMPRESSION
TRACE_EVENT0("v8", "V8.SnapshotDecompress");
RCS_SCOPE(isolate, RuntimeCallCounterId::kSnapshotDecompress);
return SnapshotCompression::Decompress(snapshot_data); return SnapshotCompression::Decompress(snapshot_data);
#else #else
return SnapshotData(snapshot_data); return SnapshotData(snapshot_data);
...@@ -182,9 +184,11 @@ bool Snapshot::Initialize(Isolate* isolate) { ...@@ -182,9 +184,11 @@ bool Snapshot::Initialize(Isolate* isolate) {
decompress_histogram.emplace(isolate->counters()->snapshot_decompress()); decompress_histogram.emplace(isolate->counters()->snapshot_decompress());
} }
#endif #endif
SnapshotData startup_snapshot_data(MaybeDecompress(startup_data)); SnapshotData startup_snapshot_data(MaybeDecompress(isolate, startup_data));
SnapshotData read_only_snapshot_data(MaybeDecompress(read_only_data)); SnapshotData read_only_snapshot_data(
SnapshotData shared_heap_snapshot_data(MaybeDecompress(shared_heap_data)); MaybeDecompress(isolate, read_only_data));
SnapshotData shared_heap_snapshot_data(
MaybeDecompress(isolate, shared_heap_data));
#ifdef V8_SNAPSHOT_COMPRESSION #ifdef V8_SNAPSHOT_COMPRESSION
decompress_histogram.reset(); decompress_histogram.reset();
#endif #endif
...@@ -222,7 +226,7 @@ MaybeHandle<Context> Snapshot::NewContextFromSnapshot( ...@@ -222,7 +226,7 @@ MaybeHandle<Context> Snapshot::NewContextFromSnapshot(
isolate->counters()->context_snapshot_decompress()); isolate->counters()->context_snapshot_decompress());
} }
#endif #endif
snapshot_data.emplace(MaybeDecompress(context_data)); snapshot_data.emplace(MaybeDecompress(isolate, context_data));
} }
MaybeHandle<Context> maybe_result = ContextDeserializer::DeserializeContext( MaybeHandle<Context> maybe_result = ContextDeserializer::DeserializeContext(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment