diff --git a/nashorn/docs/DEVELOPER_README b/nashorn/docs/DEVELOPER_README index 5b1a34ae2eb..fe140954c1a 100644 --- a/nashorn/docs/DEVELOPER_README +++ b/nashorn/docs/DEVELOPER_README @@ -922,11 +922,10 @@ A short summary follows: -cp, -classpath (-cp path. Specify where to find user class files.) - -co, --compile-only (Compile script without running. Exit after compilation) + -co, --compile-only (Compile without running.) param: [true|false] default: false - -d, --dump-debug-dir (specify a destination directory to dump class files. - This must be combined with the --compile-only option to work) + -d, --dump-debug-dir (specify a destination directory to dump class files.) param: --debug-lines (Generate line number table in .class files.) @@ -962,10 +961,6 @@ A short summary follows: -h, -help (Print help for command line flags.) param: [true|false] default: false - --lazy-compilation (EXPERIMENTAL: Use lazy code generation strategies - do not compile - the entire script at once.) - param: [true|false] default: false - --loader-per-compile (Create a new class loader per compile.) param: [true|false] default: true @@ -973,16 +968,16 @@ A short summary follows: param: default: en-US --log (Enable logging of a given level for a given number of sub systems. - [for example: --log=fields:finest,codegen:info]) + [for example: --log=fields:finest,codegen:info].) param: ,* - -nj, --no-java (No Java support) + -nj, --no-java (Disable Java support.) param: [true|false] default: false - -nse, --no-syntax-extensions (No non-standard syntax extensions) + -nse, --no-syntax-extensions (Disallow non-standard syntax extensions.) param: [true|false] default: false - -nta, --no-typed-arrays (No Typed arrays support) + -nta, --no-typed-arrays (Disable typed arrays support.) param: [true|false] default: false --parse-only (Parse without compiling.) @@ -991,13 +986,15 @@ A short summary follows: --print-ast (Print abstract syntax tree.) param: [true|false] default: false - --print-code (Print bytecode.) - param: [true|false] default: false + -pc, --print-code (Print generated bytecode. If a directory is specified, nothing will + be dumped to stderr. Also, in that case, .dot files will be generated + for all functions or for the function with the specified name only.) + param: [dir:,function:] --print-lower-ast (Print lowered abstract syntax tree.) param: [true|false] default: false - --print-lower-parse (Print the parse tree after lowering.) + -plp, --print-lower-parse (Print the parse tree after lowering.) param: [true|false] default: false --print-mem-usage (Print memory usage of IR after each compile stage.) @@ -1006,7 +1003,7 @@ A short summary follows: --print-no-newline (Print function will not print new line char.) param: [true|false] default: false - --print-parse (Print the parse tree.) + -pp, --print-parse (Print the parse tree.) param: [true|false] default: false --print-symbols (Print the symbol table.) @@ -1015,21 +1012,13 @@ A short summary follows: -pcs, --profile-callsites (Dump callsite profile data.) param: [true|false] default: false - --range-analysis (EXPERIMENTAL: Do range analysis using known compile time types, - and try to narrow number types) - param: [true|false] default: false - -scripting (Enable scripting features.) param: [true|false] default: false - --specialize-calls (EXPERIMENTAL: Specialize all or a set of method according - to callsite parameter types) - param: [=function_1,...,function_n] - - --stderr (Redirect stderr to a filename or to another tty, e.g. stdout) + --stderr (Redirect stderr to a filename or to another tty, e.g. stdout.) param: - --stdout (Redirect stdout to a filename or to another tty, e.g. stderr) + --stdout (Redirect stdout to a filename or to another tty, e.g. stderr.) param: -strict (Run scripts in strict mode.) @@ -1039,7 +1028,7 @@ A short summary follows: param: default: Europe/Stockholm -tcs, --trace-callsites (Enable callsite trace mode. Options are: miss [trace callsite misses] - enterexit [trace callsite enter/exit], objects [print object properties]) + enterexit [trace callsite enter/exit], objects [print object properties].) param: [=[option,]*] --verify-code (Verify byte code before running.) diff --git a/nashorn/make/build-benchmark.xml b/nashorn/make/build-benchmark.xml index c7573f6ec0b..c2666d18d4d 100644 --- a/nashorn/make/build-benchmark.xml +++ b/nashorn/make/build-benchmark.xml @@ -1,372 +1,291 @@ + - - - - - - - - - + + + + - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - + - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - - - - - - + + - - - + - - - - + - + - - - - - + + - - - + - - - - + - - - - - + + - - - + - - - - + - - - - - - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -375,9 +294,9 @@ - + - + @@ -389,7 +308,7 @@ - + @@ -404,9 +323,9 @@ - + - + @@ -427,6 +346,8 @@ + + + + diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml index 9e54ee53d0a..a20473548a5 100644 --- a/nashorn/make/build.xml +++ b/nashorn/make/build.xml @@ -23,10 +23,8 @@ --> - - @@ -616,4 +614,6 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" { + + diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties index 8e796826141..d7ac22a533f 100644 --- a/nashorn/make/project.properties +++ b/nashorn/make/project.properties @@ -53,6 +53,7 @@ parallel.test.runner=jdk.nashorn.internal.test.framework.ParallelTestRunner # test classes directory build.test.classes.dir=${build.dir}/test/classes + # nashorn test jar - internal tests jar and api tests jar nashorn.internal.tests.jar=${build.dir}/nashorn-internal-tests.jar nashorn.api.tests.jar=${build.dir}/nashorn-api-tests.jar @@ -161,19 +162,12 @@ test-sys-prop.test.js.unchecked.dir=${test262.dir} # test root for octane octane-test-sys-prop.test.js.roots=${test.external.dir}/octane/ -# run octane benchmars in separate processes? +# run octane benchmars in separate processes? (recommended) octane-test-sys-prop.separate.process=true # framework root for octane octane-test-sys-prop.test.js.framework=${test.basic.dir}/run-octane.js -# list of tests to be excluded -# mandreel excluded due to OOM -octane-test-sys-prop.test.js.exclude.list=\ - base.js \ - run.js \ - mandreel.js - # test root for sunspider sunspider-test-sys-prop.test.js.roots=${test.external.dir}/sunspider/tests/sunspider-1.0.2/ @@ -261,8 +255,11 @@ test.src.dir=test/src run.test.xmx=3G run.test.xms=2G -#uncomment to enable flight recording - crank up stack trace for lambda forms +# uncomment this jfr.args to enable light recordings. the stack needs to be cranked up to 1024 frames, +# or everything will as of the now drown in lambda forms and be cut off. +# #jfr.args=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath="test_suite.jfr",stackdepth=1024 \ + jfr.args= run.test.user.language=tr @@ -276,34 +273,80 @@ run.test.jvmargs.common=\ ${jfr.args} \ -XX:+HeapDumpOnOutOfMemoryError -#-XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M -# -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMethods - # turn on assertions for tests -run.test.jvmargs.main=${run.test.jvmargs.common} -ea -Dnashorn.optimistic -Dnashorn.lazy +run.test.jvmargs.main=${run.test.jvmargs.common} -ea -Dnashorn.lazy -#-XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M -run.test.jvmargs.octane.main=${run.test.jvmargs.common} +# extra jvmargs that might be useful for debugging +# +# -XX:+UnlockDiagnosticVMOptions +# +# turn off compressed class pointers in metaspace +# -XX:-UseCompressedKlassPointers +# +# dump the heap after every GC +# -XX:+PrintHeapAtGC +# +# manually set a metaspace size for class data +# -XX:ClassMetaspaceSize=300M +# +# print out methods compiled +# -XX:+PrintCompilation +# +# print all compiled nmethods with oopmaps and lots of other info +# -XX:+PrintNMethods +# Use best known performance options for octane +run.test.jvmargs.octane.main=${run.test.jvmargs.common} -Dnashorn.lazy -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode -XX:TypeProfileLevel=222 + +# Security manager args - make sure that we run with the nashorn.policy that the build creates run.test.jvmsecurityargs=-Xverify:all -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy # VM options for script tests with @fork option test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -cp ${run.test.classpath} # path of rhino.jar for benchmarks -rhino.jar= +rhino.dir=/Users/marcus/src/rhino +rhino.jar=${rhino.dir}/js.jar v8.shell=d8 +# How many iterations should 'ant octane' run for each +# benchmark +octane.iterations=25 + +# List of octane tests to run, as properties prefixed with +# "octane.benchmark." mapping to the benchmark name in +# the test harness +# +# Octane tests that are disabled should have their entire line +# commented out Tests may be disabled for functionality reasons when +# they have bugs or when the runtime doesn't handle them (yet) +octane.benchmark.box2d=box2d +#octane.benchmark.code-load=code-load +octane.benchmark.crypto=crypto +octane.benchmark.deltablue=deltablue +octane.benchmark.earley-boyer=earley-boyer +octane.benchmark.gbemu=gbemu +octane.benchmark.navier-stokes=navier-stokes +octane.benchmark.mandreel=mandreel +octane.benchmark.pdfjs=pdfjs +octane.benchmark.raytrace=raytrace +octane.benchmark.regexp=regexp +octane.benchmark.richards=richards +octane.benchmark.splay=splay +#octane.benchmark.typescript=typescript +#octane.benchmark.zlib=zlib + #path to rhino jar file octaneperf-sys-prop.rhino.jar=${rhino.jar} #timeout for performance tests in minutes octaneperf-sys-prop.timeout.value=10 -################ -# codecoverage # -################ +################# +# code coverage # +################# + #enable/disable code coverage; please redifine in the ${user.home}/.nashorn.project.local.properties make.code.coverage=false #type of codecoverage; one of static or dynamic. Now only dynamic is supported diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties index 384a6232a31..037840d0c9b 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties +++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties @@ -170,7 +170,7 @@ nashorn.option.log = { \ is_undocumented=true, \ params=",*", \ desc="Enable logging of a given level for a given number of sub systems. \ - [for example: --log=fields:finest,codegen:info]", \ + [for example: --log=fields:finest,codegen:info].", \ type=Log \ } @@ -198,23 +198,23 @@ nashorn.option.no.java = { \ name="--no-java", \ short_name="-nj", \ is_undocumented=true, \ - desc="No Java support", \ + desc="Disable Java support.", \ default=false \ } -nashorn.option.no.syntax.extensions = { \ - name="--no-syntax-extensions", \ - short_name="-nse", \ - is_undocumented=true, \ - desc="No non-standard syntax extensions", \ - default=false \ +nashorn.option.no.syntax.extensions = { \ + name="--no-syntax-extensions", \ + short_name="-nse", \ + is_undocumented=true, \ + desc="Disallow non-standard syntax extensions.", \ + default=false \ } nashorn.option.no.typed.arrays = { \ name="--no-typed-arrays", \ short_name="-nta", \ is_undocumented=true, \ - desc="No Typed arrays support", \ + desc="Disable typed arrays support.", \ default=false \ } @@ -300,20 +300,20 @@ nashorn.option.scripting = { \ desc="Enable scripting features." \ } -nashorn.option.stdout = { \ - name="--stdout", \ - is_undocumented=true, \ - type=String, \ - params="", \ - desc="Redirect stdout to a filename or to another tty, e.g. stderr" \ +nashorn.option.stdout = { \ + name="--stdout", \ + is_undocumented=true, \ + type=String, \ + params="", \ + desc="Redirect stdout to a filename or to another tty, e.g. stderr." \ } -nashorn.option.stderr = { \ - name="--stderr", \ - is_undocumented=true, \ - type=String, \ - params="", \ - desc="Redirect stderr to a filename or to another tty, e.g. stdout" \ +nashorn.option.stderr = { \ + name="--stderr", \ + is_undocumented=true, \ + type=String, \ + params="", \ + desc="Redirect stderr to a filename or to another tty, e.g. stdout." \ } nashorn.option.timezone = { \ @@ -333,14 +333,14 @@ nashorn.option.locale = { \ type=Locale \ } -nashorn.option.trace.callsites = { \ - name="--trace-callsites", \ - short_name="-tcs", \ - is_undocumented=true, \ - type=keyvalues, \ - params="[=[option,]*]", \ - desc="Enable callsite trace mode. Options are: miss [trace callsite misses] \ - enterexit [trace callsite enter/exit], objects [print object properties]" \ +nashorn.option.trace.callsites = { \ + name="--trace-callsites", \ + short_name="-tcs", \ + is_undocumented=true, \ + type=keyvalues, \ + params="[=[option,]*]", \ + desc="Enable callsite trace mode. Options are: miss [trace callsite misses] \ + enterexit [trace callsite enter/exit], objects [print object properties]." \ } nashorn.option.verify.code = { \ diff --git a/nashorn/test/script/basic/run-octane.js b/nashorn/test/script/basic/run-octane.js index 57951ad423d..716f6eaa3f8 100644 --- a/nashorn/test/script/basic/run-octane.js +++ b/nashorn/test/script/basic/run-octane.js @@ -25,13 +25,6 @@ * @subtest */ -var read; -try { - read = readFully; -} catch (e) { - print("ABORTING: Cannot find 'readFully'. You must have scripting enabled to use this test harness. (-scripting)"); - throw e; -} function initZlib() { zlib = new BenchmarkSuite('zlib', [152815148], [ @@ -62,7 +55,7 @@ var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__; // TODO: why is this path hard coded when it's defined in project properties? var path = dir + "../external/octane/"; -var runtime = ""; +var runtime = undefined; var verbose = false; var numberOfIterations = 5; @@ -133,7 +126,7 @@ function run_one_benchmark(arg, iters) { benchmarks[x].Setup(); } BenchmarkSuite.ResetRNG(); - print_verbose(arg, "running '" + arg.name + "' for " + iters + " iterations of no less than " + min_time + " seconds (" + runtime + ")"); + print_verbose(arg, "running '" + arg.name + "' for " + iters + " iterations of no less than " + min_time + " seconds"); var scores = []; @@ -188,8 +181,12 @@ function run_one_benchmark(arg, iters) { print_always(arg, res); } +function runtime_string() { + return runtime == undefined ? "" : ("[" + runtime + "] "); +} + function print_always(arg, x) { - print("[" + arg.name + "] " + x); + print(runtime_string() + "[" + arg.name + "] " + x); } function print_verbose(arg, x) { @@ -204,8 +201,6 @@ function run_suite(tests, iters) { } } -runtime = "command line"; - var args = []; if (typeof $ARGS !== 'undefined') { @@ -281,7 +276,30 @@ if (tests_found.length == 0) { } } -tests_found.sort(); +// returns false for rhino, v8 and all other javascript runtimes, true for Nashorn +function is_this_nashorn() { + return typeof Error.dumpStack == 'function' +} + +if (is_this_nashorn()) { + try { + read = readFully; + } catch (e) { + print("ABORTING: Cannot find 'readFully'. You must have scripting enabled to use this test harness. (-scripting)"); + throw e; + } +} + +// run tests in alphabetical order by name +tests_found.sort(function(a, b) { + if (a.name < b.name) { + return -1; + } else if (a.name > b.name) { + return 1; + } else { + return 0; + } +}); load(path + 'base.js'); run_suite(tests_found, iters);