Skip to content

Commit d5bf137

Browse files
vsemozhetbytMylesBorins
authored andcommitted
v8: fix RegExp nits in v8_prof_polyfill.js
* Do not repeat RegExp creation in cycle. * Use sufficient string instead of RegExp in split(). PR-URL: #13709 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9e2d85e commit d5bf137

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/internal/v8_prof_polyfill.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ function versionCheck() {
105105
function macCppfiltNm(out) {
106106
// Re-grouped copy-paste from `tickprocessor.js`
107107
const FUNC_RE = /^([0-9a-fA-F]{8,16} [iItT] )(.*)$/gm;
108+
const CLEAN_RE = /^[0-9a-fA-F]{8,16} [iItT] /;
108109
let entries = out.match(FUNC_RE);
109110
if (entries === null)
110111
return out;
111112

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

116117
let filtered;
@@ -123,7 +124,7 @@ function macCppfiltNm(out) {
123124
}
124125

125126
let i = 0;
126-
filtered = filtered.split(/\n/g);
127+
filtered = filtered.split('\n');
127128
return out.replace(FUNC_RE, (all, prefix, postfix) => {
128129
return prefix + (filtered[i++] || postfix);
129130
});

0 commit comments

Comments
 (0)