1.输出各阶段的asm

1
/Tools/Scripts/run-jsc <arg> /path/to/jsfile &> ~/out

其中arg可以为

1
2
3
4
5
6
7
JSC_dumpDisassembly = true    转储所有JIT编译函数的反汇编。
JSC_dumpDFGDisassembly = true 转储DFG和FTL编译函数的反汇编。
JSC_dumpFTLDisassembly = true 转储FTL编译函数的反汇编。
JSC_dumpSourceAtDFGTime = true 转储DFG/FTL编译函数的来源。
JSC_dumpBytecodeAtDFGTime = true 转储DFG/FTL编译函数的字节码。
JSC_dumpGraphAfterParsing = true 在DFG/FTL编译时解析函数字节码后转储DFG图。
JSC_dumpGraphAtEachPhase = true 在DFG/FTL编译的每个阶段之后转储DFG图。

一例

1
./Tools/Scripts/run-jsc --JSC_dumpDisassembly=true --JSC_dumpDFGDisassembly=true --JSC_dumpFTLDisassembly=true --JSC_dumpSourceAtDFGTime=true --JSC_dumpBytecodeAtDFGTime=true --JSC_dumpGraphAfterParsing=true --JSC_dumpGraphAtEachPhase=true /home/r00t/workspace/poc3.js &> ~/log

https://webkit.org/blog/6411/

2.lldb输出崩溃信息

1
bugreport unwind -outfile </path/to/logfile>

也可以在lldb shell里使用log enable,语法

1
log enable <cmd-options> <log-channel> <log-category> [<log-category> [...]]

一例

1
log enable lldb all -f ~/test

3.js代码断点(类似v8的%SystemBreak();)

1
b arrayProtoFuncSlice

在js代码中调用

1
Array.prototype.slice([]);