diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-16 02:17:10 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-09-05 12:49:48 -0400 |
commit | d5bf1379b5946aa2e69bd29d54cc37382a211f30 (patch) | |
tree | 981dcdad7e714f9960f0f17745ed0f262dc20898 /lib | |
parent | 9e2d85e4419131c1e3265afe83f1823a5fb0749c (diff) | |
download | node-new-d5bf1379b5946aa2e69bd29d54cc37382a211f30.tar.gz |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/v8_prof_polyfill.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/internal/v8_prof_polyfill.js b/lib/internal/v8_prof_polyfill.js index 34cd10337f..e77f1f76bc 100644 --- a/lib/internal/v8_prof_polyfill.js +++ b/lib/internal/v8_prof_polyfill.js @@ -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; @@ -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); }); |