int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType; // we're not distinguishing strings yet Node ifTrue = n.getFirstChild().getNext(); Node ifFalse = ifTrue.getNext(); int ifTrueType = findExpressionType(fn, ifTrue, varTypes); int ifFalseType = findExpressionType(fn, ifFalse, varTypes); return ifTrueType | ifFalseType; case Token.SETPROP: case Token.SETELEM: return findExpressionType(fn, n.getLastChild(), varTypes); int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType;
int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType; // we're not distinguishing strings yet Node ifTrue = n.getFirstChild().getNext(); Node ifFalse = ifTrue.getNext(); int ifTrueType = findExpressionType(fn, ifTrue, varTypes); int ifFalseType = findExpressionType(fn, ifFalse, varTypes); return ifTrueType | ifFalseType; case Token.SETPROP: case Token.SETELEM: return findExpressionType(fn, n.getLastChild(), varTypes); int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType;
int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType; // we're not distinguishing strings yet Node ifTrue = n.getFirstChild().getNext(); Node ifFalse = ifTrue.getNext(); int ifTrueType = findExpressionType(fn, ifTrue, varTypes); int ifFalseType = findExpressionType(fn, ifFalse, varTypes); return ifTrueType | ifFalseType; case Token.SETPROP: case Token.SETELEM: return findExpressionType(fn, n.getLastChild(), varTypes); int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType;
int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType; // we're not distinguishing strings yet int result = Optimizer.NoType; while (child != null) { result |= findExpressionType(fn, child, varTypes); child = child.getNext();
int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType; // we're not distinguishing strings yet Node ifTrue = n.getFirstChild().getNext(); Node ifFalse = ifTrue.getNext(); int ifTrueType = findExpressionType(fn, ifTrue, varTypes); int ifFalseType = findExpressionType(fn, ifFalse, varTypes); return ifTrueType | ifFalseType; case Token.SETPROP: case Token.SETELEM: return findExpressionType(fn, n.getLastChild(), varTypes); int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType;
int lType = findExpressionType(fn, child, varTypes); int rType = findExpressionType(fn, child.getNext(), varTypes); return lType | rType; // we're not distinguishing strings yet int result = Optimizer.NoType; while (child != null) { result |= findExpressionType(fn, child, varTypes); child = child.getNext();
private static boolean findDefPoints(OptFunctionNode fn, Node n, int[] varTypes) { boolean result = false; Node first = n.getFirstChild(); for (Node next = first; next != null; next = next.getNext()) { result |= findDefPoints(fn, next, varTypes); } switch (n.getType()) { case Token.DEC : case Token.INC : if (first.getType() == Token.GETVAR) { // theVar is a Number now int i = fn.getVarIndex(first); result |= assignType(varTypes, i, Optimizer.NumberType); } break; case Token.SETVAR : { Node rValue = first.getNext(); int theType = findExpressionType(fn, rValue, varTypes); int i = fn.getVarIndex(n); result |= assignType(varTypes, i, theType); break; } } return result; }
private static boolean findDefPoints(OptFunctionNode fn, Node n, int[] varTypes) { boolean result = false; Node first = n.getFirstChild(); for (Node next = first; next != null; next = next.getNext()) { result |= findDefPoints(fn, next, varTypes); } switch (n.getType()) { case Token.DEC : case Token.INC : if (first.getType() == Token.GETVAR) { // theVar is a Number now int i = fn.getVarIndex(first); result |= assignType(varTypes, i, Optimizer.NumberType); } break; case Token.SETVAR : { Node rValue = first.getNext(); int theType = findExpressionType(fn, rValue, varTypes); int i = fn.getVarIndex(n); result |= assignType(varTypes, i, theType); break; } } return result; }
case Token.SETCONSTVAR : { Node rValue = first.getNext(); int theType = findExpressionType(fn, rValue, varTypes); int i = fn.getVarIndex(n); if (!(n.getType() == Token.SETVAR
case Token.SETCONSTVAR : { Node rValue = first.getNext(); int theType = findExpressionType(fn, rValue, varTypes); int i = fn.getVarIndex(n); if (!(n.getType() == Token.SETVAR
case Token.SETVAR : { Node rValue = child.getNext(); int theType = findExpressionType(fn, rValue, varTypes); int i = fn.getVarIndex(n); result |= assignType(varTypes, i, theType);
case Token.SETVAR : { Node rValue = child.getNext(); int theType = findExpressionType(fn, rValue, varTypes); int i = fn.getVarIndex(n); result |= assignType(varTypes, i, theType);