我正在尝试在 SSA IR 指令与 JavaScript 文件的原始指令之间建立映射。我已经得到了 JavaScript 文件的 IR。但是红外输出让我很困惑。我正在使用 Watson Libraries for Analysis (WALA) 来生成 SSA IR。输出IR如下:
<Code body of function LhtmlPage.html1626059688264016411.js/__WINDOW_MAIN__/f>
CFG:
BB0[-1..-2]
-> BB1
BB1[0..12]
-> BB3
-> BB2
BB2[13..13]
-> BB4
BB3[14..14]
-> BB4
BB4[-1..-2]
Instructions:
0 v3 = new <JavaScriptLoader,LArray>@0 [include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [304->423] (line 20) [3=[arguments]]
1 v6 = global:global $$undefined [include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [323->334] (line 21) [6=[x, y]]
2 putfield v2.< JavaScriptLoader, LRoot, x, <JavaScriptLoader,LRoot> > = v6[include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [323->334] (line 21) [2=[this]6=[x, y]]
4 v10 = global:global $$undefined [include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [339->345] (line 22) [10=[y]]
5 putfield v2.< JavaScriptLoader, LRoot, y, <JavaScriptLoader,LRoot> > = v10[include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [339->345] (line 22) [2=[this]10=[y]]
7 putfield v2.< JavaScriptLoader, LRoot, x, <JavaScriptLoader,LRoot> > = v13:#10.0[include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [323->334] (line 21) [2=[this]13=[x, y]]
9 putfield v2.< JavaScriptLoader, LRoot, y, <JavaScriptLoader,LRoot> > = v13:#10.0[include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [350->355] (line 23) [2=[this]13=[x, y]]
11 v15 = binaryop(eq) v13:#10.0 , v16:#100.0[include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [364->372] (line 24) [13=[x, y]]
12 conditional branch(eq, to iindex=14) v15,v17:#0[include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [361->402] (line 24)
13 return v18:#true [include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [384->396] (line 25)
14 return v19:#false [include:htmlPage.html [73->110] (line 6)]bundle-bg1.js [407->420] (line 27)
我的测试代码是:
function f() {
var x = 10;
var y;
y = x;
if(y == 100) {
return true;
}
return false;
}
var b = f();
如何将此代码映射到 IR 并识别操作数和运算符?任何帮助将不胜感激。