@Override public GlobalObjectKey getGlobalObject(Atom language) { assert language.equals(JavaScriptTypes.jsName); return globalObject; }
@Override public boolean equals(Object obj) { // using instanceof is OK because Selector is final if (obj instanceof Selector) { Selector other = (Selector) obj; return name.equals(other.name) && descriptor.equals(other.descriptor); } else { return false; } }
@Override public final boolean equals(Object other) { assert other != null && this.getClass().equals(other.getClass()); Key that = (Key) other; return type.equals(that.type) && name.equals(that.name) && descriptor.equals(that.descriptor); } }
/** * return true iff m represents one of the well-known methods in * java.lang.reflect.Arrays that do some sort of arraycopy */ private static boolean isArrayCopyMethod(MethodReference m) { if (m.getDeclaringClass().equals(Arrays)) { if (m.getName().equals(asList) || m.getName().equals(copyOf) || m.getName().equals(copyOfRange)) { return true; } } return false; }
@Override public boolean equals(Object o) { if (!(o instanceof LanguageImpl)) return false; LanguageImpl other= (LanguageImpl) o; return getName().equals(other.getName()); }
/** * Does not consider the associated URI. */ public boolean equalAction(Intent other) { return getAction().equals(other.getAction()); }
@Override public boolean equals(Object o) { if (!(o instanceof LanguageImpl)) return false; LanguageImpl other= (LanguageImpl) o; return getName().equals(other.getName()); }
public Intent findOrCreateImmutable(final Intent intent) { if (immutables.containsKey(intent)) { final Intent immutable = immutables.get(intent); assert (immutable.getAction().equals(intent.getAction())); return immutable; } else { final Intent immutable = intent.clone(); immutable.setImmutable(); immutables.put(intent, immutable); return immutable; } }
public Intent findOrCreateImmutable(final Intent intent) { if (immutables.containsKey(intent)) { final Intent immutable = immutables.get(intent); assert (immutable.getAction().equals(intent.getAction())); return immutable; } else { final Intent immutable = intent.clone(); immutable.setImmutable(); immutables.put(intent, immutable); return immutable; } }
private enum Explicit { UNSET, IMPLICIT, EXPLICIT, /** An other target was set for an explicit Intent */ MULTI }
private enum Explicit { UNSET, IMPLICIT, EXPLICIT, /** An other target was set for an explicit Intent */ MULTI }
private static IMethod getCallTargetMethod(IMethod method) { if(method.getName().equals(JavaScriptMethods.ctorAtom)) { method = method.getDeclaringClass().getMethod(AstMethodReference.fnSelector); if(method != null) return method; } return method; }
private static IMethod getCallTargetMethod(IMethod method) { if(method.getName().equals(JavaScriptMethods.ctorAtom)) { method = method.getDeclaringClass().getMethod(AstMethodReference.fnSelector); if(method != null) return method; } return method; }
public Intent findOrCreate(final InstanceKey key, String action) { final Intent intent = findOrCreate(key); final Atom foundAction = intent.getAction(); if (! foundAction.equals(Atom.findOrCreateAsciiAtom(action))) { throw new IllegalArgumentException("Actions differ (" + action + ", " + foundAction.toString() + ") for Intent " + key); } return intent; }
public Intent findOrCreate(final InstanceKey key, String action) { final Intent intent = findOrCreate(key); final Atom foundAction = intent.getAction(); if (! foundAction.equals(Atom.findOrCreateAsciiAtom(action))) { throw new IllegalArgumentException("Actions differ (" + action + ", " + foundAction.toString() + ") for Intent " + key); } return intent; }
public static CGNode findMethod(CallGraph cg, String name) { Atom a = Atom.findOrCreateUnicodeAtom(name); for (CGNode n : cg) { if (n.getMethod().getName().equals(a)) { return n; } } System.err.println("call graph " + cg); Assertions.UNREACHABLE("failed to find method " + name); return null; }
@SuppressWarnings("unused") private static OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException { SSAAbstractInvokeInstruction invoke = callVertex.getInstruction(); assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom); VarVertex objectParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(0)); return flowGraph.getReachingSet(objectParam, monitor); }
@SuppressWarnings("unused") private static OrdinalSet<FuncVertex> getConstructorTargets(FlowGraph flowGraph, CallVertex callVertex, IProgressMonitor monitor) throws CancelException { SSAAbstractInvokeInstruction invoke = callVertex.getInstruction(); assert invoke.getDeclaredTarget().getName().equals(JavaScriptMethods.ctorAtom); VarVertex objectParam = flowGraph.getVertexFactory().makeVarVertex(callVertex.getCaller(), invoke.getUse(0)); return flowGraph.getReachingSet(objectParam, monitor); }
public static CGNode findInstanceMethod(CallGraph cg, IClass declaringClass, Atom name, Descriptor args) { for (CGNode n : cg) { // System.err.println(n.getMethod().getDeclaringClass() + " " + // n.getMethod().getName() + " " + n.getMethod().getDescriptor()); if (n.getMethod().getDeclaringClass().equals(declaringClass) && n.getMethod().getName().equals(name) && n.getMethod().getDescriptor().equals(args)) { return n; } } Assertions.UNREACHABLE("failed to find method"); return null; }
public static CGNode findMainMethod(CallGraph cg) { Descriptor d = Descriptor.findOrCreateUTF8("([Ljava/lang/String;)V"); Atom name = Atom.findOrCreateUnicodeAtom("main"); for (CGNode n : Iterator2Iterable.make(cg.getSuccNodes(cg.getFakeRootNode()))) { if (n.getMethod().getName().equals(name) && n.getMethod().getDescriptor().equals(d)) { return n; } } Assertions.UNREACHABLE("failed to find method"); return null; }