Commit e87484c6 authored by Alexey Kireev's avatar Alexey Kireev Committed by Commit Bot

Enable full WASM function names with arguments for Intel VTune

If WASM code is profiled with Intel VTune Profiler then the user sees 
incomplete function name - a function name is cut when a space is met.
This patch fixes the issue to show a complete function name including 
arguments.

Change-Id: I0e550e921acb703ec14fe83d67e7bb47035f739d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2246575
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68821}
parent 33baade2
......@@ -151,8 +151,23 @@ static std::string GetFunctionNameFromMixedName(const char* str, int length) {
start_ptr = const_cast<char*>(str + index);
while (index < length && str[index++] != ' ') {
// Detecting JS and WASM function names. In JitCodeEvent->name.str
// JS functions name ends with a space symbol. WASM function name
// ends with the latest closing parenthesis.
char last_char = ' ';
int parenthesis_count = 0;
while (index < length) {
if (str[index] == '(') {
last_char = ')';
parenthesis_count++;
}
if (str[index] == ')') parenthesis_count--;
if (str[index] == last_char && parenthesis_count == 0) {
if (last_char == ')') count++;
break;
}
count++;
index++;
}
return std::string(start_ptr, count);
......
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