That code looks ok. What problem does it hit in -O2? Does the PGOMonitor need to be pre-filled? You can perhaps modify it so the first time a name is used, it adds it.
However, thinking some more about this, the code you are emitting is not asm.js anymore. I suppose that's ok, it will still work, just not as quickly. An alternate approach like cvaughn mentioned might be able to avoid that. On Tue, Nov 1, 2016 at 1:47 AM, Александр Гурьянов <[email protected]> wrote: > I use normalizeAsm and denormalizeAsm and all works, but only on O1 mode, > but not in O2 and O3. My impl: > > function pgo(ast) { > var PATCHED_FUNCS = set(); > traverseGeneratedFunctions(ast, function(func) { > var sig = func[1]; > if (sig in PATCHED_FUNCS) return null; > var asmData = normalizeAsm(func); > func[3].unshift(['call', ['name', 'PGO_INVOKE'], [['string', sig]]]); > denormalizeAsm(func, asmData); > PATCHED_FUNCS[sig] = 1; > }); > } > > I found that after enable PGO=1, the PGOMonitor still generates, and > PGOMonitor.allGenerated contains about 10 functions. What is a best way to > fill PGOMonitor with names of generated functions > > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
