v8/tools/collect_deprecation_stats.sh
Dan Elphick 9a43b37899 [objects] Deprecate GetIsolate/Heap behind a flag
Adds a new flag v8_deprecate_get_isolate that marks
HeapObject::GetIsolate/GetHeap, Handle<T>(T*) and handle<T>(T*) as
[[deprecated]]. Deprecation warnings are not converted to errors so an
entire build can be completed to collect all the warnings.

Also adds a new script tools/collect_deprecation_stats.sh which runs the
build (assuming the flag is set) and collects the number of uses of
deprecated functions. E.g. at the time of upload, we get:

Total deprecated calls: 2265
    515 GetHeap
    842 GetIsolate
    210 handle
    698 Handle

Bug: v8:7786
Change-Id: I7043c597fa90bc77759a357ef3c2a5fefe933491
Reviewed-on: https://chromium-review.googlesource.com/1082478
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53475}
2018-06-01 15:19:21 +00:00

36 lines
864 B
Bash
Executable File

#!/bin/bash
# Collect the number of [[deprecated]] calls detected when compiling V8.
# Requires "v8_deprecate_get_isolate = true" to be useful.
set -e
if [ -z "$1" ]; then
(>&2 echo "Usage: collect_deprecation_stats.sh [<outdir>|<log>]")
exit 1
fi
if [ -d "$1" ]; then
OUTDIR=$1
FULL_LOG=/tmp/get_isolate_deprecation.log
gn clean "$OUTDIR"
autoninja -C "$OUTDIR" > $FULL_LOG
else
FULL_LOG=$1
fi
FILTERED_LOG=/tmp/filtered_isolate_deprecation.log
UNIQUE_WARNINGS_LOG=/tmp/unique_warnings.log
grep "warning:" "$FULL_LOG" | sed $'
s|^\.\./\.\./||;
s/: warning: \'/: /;
# strip everything after deprecated function name (including template param).
s/\(<.*>\)\\?\'.*//' > $FILTERED_LOG
sort -u $FILTERED_LOG > $UNIQUE_WARNINGS_LOG
echo "Total deprecated calls: $(wc -l < $UNIQUE_WARNINGS_LOG)"
cut -f2 -d' ' $UNIQUE_WARNINGS_LOG | sort | uniq -c