Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v8: fix RegExp nits in v8_prof_polyfill.js #13709

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/internal/v8_prof_polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ function versionCheck() {
function macCppfiltNm(out) {
// Re-grouped copy-paste from `tickprocessor.js`
const FUNC_RE = /^([0-9a-fA-F]{8,16} [iItT] )(.*)$/gm;
const CLEAN_RE = /^[0-9a-fA-F]{8,16} [iItT] /;
let entries = out.match(FUNC_RE);
if (entries === null)
return out;

entries = entries.map((entry) => {
return entry.replace(/^[0-9a-fA-F]{8,16} [iItT] /, '')
return entry.replace(CLEAN_RE, '')
});

let filtered;
Expand All @@ -123,7 +124,7 @@ function macCppfiltNm(out) {
}

let i = 0;
filtered = filtered.split(/\n/g);
filtered = filtered.split('\n');
return out.replace(FUNC_RE, (all, prefix, postfix) => {
return prefix + (filtered[i++] || postfix);
});
Expand Down