jdk.nashorn.internal.runtime.Timing Java Examples
The following examples show how to use
jdk.nashorn.internal.runtime.Timing.
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: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * This should be used to create one and only one function node * * @param scriptName name for the script, given to the parsed FunctionNode * @param startPos start position in source * @param len length of parse * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a * property getter or setter in an object literal. * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) { final boolean isTimingEnabled = env.isTimingEnabled(); final long t0 = isTimingEnabled ? System.nanoTime() : 0L; log.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null); lexer.line = lexer.pendingLine = lineOffset + 1; line = lineOffset; // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName, allowPropertyFunction); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (isTimingEnabled) { env._timing.accumulateTime(toString(), System.nanoTime() - t0); log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms"); } else { log.info(end); } } }
Example #2
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * This should be used to create one and only one function node * * @param scriptName name for the script, given to the parsed FunctionNode * @param startPos start position in source * @param len length of parse * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a * property getter or setter in an object literal. * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) { final boolean isTimingEnabled = env.isTimingEnabled(); final long t0 = isTimingEnabled ? System.nanoTime() : 0L; log.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null); lexer.line = lexer.pendingLine = lineOffset + 1; line = lineOffset; // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName, allowPropertyFunction); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (isTimingEnabled) { env._timing.accumulateTime(toString(), System.nanoTime() - t0); log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms"); } else { log.info(end); } } }
Example #3
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * This should be used to create one and only one function node * * @param scriptName name for the script, given to the parsed FunctionNode * @param startPos start position in source * @param len length of parse * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a * property getter or setter in an object literal. * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) { final boolean isTimingEnabled = env.isTimingEnabled(); final long t0 = isTimingEnabled ? System.nanoTime() : 0L; log.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null); lexer.line = lexer.pendingLine = lineOffset + 1; line = lineOffset; // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName, allowPropertyFunction); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (isTimingEnabled) { env._timing.accumulateTime(toString(), System.nanoTime() - t0); log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms"); } else { log.info(end); } } }
Example #4
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * This should be used to create one and only one function node * * @param scriptName name for the script, given to the parsed FunctionNode * @param startPos start position in source * @param len length of parse * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a * property getter or setter in an object literal. * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) { final boolean isTimingEnabled = env.isTimingEnabled(); final long t0 = isTimingEnabled ? System.nanoTime() : 0L; log.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null); lexer.line = lexer.pendingLine = lineOffset + 1; line = lineOffset; // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName, allowPropertyFunction); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (isTimingEnabled) { env._timing.accumulateTime(toString(), System.nanoTime() - t0); log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms"); } else { log.info(end); } } }
Example #5
Source File: Parser.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * This should be used to create one and only one function node * * @param scriptName name for the script, given to the parsed FunctionNode * @param startPos start position in source * @param len length of parse * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a * property getter or setter in an object literal. * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) { final boolean isTimingEnabled = env.isTimingEnabled(); final long t0 = isTimingEnabled ? System.nanoTime() : 0L; log.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null); lexer.line = lexer.pendingLine = lineOffset + 1; line = lineOffset; // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName, allowPropertyFunction); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (isTimingEnabled) { env._timing.accumulateTime(toString(), System.nanoTime() - t0); log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms"); } else { log.info(end); } } }
Example #6
Source File: Parser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * @param scriptName name for the script, given to the parsed FunctionNode * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName) { final long t0 = Timing.isEnabled() ? System.currentTimeMillis() : 0L; LOG.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, stream, scripting && !env._no_syntax_extensions); // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (Timing.isEnabled()) { Timing.accumulateTime(toString(), System.currentTimeMillis() - t0); LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms"); } else { LOG.info(end); } } }
Example #7
Source File: Parser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * @param scriptName name for the script, given to the parsed FunctionNode * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName) { final long t0 = Timing.isEnabled() ? System.currentTimeMillis() : 0L; LOG.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, stream, scripting && !env._no_syntax_extensions); // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (Timing.isEnabled()) { Timing.accumulateTime(toString(), System.currentTimeMillis() - t0); LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms"); } else { LOG.info(end); } } }
Example #8
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * This should be used to create one and only one function node * * @param scriptName name for the script, given to the parsed FunctionNode * @param startPos start position in source * @param len length of parse * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a * property getter or setter in an object literal. * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) { final boolean isTimingEnabled = env.isTimingEnabled(); final long t0 = isTimingEnabled ? System.nanoTime() : 0L; log.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null); lexer.line = lexer.pendingLine = lineOffset + 1; line = lineOffset; // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName, allowPropertyFunction); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (isTimingEnabled) { env._timing.accumulateTime(toString(), System.nanoTime() - t0); log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms"); } else { log.info(end); } } }
Example #9
Source File: Parser.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Execute parse and return the resulting function node. * Errors will be thrown and the error manager will contain information * if parsing should fail * * @param scriptName name for the script, given to the parsed FunctionNode * * @return function node resulting from successful parse */ public FunctionNode parse(final String scriptName) { final long t0 = Timing.isEnabled() ? System.currentTimeMillis() : 0L; LOG.info(this, " begin for '", scriptName, "'"); try { stream = new TokenStream(); lexer = new Lexer(source, stream, scripting && !env._no_syntax_extensions); // Set up first token (skips opening EOL.) k = -1; next(); // Begin parse. return program(scriptName); } catch (final Exception e) { handleParseException(e); return null; } finally { final String end = this + " end '" + scriptName + "'"; if (Timing.isEnabled()) { Timing.accumulateTime(toString(), System.currentTimeMillis() - t0); LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms"); } else { LOG.info(end); } } }