Commit 6d5a0e8a authored by Alexei Filippov's avatar Alexei Filippov Committed by Commit Bot

DevTools: Fix Native heap snapshots do not open in DevTools.

Array.p.sort does not expect comparator result of BigInt.

BUG=881884

Change-Id: I3215e4dab8dcfc1e4e830cebf07d1dcf674d0d2e
Reviewed-on: https://chromium-review.googlesource.com/1213928Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589731}
parent dbbde603
...@@ -55,11 +55,15 @@ Profiler.HeapProfileView = class extends Profiler.ProfileView { ...@@ -55,11 +55,15 @@ Profiler.HeapProfileView = class extends Profiler.ProfileView {
populateTextView(view) { populateTextView(view) {
const guides = '+!:|'; const guides = '+!:|';
let text = `Sampling memory profile.\n\nDate/Time: ${new Date()}\n` + let text = `Sampling memory profile.\n\nDate/Time: ${new Date()}\n` +
`Report Version: 7\nNode weight: 1 KiB\n----\n\nCall graph:\n`; `Report Version: 7\n` +
`App Version: ${/Chrom\S*/.exec(navigator.appVersion)[0] || 'Unknown'}\n` +
`Node Weight: 1 KiB\n` +
`Total Size: ${Math.round(this.profile.root.total / 1024)} KiB\n` +
`----\n\nCall graph:\n`;
const sortedChildren = this.profile.root.children.sort((a, b) => b.total - a.total); const sortedChildren = this.profile.root.children.sort((a, b) => b.total - a.total);
const modules = this.profile.modules.map( const modules = this.profile.modules.map(
m => Object.assign({address: BigInt(m.baseAddress), endAddress: BigInt(m.baseAddress) + BigInt(m.size)}, m)); m => Object.assign({address: BigInt(m.baseAddress), endAddress: BigInt(m.baseAddress) + BigInt(m.size)}, m));
modules.sort((m1, m2) => m1.address - m2.address); modules.sort((m1, m2) => m1.address > m2.address ? 1 : m1.address < m2.address ? -1 : 0);
for (const child of sortedChildren) for (const child of sortedChildren)
printTree(' ', child !== sortedChildren.peekLast(), child); printTree(' ', child !== sortedChildren.peekLast(), child);
......
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