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 <fedor.indutny@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9e2d85e commit d5bf137

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/internal/v8_prof_polyfill.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ function versionCheck() {
105105
functionmacCppfiltNm(out){
106106
// Re-grouped copy-paste from `tickprocessor.js`
107107
constFUNC_RE=/^([0-9a-fA-F]{8,16}[iItT])(.*)$/gm;
108+
constCLEAN_RE=/^[0-9a-fA-F]{8,16}[iItT]/;
108109
letentries=out.match(FUNC_RE);
109110
if(entries===null)
110111
returnout;
111112

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

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

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

0 commit comments

Comments
 (0)