Java Code Examples for jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor#CALLSITE_TRACE_ENTEREXIT

The following examples show how to use jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor#CALLSITE_TRACE_ENTEREXIT . 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: ScriptEnvironment.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor
 *
 * @param options a Options object
 * @param out output print writer
 * @param err error print writer
 */
public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) {
    this.out = out;
    this.err = err;
    this.namespace = new Namespace();
    this.options = options;

    _class_cache_size     = options.getInteger("class.cache.size");
    _compile_only         = options.getBoolean("compile.only");
    _debug_lines          = options.getBoolean("debug.lines");
    _dest_dir             = options.getString("d");
    _dump_on_error        = options.getBoolean("doe");
    _early_lvalue_error   = options.getBoolean("early.lvalue.error");
    _empty_statements     = options.getBoolean("empty.statements");
    _fullversion          = options.getBoolean("fullversion");
    if(options.getBoolean("function.statement.error")) {
        _function_statement = FunctionStatementBehavior.ERROR;
    } else if(options.getBoolean("function.statement.warning")) {
        _function_statement = FunctionStatementBehavior.WARNING;
    } else {
        _function_statement = FunctionStatementBehavior.ACCEPT;
    }
    _fx                   = options.getBoolean("fx");
    _global_per_engine    = options.getBoolean("global.per.engine");
    _lazy_compilation     = options.getBoolean("lazy.compilation");
    _loader_per_compile   = options.getBoolean("loader.per.compile");
    _no_java              = options.getBoolean("no.java");
    _no_syntax_extensions = options.getBoolean("no.syntax.extensions");
    _no_typed_arrays      = options.getBoolean("no.typed.arrays");
    _parse_only           = options.getBoolean("parse.only");
    _print_ast            = options.getBoolean("print.ast");
    _print_lower_ast      = options.getBoolean("print.lower.ast");
    _print_code           = options.getBoolean("print.code");
    _print_mem_usage      = options.getBoolean("print.mem.usage");
    _print_no_newline     = options.getBoolean("print.no.newline");
    _print_parse          = options.getBoolean("print.parse");
    _print_lower_parse    = options.getBoolean("print.lower.parse");
    _print_symbols        = options.getBoolean("print.symbols");
    _range_analysis       = options.getBoolean("range.analysis");
    _scripting            = options.getBoolean("scripting");
    _strict               = options.getBoolean("strict");
    _version              = options.getBoolean("version");
    _verify_code          = options.getBoolean("verify.code");

    final String specialize = options.getString("specialize.calls");
    if (specialize == null) {
        _specialize_calls = null;
    } else {
        _specialize_calls = new HashSet<>();
        final StringTokenizer st = new StringTokenizer(specialize, ",");
        while (st.hasMoreElements()) {
            _specialize_calls.add(st.nextToken());
        }
    }

    int callSiteFlags = 0;
    if (options.getBoolean("profile.callsites")) {
        callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_PROFILE;
    }

    if (options.get("trace.callsites") instanceof KeyValueOption) {
        callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE;
        final KeyValueOption kv = (KeyValueOption)options.get("trace.callsites");
        if (kv.hasValue("miss")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_MISSES;
        }
        if (kv.hasValue("enterexit") || (callSiteFlags & NashornCallSiteDescriptor.CALLSITE_TRACE_MISSES) == 0) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_ENTEREXIT;
        }
        if (kv.hasValue("objects")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_VALUES;
        }
        if (kv.hasValue("scope")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_SCOPE;
        }
    }
    this._callsite_flags = callSiteFlags;

    final Option<?> timezoneOption = options.get("timezone");
    if (timezoneOption != null) {
        this._timezone = (TimeZone)timezoneOption.getValue();
    } else {
        this._timezone  = TimeZone.getDefault();
    }

    final Option<?> localeOption = options.get("locale");
    if (localeOption != null) {
        this._locale = (Locale)localeOption.getValue();
    } else {
        this._locale = Locale.getDefault();
    }
}
 
