jdk.nashorn.internal.ir.Splittable Java Examples

The following examples show how to use jdk.nashorn.internal.ir.Splittable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReplaceCompileUnits.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveLiteralNode(final LiteralNode<?> node) {
    if (node instanceof ArrayLiteralNode) {
        final ArrayLiteralNode aln = (ArrayLiteralNode)node;
        if (aln.getSplitRanges() == null) {
            return node;
        }
        final List<Splittable.SplitRange> newArrayUnits = new ArrayList<>();
        for (final Splittable.SplitRange au : aln.getSplitRanges()) {
            newArrayUnits.add(new Splittable.SplitRange(getExistingReplacement(au), au.getLow(), au.getHigh()));
        }
        return aln.setSplitRanges(lc, newArrayUnits);
    }
    return node;
}
 
Example #2
Source File: WeighNodes.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public boolean enterLiteralNode(final LiteralNode literalNode) {
    weight += LITERAL_WEIGHT;

    if (literalNode instanceof ArrayLiteralNode) {
        final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
        final Node[]           value            = arrayLiteralNode.getValue();
        final int[]            postsets         = arrayLiteralNode.getPostsets();
        final List<Splittable.SplitRange>  units            = arrayLiteralNode.getSplitRanges();

        if (units == null) {
            for (final int postset : postsets) {
                weight += AASTORE_WEIGHT;
                final Node element = value[postset];

                if (element != null) {
                    element.accept(this);
                }
            }
        }

        return false;
    }

    return true;
}
 
Example #3
Source File: ReplaceCompileUnits.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
 
Example #4
Source File: ReplaceCompileUnits.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveLiteralNode(final LiteralNode<?> node) {
    if (node instanceof ArrayLiteralNode) {
        final ArrayLiteralNode aln = (ArrayLiteralNode)node;
        if (aln.getSplitRanges() == null) {
            return node;
        }
        final List<Splittable.SplitRange> newArrayUnits = new ArrayList<>();
        for (final Splittable.SplitRange au : aln.getSplitRanges()) {
            newArrayUnits.add(new Splittable.SplitRange(getExistingReplacement(au), au.getLow(), au.getHigh()));
        }
        return aln.setSplitRanges(lc, newArrayUnits);
    }
    return node;
}
 
Example #5
Source File: WeighNodes.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public boolean enterLiteralNode(final LiteralNode literalNode) {
    weight += LITERAL_WEIGHT;

    if (literalNode instanceof ArrayLiteralNode) {
        final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
        final Node[]           value            = arrayLiteralNode.getValue();
        final int[]            postsets         = arrayLiteralNode.getPostsets();
        final List<Splittable.SplitRange>  units            = arrayLiteralNode.getSplitRanges();

        if (units == null) {
            for (final int postset : postsets) {
                weight += AASTORE_WEIGHT;
                final Node element = value[postset];

                if (element != null) {
                    element.accept(this);
                }
            }
        }

        return false;
    }

    return true;
}
 
Example #6
Source File: ReplaceCompileUnits.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
 
Example #7
Source File: ReplaceCompileUnits.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveLiteralNode(final LiteralNode<?> node) {
    if (node instanceof ArrayLiteralNode) {
        final ArrayLiteralNode aln = (ArrayLiteralNode)node;
        if (aln.getSplitRanges() == null) {
            return node;
        }
        final List<Splittable.SplitRange> newArrayUnits = new ArrayList<>();
        for (final Splittable.SplitRange au : aln.getSplitRanges()) {
            newArrayUnits.add(new Splittable.SplitRange(getExistingReplacement(au), au.getLow(), au.getHigh()));
        }
        return aln.setSplitRanges(lc, newArrayUnits);
    }
    return node;
}
 
Example #8
Source File: WeighNodes.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public boolean enterLiteralNode(final LiteralNode literalNode) {
    if (literalNode instanceof LiteralNode.PrimitiveLiteralNode) {
        weight += CONST_WEIGHT;
        return false;
    }

    weight += LITERAL_WEIGHT;

    if (literalNode instanceof ArrayLiteralNode) {
        final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
        final Node[]           value            = arrayLiteralNode.getValue();
        final int[]            postsets         = arrayLiteralNode.getPostsets();
        final List<Splittable.SplitRange>  units            = arrayLiteralNode.getSplitRanges();

        if (units == null) {
            for (final int postset : postsets) {
                weight += AASTORE_WEIGHT;
                final Node element = value[postset];

                if (element != null) {
                    element.accept(this);
                }
            }
        }

        return false;
    }

    return true;
}
 
Example #9
Source File: ReplaceCompileUnits.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
 
Example #10
Source File: ReplaceCompileUnits.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveLiteralNode(final LiteralNode<?> node) {
    if (node instanceof ArrayLiteralNode) {
        final ArrayLiteralNode aln = (ArrayLiteralNode)node;
        if (aln.getSplitRanges() == null) {
            return node;
        }
        final List<Splittable.SplitRange> newArrayUnits = new ArrayList<>();
        for (final Splittable.SplitRange au : aln.getSplitRanges()) {
            newArrayUnits.add(new Splittable.SplitRange(getExistingReplacement(au), au.getLow(), au.getHigh()));
        }
        return aln.setSplitRanges(lc, newArrayUnits);
    }
    return node;
}
 
