move recursion bound selector to HTMLCGBuilder; a temporary solution

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4497 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2012-02-17 20:23:37 +00:00
parent 965896c210
commit e9d2ad598a
3 changed files with 11 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import com.ibm.wala.cast.ir.translator.AstTranslator;
import com.ibm.wala.cast.js.ipa.callgraph.ForInContextSelector;
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
import com.ibm.wala.cast.js.ipa.callgraph.JavaScriptFunctionDotCallTargetSelector;
import com.ibm.wala.cast.js.ipa.callgraph.RecursionBoundContextSelector;
import com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction.CorrelatedPairExtractorFactory;
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil.CGBuilderType;
@ -86,6 +87,12 @@ public class HTMLCGBuilder {
builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url, builderType);
builder.setContextSelector(new ForInContextSelector(2, builder.getContextSelector()));
builder.setContextSelector(new ForInContextSelector(3, builder.getContextSelector()));
// TODO we need to find a better way to do this ContextSelector delegation;
// the code below belongs somewhere else!!!
// the bound of 4 is what is needed to pass our current framework tests
if (AstTranslator.NEW_LEXICAL) {
builder.setContextSelector(new RecursionBoundContextSelector(builder.getContextSelector(), 4));
}
ProgressMaster master = ProgressMaster.make(new NullProgressMonitor());
if (timeout > 0) {
master.setMillisPerWorkItem(timeout * 1000);

View File

@ -143,6 +143,9 @@ public class ForInContextSelector implements ContextSelector {
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
return other != null &&
getClass().equals(other.getClass()) &&
base.equals(((SelectiveCPAContext)other).base) &&

View File

@ -83,12 +83,10 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
if (doOneCFA) {
contextSelector = new nCFAContextSelector(1, contextSelector);
}
if (AstTranslator.NEW_LEXICAL) {
contextSelector = new RecursionBoundContextSelector(contextSelector, 3);
}
setContextSelector(contextSelector);
}
private void setupMethodTargetSelector(IClassHierarchy cha, JSAnalysisOptions options) {
MethodTargetSelector targetSelector = new JavaScriptConstructTargetSelector(cha, options
.getMethodTargetSelector());