|
172 | 172 | //Identifying Non-native -> Native Calls
|
173 | 173 | if ((f.toString().indexOf('[native code]') > -1 || f.toString().indexOf('[object ') === 0)) {
|
174 | 174 | callerIid = getLoc(giid);
|
175 |
| - if (["apply","call"].includes(funName) || funName.startsWith("bound ")){ |
176 |
| - applyStack.push(giid) |
| 175 | + //if (["apply","call"].includes(funName) || funName.startsWith("bound ")){ |
| 176 | + //applyStack.push(giid) |
177 | 177 | calleeIid = iidToFunName[giid] + " (Native)" + " [" + getLoc(giid)+"]"
|
178 |
| - } |
179 |
| - else{ |
180 |
| - calleeIid = iidToFunName[giid] + " (Native)" |
181 |
| - } |
| 178 | + //} |
| 179 | + //else{ |
| 180 | + //calleeIid = iidToFunName[giid] + " (Native)" |
| 181 | + //} |
182 | 182 |
|
183 | 183 | //Adding the caller and the callee to the call edge list
|
184 | 184 | if (!(callerIid in callerToCallee)) {
|
|
190 | 190 | calleeIids.push(calleeIid);
|
191 | 191 | }
|
192 | 192 |
|
193 |
| - callStack.push(giid); |
| 193 | + callStack.push(giid); //what if we move this out and use this for both native and non-native calls |
194 | 194 | }
|
195 | 195 | },
|
196 | 196 |
|
|
224 | 224 | }
|
225 | 225 | else{
|
226 | 226 | //Identifying Native -> Non-native Calls
|
227 |
| - if ((["apply","call"].includes(callerName) || callerName.startsWith("bound ")) && applyStack.length>0){ |
228 |
| - var apcal_loc= applyStack[applyStack.length - 1]; |
229 |
| - callerIid = callerName + " (Native)" + " [" + getLoc(apcal_loc) +"]" ; |
230 |
| - } |
231 |
| - else{ |
232 |
| - callerIid = callerName + " (Native)" |
233 |
| - } |
| 227 | + //if ((["apply","call"].includes(callerName) || callerName.startsWith("bound ")) && applyStack.length>0){ |
| 228 | + //var apcal_loc= applyStack[applyStack.length - 1]; |
| 229 | + //callerIid = callerName + " (Native)" + " [" + getLoc(apcal_loc) +"]" ; |
| 230 | + if(callStack.length>0){ |
| 231 | + callerIid = callerName + " (Native)" + " [" + getLoc(callStack[callStack.length - 1]) +"]" ; |
| 232 | + }else{ |
| 233 | + callerIid = callerName + " (Native)" |
| 234 | + } |
| 235 | + |
| 236 | + //} |
| 237 | + //else{ |
| 238 | + //callerIid = callerName + " (Native)" |
| 239 | + //} |
234 | 240 |
|
235 | 241 | }
|
236 | 242 | }
|
|
316 | 322 | if (callStack[callStack.length - 1] == giid) {
|
317 | 323 | callStack.pop();
|
318 | 324 | }
|
319 |
| - if (applyStack[applyStack.length - 1] == giid) { |
| 325 | + /*if (applyStack[applyStack.length - 1] == giid) { |
320 | 326 | applyStack.pop();
|
321 |
| - } |
| 327 | + }*/ |
322 | 328 |
|
323 | 329 | },
|
324 | 330 | /**
|
|
356 | 362 | }
|
357 | 363 | }
|
358 | 364 | //Writing the output to a file
|
359 |
| - if (!isBrowser) { |
| 365 | + /*if (!isBrowser) { |
360 | 366 | var jsonString = JSON.stringify(jsonCallList,null,4)
|
361 | 367 | origName = process.argv[1];
|
362 | 368 | instname = origName.replace(/.js$/, "_dynCalls.json");
|
363 | 369 | fs.writeFileSync(instname, jsonString, function(err) {
|
364 | 370 | if(err) console.log('error', err);
|
365 | 371 | });
|
366 |
| - } |
| 372 | + }*/ |
367 | 373 | J$.callList=jsonCallList
|
| 374 | + //console.log(jsonCallList) |
368 | 375 | return J$.callList
|
369 | 376 | }
|
370 | 377 |
|
|
0 commit comments