Example #11
Source File: WeighNodes.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public boolean enterLiteralNode(final LiteralNode literalNode) {
    weight += LITERAL_WEIGHT;

    if (literalNode instanceof ArrayLiteralNode) {
        final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
        final Node[]           value            = arrayLiteralNode.getValue();
        final int[]            postsets         = arrayLiteralNode.getPostsets();
        final List<Splittable.SplitRange>  units            = arrayLiteralNode.getSplitRanges();

        if (units == null) {
            for (final int postset : postsets) {
                weight += AASTORE_WEIGHT;
                final Node element = value[postset];

                if (element != null) {
                    element.accept(this);
                }
            }
        }

        return false;
    }

    return true;
}
 
Example #12
Source File: ReplaceCompileUnits.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
 
Example #13
Source File: ReplaceCompileUnits.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveLiteralNode(final LiteralNode<?> node) {
    if (node instanceof ArrayLiteralNode) {
        final ArrayLiteralNode aln = (ArrayLiteralNode)node;
        if (aln.getSplitRanges() == null) {
            return node;
        }
        final List<Splittable.SplitRange> newArrayUnits = new ArrayList<>();
        for (final Splittable.SplitRange au : aln.getSplitRanges()) {
            newArrayUnits.add(new Splittable.SplitRange(getExistingReplacement(au), au.getLow(), au.getHigh()));
        }
        return aln.setSplitRanges(lc, newArrayUnits);
    }
    return node;
}
 
Example #14
Source File: WeighNodes.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public boolean enterLiteralNode(final LiteralNode literalNode) {
    weight += LITERAL_WEIGHT;

    if (literalNode instanceof ArrayLiteralNode) {
        final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
        final Node[]           value            = arrayLiteralNode.getValue();
        final int[]            postsets         = arrayLiteralNode.getPostsets();
        final List<Splittable.SplitRange>  units            = arrayLiteralNode.getSplitRanges();

        if (units == null) {
            for (final int postset : postsets) {
                weight += AASTORE_WEIGHT;
                final Node element = value[postset];

                if (element != null) {
                    element.accept(this);
                }
            }
        }

        return false;
    }

    return true;
}
 
Example #15
Source File: ReplaceCompileUnits.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
 
Example #16
Source File: ReplaceCompileUnits.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveLiteralNode(final LiteralNode<?> node) {
    if (node instanceof ArrayLiteralNode) {
        final ArrayLiteralNode aln = (ArrayLiteralNode)node;
        if (aln.getSplitRanges() == null) {
            return node;
        }
        final List<Splittable.SplitRange> newArrayUnits = new ArrayList<>();
        for (final Splittable.SplitRange au : aln.getSplitRanges()) {
            newArrayUnits.add(new Splittable.SplitRange(getExistingReplacement(au), au.getLow(), au.getHigh()));
        }
        return aln.setSplitRanges(lc, newArrayUnits);
    }
    return node;
}
 
Example #17
Source File: WeighNodes.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public boolean enterLiteralNode(final LiteralNode literalNode) {
    weight += LITERAL_WEIGHT;

    if (literalNode instanceof ArrayLiteralNode) {
        final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
        final Node[]           value            = arrayLiteralNode.getValue();
        final int[]            postsets         = arrayLiteralNode.getPostsets();
        final List<Splittable.SplitRange>  units            = arrayLiteralNode.getSplitRanges();

        if (units == null) {
            for (final int postset : postsets) {
                weight += AASTORE_WEIGHT;
                final Node element = value[postset];

                if (element != null) {
                    element.accept(this);
                }
            }
        }

        return false;
    }

    return true;
}
 
Example #18
Source File: ReplaceCompileUnits.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node leaveObjectNode(final ObjectNode objectNode) {
    final List<Splittable.SplitRange> ranges = objectNode.getSplitRanges();
    if (ranges != null) {
        final List<Splittable.SplitRange> newRanges = new ArrayList<>();
        for (final Splittable.SplitRange range : ranges) {
            newRanges.add(new Splittable.SplitRange(getExistingReplacement(range), range.getLow(), range.getHigh()));
        }
        return objectNode.setSplitRanges(lc, newRanges);
    }
    return super.leaveObjectNode(objectNode);
}
 
Example #19
Source File: AssignSymbols.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSplitLiteral(final LexicalContextNode expr) {
    return expr instanceof Splittable && ((Splittable) expr).getSplitRanges() != null;
}
 
Example #20
Source File: AssignSymbols.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSplitLiteral(final LexicalContextNode expr) {
    return expr instanceof Splittable && ((Splittable) expr).getSplitRanges() != null;
}
 
Example #21
Source File: AssignSymbols.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSplitLiteral(final LexicalContextNode expr) {
    return expr instanceof Splittable && ((Splittable) expr).getSplitRanges() != null;
}
 
Example #22
Source File: AssignSymbols.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSplitLiteral(final LexicalContextNode expr) {
    return expr instanceof Splittable && ((Splittable) expr).getSplitRanges() != null;
}
 
Example #23
Source File: AssignSymbols.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSplitLiteral(final LexicalContextNode expr) {
    return expr instanceof Splittable && ((Splittable) expr).getSplitRanges() != null;
}
 
Example #24
Source File: AssignSymbols.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSplitLiteral(final LexicalContextNode expr) {
    return expr instanceof Splittable && ((Splittable) expr).getSplitRanges() != null;
}