perf completion: strip function_exists ()

Use "type" to check existence consistently.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
perf completion: strip dependency on bash-completion

The bash-completion package defines the _get_comp_words_by_ref
function.  There is no need to depend on it, as we can reimplement it
like git.git has.

Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
perf completion: use more comp words

The completion words $words and $cword are available, so we might as
well use them instead of directly accessing COMP_WORDS.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>