8014827: readLine should accept a prompt as an argument

Reviewed-by: sundar, hannesw
diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
index 596ec1b..1d046ca 100644
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java
@@ -46,7 +46,7 @@
 public final class ScriptingFunctions {
 
     /** Handle to implementation of {@link ScriptingFunctions#readLine} - Nashorn extension */
-    public static final MethodHandle READLINE = findOwnMH("readLine", Object.class, Object.class);
+    public static final MethodHandle READLINE = findOwnMH("readLine", Object.class, Object.class, Object.class);
 
     /** Handle to implementation of {@link ScriptingFunctions#readFully} - Nashorn extension */
     public static final MethodHandle READFULLY = findOwnMH("readFully",     Object.class, Object.class, Object.class);
@@ -78,13 +78,17 @@
      * Nashorn extension: global.readLine (scripting-mode-only)
      * Read one line of input from the standard input.
      *
-     * @param self self reference
+     * @param self   self reference
+     * @param prompt String used as input prompt
      *
      * @return line that was read
      *
      * @throws IOException if an exception occurs
      */
-    public static Object readLine(final Object self) throws IOException {
+    public static Object readLine(final Object self, final Object prompt) throws IOException {
+        if (prompt != UNDEFINED) {
+            System.out.print(JSType.toString(prompt));
+        }
         final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         return reader.readLine();
     }