JSBackend.cpp changes here: https://gist.github.com/hackcasual/0e59c8f83a7b6a4788e5590ca82ca5e8 Emscripten changes here: https://gist.github.com/hackcasual/474718a0763f2213bb86a43949a0ac7a Snippet I use to download the function coverage here: https://gist.github.com/hackcasual/a655025c6bfee054c8cde65cc47976fd
The biggest reason this is considered so rough is that it relies on correctly finding the HEAP8 minified variable name. This will only currently work on minified code, but it should be straightforward to patch the funccov.py file to match how your code is emitted. On Monday, October 31, 2016 at 10:59:58 AM UTC-7, Charles Vaughn wrote: > > I added a simple called function tracker. It works by emitting stores into > a preallocated memory segment. Since my code base makes substantial use of > duplicate function elimination, there's some hacks to allow dead functions > to still be eliminated. I'll see if I can tease that out and make the > changes available. > > On Monday, October 31, 2016 at 8:50:46 AM UTC-7, caiiiycuk wrote: >> >> I want to implement PGO on js-optimizer step. But it hard to understand >> format of AST, is there are some docs about it? Currently I try to simply >> call PGO_INVOKE(1) in beginning of each function: >> function pgo(ast) { >> var PATCHED_FUNCS = set(); >> traverseGeneratedFunctions(ast, function(func) { >> var sig = func[1]; >> if (sig in PATCHED_FUNCS) return null; >> var children = func[3]; >> children.unshift(['call', ['name', 'PGO_INVOKE'], [['num', 1]]]); >> PATCHED_FUNCS[sig] = 1; >> }); >> } >> >> But after pgo step, I see an error: >> bad, seeing a var in need of fixing >> bad, seeing a var in need of fixing: ["defun", >> "__ZNSt3__26vectorI5VideoNS_9allocatorIS1_EEE21__push_back_slow_pathIRKS1_EEvOT_", >> >> ["$0", "$1"], [["call", ["name", "PGO_INVOKE"], [["num", 1]]], ["stat", >> ["assign", true, ["name", "$0"], ["binary", "|", ["name", "$0"], ["num", >> 0]]]], ["stat", bad, seeing a var in need of fixing["assign": , >> ["defuntrue, ", "__ZN9Texture2D11imageLoadedEPviib", ["name", "[$1""]$0", , >> [""$1"binary", ", "$2", "$3|"", , "["name$4""], ", [$1"][, "call["", >> num"[", 0name", "PGO_INVOKE"], [[]"num]"]], , 1[]]], ["stat", ["assign"", >> true... >> >> Can you give me some advice? >> > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.