Example 2
Source File: ScriptEnvironment.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor
 *
 * @param options a Options object
 * @param out output print writer
 * @param err error print writer
 */
public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) {
    this.out = out;
    this.err = err;
    this.namespace = new Namespace();
    this.options = options;

    _class_cache_size     = options.getInteger("class.cache.size");
    _compile_only         = options.getBoolean("compile.only");
    _debug_lines          = options.getBoolean("debug.lines");
    _dest_dir             = options.getString("d");
    _dump_on_error        = options.getBoolean("doe");
    _early_lvalue_error   = options.getBoolean("early.lvalue.error");
    _empty_statements     = options.getBoolean("empty.statements");
    _fullversion          = options.getBoolean("fullversion");
    if(options.getBoolean("function.statement.error")) {
        _function_statement = FunctionStatementBehavior.ERROR;
    } else if(options.getBoolean("function.statement.warning")) {
        _function_statement = FunctionStatementBehavior.WARNING;
    } else {
        _function_statement = FunctionStatementBehavior.ACCEPT;
    }
    _fx                   = options.getBoolean("fx");
    _global_per_engine    = options.getBoolean("global.per.engine");
    _lazy_compilation     = options.getBoolean("lazy.compilation");
    _loader_per_compile   = options.getBoolean("loader.per.compile");
    _no_java              = options.getBoolean("no.java");
    _no_syntax_extensions = options.getBoolean("no.syntax.extensions");
    _no_typed_arrays      = options.getBoolean("no.typed.arrays");
    _parse_only           = options.getBoolean("parse.only");
    _print_ast            = options.getBoolean("print.ast");
    _print_lower_ast      = options.getBoolean("print.lower.ast");
    _print_code           = options.getBoolean("print.code");
    _print_mem_usage      = options.getBoolean("print.mem.usage");
    _print_no_newline     = options.getBoolean("print.no.newline");
    _print_parse          = options.getBoolean("print.parse");
    _print_lower_parse    = options.getBoolean("print.lower.parse");
    _print_symbols        = options.getBoolean("print.symbols");
    _range_analysis       = options.getBoolean("range.analysis");
    _scripting            = options.getBoolean("scripting");
    _strict               = options.getBoolean("strict");
    _version              = options.getBoolean("version");
    _verify_code          = options.getBoolean("verify.code");

    final String specialize = options.getString("specialize.calls");
    if (specialize == null) {
        _specialize_calls = null;
    } else {
        _specialize_calls = new HashSet<>();
        final StringTokenizer st = new StringTokenizer(specialize, ",");
        while (st.hasMoreElements()) {
            _specialize_calls.add(st.nextToken());
        }
    }

    int callSiteFlags = 0;
    if (options.getBoolean("profile.callsites")) {
        callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_PROFILE;
    }

    if (options.get("trace.callsites") instanceof KeyValueOption) {
        callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE;
        final KeyValueOption kv = (KeyValueOption)options.get("trace.callsites");
        if (kv.hasValue("miss")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_MISSES;
        }
        if (kv.hasValue("enterexit") || (callSiteFlags & NashornCallSiteDescriptor.CALLSITE_TRACE_MISSES) == 0) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_ENTEREXIT;
        }
        if (kv.hasValue("objects")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_VALUES;
        }
        if (kv.hasValue("scope")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_SCOPE;
        }
    }
    this._callsite_flags = callSiteFlags;

    final Option<?> timezoneOption = options.get("timezone");
    if (timezoneOption != null) {
        this._timezone = (TimeZone)timezoneOption.getValue();
    } else {
        this._timezone  = TimeZone.getDefault();
    }

    final Option<?> localeOption = options.get("locale");
    if (localeOption != null) {
        this._locale = (Locale)localeOption.getValue();
    } else {
        this._locale = Locale.getDefault();
    }
}
 
