private InstanceKeyFactory getSelector(TypeReference type) { return languageSelectors.get(getLanguage(type)); }
@Override public InstanceKey getInstanceKeyForPEI(CGNode node, ProgramCounter instr, TypeReference type) { assert getSelector(type) != null : "no instance keys for " + type; return getSelector(type).getInstanceKeyForPEI(node, instr, type); }
public JavaJavaScriptHybridCallGraphBuilder(IMethod fakeRootClass, AnalysisOptions options, IAnalysisCacheView cache) { super(fakeRootClass, options, cache, new AstCFAPointerKeys()); globalObject = new GlobalObjectKey(cha.lookupClass(JavaScriptTypes.Root)); SSAContextInterpreter contextInterpreter = makeDefaultContextInterpreters(null, options, cha); setContextInterpreter( contextInterpreter ); ContextSelector def = new DefaultContextSelector(options, cha); Map<Atom,ContextSelector> languageSelectors = HashMapFactory.make(); languageSelectors.put(JavaScriptTypes.jsName, new JavaScriptFunctionApplyContextSelector(new JavaScriptConstructorContextSelector(def))); languageSelectors.put(Language.JAVA.getName(), def); setContextSelector(new CrossLanguageContextSelector(languageSelectors)); Map<Atom,InstanceKeyFactory> instanceKeys = HashMapFactory.make(); instanceKeys.put( JavaScriptTypes.jsName, new JavaScriptScopeMappingInstanceKeys(cha, this, new JavaScriptConstructorInstanceKeys(new ZeroXInstanceKeys( options, cha, contextInterpreter, ZeroXInstanceKeys.ALLOCATIONS)))); instanceKeys.put( Language.JAVA.getName(), new ZeroXInstanceKeys(options, cha, contextInterpreter, ZeroXInstanceKeys.NONE)); setInstanceKeys(new CrossLanguageInstanceKeys(instanceKeys)); }
@Override public InstanceKey getInstanceKeyForPEI(CGNode node, ProgramCounter instr, TypeReference type) { assert getSelector(type) != null : "no instance keys for " + type; return getSelector(type).getInstanceKeyForPEI(node, instr, type); }
private InstanceKeyFactory getSelector(TypeReference type) { return languageSelectors.get(getLanguage(type)); }
@Override public InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) { return getSelector(allocation).getInstanceKeyForAllocation(node, allocation); }
private InstanceKeyFactory getSelector(NewSiteReference site) { return languageSelectors.get(getLanguage(site)); }
@Override public InstanceKey getInstanceKeyForMetadataObject(Object obj, TypeReference objType) { return getSelector(objType).getInstanceKeyForMetadataObject(obj, objType); }
private InstanceKeyFactory getSelector(NewSiteReference site) { return languageSelectors.get(getLanguage(site)); }
@Override public InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) { return getSelector(allocation).getInstanceKeyForAllocation(node, allocation); }
private static Atom getLanguage(NewSiteReference site) { return getLanguage(site.getDeclaredType()); }
@Override public InstanceKey getInstanceKeyForMetadataObject(Object obj, TypeReference objType) { return getSelector(objType).getInstanceKeyForMetadataObject(obj, objType); }
private static Atom getLanguage(NewSiteReference site) { return getLanguage(site.getDeclaredType()); }
@Override public InstanceKey getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim) { return getSelector(allocation).getInstanceKeyForMultiNewArray(node, allocation, dim); }
@Override public InstanceKey getInstanceKeyForConstant(TypeReference type, Object S) { return getSelector(type).getInstanceKeyForConstant(type, S); }
@Override public InstanceKey getInstanceKeyForMultiNewArray(CGNode node, NewSiteReference allocation, int dim) { return getSelector(allocation).getInstanceKeyForMultiNewArray(node, allocation, dim); }
@Override public InstanceKey getInstanceKeyForConstant(TypeReference type, Object S) { return getSelector(type).getInstanceKeyForConstant(type, S); }