Commit 9d33c4e6 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[tools] Add a tool for finding builtins

Example usage:
    tools/find-builtin LoadIC | xargs code -g

Change-Id: I12c15d3d4a80edbcddfa9cc8b9a515b839c96fdf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2808949
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73827}
parent 301f3a4d
#!/bin/bash
set -euo pipefail
BUILTIN_NAME="$1"
if ! which rg >/dev/null ; then
echo >&2 "This tool requires 'rg', install it with 'sudo apt install ripgrep'"
exit 1
fi
TOOLS_DIRNAME="$(dirname "$0")"
V8_DIRNAME="$(dirname "$TOOLS_DIRNAME")"
if rg --type-add 'tq:*.tq' --type tq --with-filename --line-number "\bbuiltin $BUILTIN_NAME\b" "$V8_DIRNAME" | rg -v '\bextern builtin\b' | cut -f1-2 -d: ; then
exit 0
fi
if rg --type cpp --with-filename --line-number "\b(TF_BUILTIN\(|::Generate_?)$BUILTIN_NAME\b" "$V8_DIRNAME" | cut -f1-2 -d: ; then
exit 0
fi
echo >&2 "Builtin '$BUILTIN_NAME' not found"
exit 1
\ No newline at end of file
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