Example 3
Source File: ScriptEnvironment.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor
 *
 * @param options a Options object
 * @param out output print writer
 * @param err error print writer
 */
public ScriptEnvironment(final Options options, final PrintWriter out, final PrintWriter err) {
    this.out = out;
    this.err = err;
    this.namespace = new Namespace();
    this.options = options;

    _class_cache_size     = options.getInteger("class.cache.size");
    _compile_only         = options.getBoolean("compile.only");
    _debug_lines          = options.getBoolean("debug.lines");
    _dest_dir             = options.getString("d");
    _dump_on_error        = options.getBoolean("doe");
    _early_lvalue_error   = options.getBoolean("early.lvalue.error");
    _empty_statements     = options.getBoolean("empty.statements");
    _fullversion          = options.getBoolean("fullversion");
    if(options.getBoolean("function.statement.error")) {
        _function_statement = FunctionStatementBehavior.ERROR;
    } else if(options.getBoolean("function.statement.warning")) {
        _function_statement = FunctionStatementBehavior.WARNING;
    } else {
        _function_statement = FunctionStatementBehavior.ACCEPT;
    }
    _fx                   = options.getBoolean("fx");
    _global_per_engine    = options.getBoolean("global.per.engine");
    _lazy_compilation     = options.getBoolean("lazy.compilation");
    _loader_per_compile   = options.getBoolean("loader.per.compile");
    _no_java              = options.getBoolean("no.java");
    _no_syntax_extensions = options.getBoolean("no.syntax.extensions");
    _no_typed_arrays      = options.getBoolean("no.typed.arrays");
    _parse_only           = options.getBoolean("parse.only");
    _print_ast            = options.getBoolean("print.ast");
    _print_lower_ast      = options.getBoolean("print.lower.ast");
    _print_code           = options.getBoolean("print.code");
    _print_mem_usage      = options.getBoolean("print.mem.usage");
    _print_no_newline     = options.getBoolean("print.no.newline");
    _print_parse          = options.getBoolean("print.parse");
    _print_lower_parse    = options.getBoolean("print.lower.parse");
    _print_symbols        = options.getBoolean("print.symbols");
    _range_analysis       = options.getBoolean("range.analysis");
    _scripting            = options.getBoolean("scripting");
    _strict               = options.getBoolean("strict");
    _version              = options.getBoolean("version");
    _verify_code          = options.getBoolean("verify.code");

    final String specialize = options.getString("specialize.calls");
    if (specialize == null) {
        _specialize_calls = null;
    } else {
        _specialize_calls = new HashSet<>();
        final StringTokenizer st = new StringTokenizer(specialize, ",");
        while (st.hasMoreElements()) {
            _specialize_calls.add(st.nextToken());
        }
    }

    int callSiteFlags = 0;
    if (options.getBoolean("profile.callsites")) {
        callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_PROFILE;
    }

    if (options.get("trace.callsites") instanceof KeyValueOption) {
        callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE;
        final KeyValueOption kv = (KeyValueOption)options.get("trace.callsites");
        if (kv.hasValue("miss")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_MISSES;
        }
        if (kv.hasValue("enterexit") || (callSiteFlags & NashornCallSiteDescriptor.CALLSITE_TRACE_MISSES) == 0) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_ENTEREXIT;
        }
        if (kv.hasValue("objects")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_VALUES;
        }
        if (kv.hasValue("scope")) {
            callSiteFlags |= NashornCallSiteDescriptor.CALLSITE_TRACE_SCOPE;
        }
    }
    this._callsite_flags = callSiteFlags;

    final Option<?> timezoneOption = options.get("timezone");
    if (timezoneOption != null) {
        this._timezone = (TimeZone)timezoneOption.getValue();
    } else {
        this._timezone  = TimeZone.getDefault();
    }

    final Option<?> localeOption = options.get("locale");
    if (localeOption != null) {
        this._locale = (Locale)localeOption.getValue();
    } else {
        this._locale = Locale.getDefault();
    }
}