@Override public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) { return new FilterIterator<>( base.getCreationSites(CG), o -> o.fst.equals(creator)); } }
@Override public Iterator<Pair<CGNode, NewSiteReference>> getCreationSites(CallGraph CG) { return new FilterIterator<>( base.getCreationSites(CG), o -> o.fst.equals(creator)); } }
private static <T extends InstanceKey> Set<Pair<CGNode, NewSiteReference>> getPrototypeSites(PointerAnalysis<T> fbPA, CallGraph CG, Function<T,Iterator<T>> proto, CGNode node, int vn) { Set<Pair<CGNode, NewSiteReference>> fbProtos = HashSetFactory.make(); PointerKey fbKey = fbPA.getHeapModel().getPointerKeyForLocal(node, vn); OrdinalSet<T> fbPointsTo = fbPA.getPointsToSet(fbKey); for(T o : fbPointsTo) { for(T p : Iterator2Iterable.make(proto.apply(o))) { for(Pair<CGNode, NewSiteReference> cs : Iterator2Iterable.make(p.getCreationSites(CG))) { fbProtos.add(cs); } } } return fbProtos; }
private static Set<Pair<CGNode, NewSiteReference>> ptrs(Set<CGNode> functions, int local, CallGraph CG, PointerAnalysis<? extends InstanceKey> pa) { Set<Pair<CGNode, NewSiteReference>> result = HashSetFactory.make(); for(CGNode n : functions) { PointerKey l = pa.getHeapModel().getPointerKeyForLocal(n, local); if (l != null) { OrdinalSet<? extends InstanceKey> pointers = pa.getPointsToSet(l); if (pointers != null) { for(InstanceKey k : pointers) { for(Pair<CGNode, NewSiteReference> cs : Iterator2Iterable.make(k.getCreationSites(CG))) { result.add(cs); } } } } } return result; }
k.getCreationSites(fbCG); for(String f : new String[]{ "__proto__", "prototype" }) { boolean dump = false; for(Pair<CGNode, NewSiteReference> cs : Iterator2Iterable.make(k.getCreationSites(fbCG))) { System.err.println(cs);