aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/DEVELOPER_README11
-rw-r--r--src/jdk/nashorn/internal/runtime/options/Options.java11
2 files changed, 22 insertions, 0 deletions
diff --git a/docs/DEVELOPER_README b/docs/DEVELOPER_README
index 3bd220b2..d0587ce6 100644
--- a/docs/DEVELOPER_README
+++ b/docs/DEVELOPER_README
@@ -13,6 +13,17 @@ properties described herein are subject to change without notice.
This documentation of the system property flags assume that the
default value of the flag is false, unless otherwise specified.
+SYSTEM PROPERTY: -Dnashorn.args=<string>
+
+This property takes as its value a space separated list of Nashorn
+command line options that should be passed to Nashorn. This might be useful
+in environments where it is hard to tell how a nashorn.jar is launched.
+
+Example:
+
+> java -Dnashorn.args="--lazy-complation --log=compiler" large-java-app-with-nashorn.jar
+> ant -Dnashorn.args="--log=codegen" antjob
+
SYSTEM PROPERTY: -Dnashorn.unstable.relink.threshold=x
This property controls how many call site misses are allowed before a
diff --git a/src/jdk/nashorn/internal/runtime/options/Options.java b/src/jdk/nashorn/internal/runtime/options/Options.java
index 0f30b1a1..3e09fa57 100644
--- a/src/jdk/nashorn/internal/runtime/options/Options.java
+++ b/src/jdk/nashorn/internal/runtime/options/Options.java
@@ -66,6 +66,9 @@ public final class Options {
/** The options map of enabled options */
private final TreeMap<String, Option<?>> options;
+ /** System property that can be used for command line option propagation */
+ private static final String NASHORN_ARGS_PROPERTY = "nashorn.args";
+
/**
* Constructor
*
@@ -386,6 +389,14 @@ public final class Options {
final LinkedList<String> argList = new LinkedList<>();
Collections.addAll(argList, args);
+ final String extra = getStringProperty(NASHORN_ARGS_PROPERTY, null);
+ if (extra != null) {
+ final StringTokenizer st = new StringTokenizer(extra);
+ while (st.hasMoreTokens()) {
+ argList.add(st.nextToken());
+ }
+ }
+
while (!argList.isEmpty()) {
final String arg = argList.remove(0);