jdk.nashorn.internal.runtime.Debug Java Examples
The following examples show how to use
jdk.nashorn.internal.runtime.Debug.
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: LexicalContext.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #2
Source File: LexicalContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #3
Source File: MethodHandleFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #4
Source File: MethodHandleFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #5
Source File: LexicalContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #6
Source File: LexicalContext.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #7
Source File: MethodHandleFactory.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #8
Source File: MethodHandleFactory.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id((((ScriptObject)arg).getMap())) + ")"; } return arg.toString(); }
Example #9
Source File: MethodHandleFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #10
Source File: LexicalContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #11
Source File: LexicalContext.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #12
Source File: MethodHandleFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #13
Source File: LexicalContext.java From nashorn with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #14
Source File: MethodHandleFactory.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #15
Source File: LexicalContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #16
Source File: MethodHandleFactory.java From nashorn with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id((((ScriptObject)arg).getMap())) + ")"; } return arg.toString(); }
Example #17
Source File: LexicalContext.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #18
Source File: MethodHandleFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + ')'; } return arg.toString(); }
Example #19
Source File: LexicalContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("[ "); for (int i = 0; i < sp; i++) { final Object node = stack[i]; sb.append(node.getClass().getSimpleName()); sb.append('@'); sb.append(Debug.id(node)); sb.append(':'); if (node instanceof FunctionNode) { final FunctionNode fn = (FunctionNode)node; final Source source = fn.getSource(); String src = source.toString(); if (src.contains(File.pathSeparator)) { src = src.substring(src.lastIndexOf(File.pathSeparator)); } src += ' '; src += fn.getLineNumber(); sb.append(src); } sb.append(' '); } sb.append(" ==> ]"); return sb.toString(); }
Example #20
Source File: MethodHandleFactory.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static String argString(final Object arg) { if (arg == null) { return "null"; } if (arg.getClass().isArray()) { final List<Object> list = new ArrayList<>(); for (final Object elem : (Object[])arg) { list.add('\'' + argString(elem) + '\''); } return list.toString(); } if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id((((ScriptObject)arg).getMap())) + ")"; } return arg.toString(); }
Example #21
Source File: LinkerCallSite.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getName() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (getNashornDescriptor().isTraceScope() || !(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }
Example #22
Source File: LinkerCallSite.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getName() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (getNashornDescriptor().isTraceScope() || !(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }
Example #23
Source File: Symbol.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void trace(final String desc) { if (TRACE_SYMBOLS != null && (TRACE_SYMBOLS.isEmpty() || TRACE_SYMBOLS.contains(name))) { Context.err(Debug.id(this) + " SYMBOL: '" + name + "' " + desc); if (TRACE_SYMBOLS_STACKTRACE != null && (TRACE_SYMBOLS_STACKTRACE.isEmpty() || TRACE_SYMBOLS_STACKTRACE.contains(name))) { new Throwable().printStackTrace(Context.getCurrentErr()); } } }
Example #24
Source File: LinkerCallSite.java From hottub with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getName() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (!(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }
Example #25
Source File: Symbol.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void trace(final String desc) { if (TRACE_SYMBOLS != null && (TRACE_SYMBOLS.isEmpty() || TRACE_SYMBOLS.contains(name))) { Context.err(Debug.id(this) + " SYMBOL: '" + name + "' " + desc); if (TRACE_SYMBOLS_STACKTRACE != null && (TRACE_SYMBOLS_STACKTRACE.isEmpty() || TRACE_SYMBOLS_STACKTRACE.contains(name))) { new Throwable().printStackTrace(Context.getCurrentErr()); } } }
Example #26
Source File: LinkerCallSite.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getOperation() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (!(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }
Example #27
Source File: LinkerCallSite.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getName() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (!(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }
Example #28
Source File: LinkerCallSite.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getName() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (!(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }
Example #29
Source File: FinalizeTypes.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * A symbol (and {@link jdk.nashorn.internal.runtime.Property}) can be tagged as "may be primitive". * This is used a hint for dual fields that it is even worth it to try representing this * field as something other than java.lang.Object. * * @param node node in which to tag symbols as primitive * @param to which primitive type to use for tagging */ private static void setCanBePrimitive(final Node node, final Type to) { final HashSet<Node> exclude = new HashSet<>(); node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) { private void setCanBePrimitive(final Symbol symbol) { LOG.info("*** can be primitive symbol ", symbol, " ", Debug.id(symbol)); symbol.setCanBePrimitive(to); } @Override public boolean enterIdentNode(final IdentNode identNode) { if (!exclude.contains(identNode)) { setCanBePrimitive(identNode.getSymbol()); } return false; } @Override public boolean enterAccessNode(final AccessNode accessNode) { setCanBePrimitive(accessNode.getProperty().getSymbol()); return false; } @Override public boolean enterIndexNode(final IndexNode indexNode) { exclude.add(indexNode.getBase()); //prevent array base node to be flagged as primitive, but k in a[k++] is fine return true; } }); }
Example #30
Source File: LinkerCallSite.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void tracePrint(final PrintWriter out, final String tag, final Object[] args, final Object result) { //boolean isVoid = type().returnType() == void.class; out.print(Debug.id(this) + " TAG " + tag); out.print(getDescriptor().getName() + "("); if (args.length > 0) { printObject(out, args[0]); for (int i = 1; i < args.length; i++) { final Object arg = args[i]; out.print(", "); if (!(arg instanceof ScriptObject && ((ScriptObject)arg).isScope())) { printObject(out, arg); } else { out.print("SCOPE"); } } } out.print(")"); if (tag.equals("EXIT ")) { out.print(" --> "); printObject(out, result); } out.println(); }