You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ The goals of GraalVM JavaScript are:
14
14
15
15
16
16
## Getting Started
17
-
The preferred way to run GraalVM JavaScript is from a [GraalVM](https://www.graalvm.org/downloads/).
18
-
Starting with GraalVM for JDK 21 (23.1), GraalVM JavaScript is available as a [standalone distribution](https://github.com/oracle/graaljs/releases) and a [Maven artifact](https://central.sonatype.com/artifact/org.graalvm.polyglot/js) (but no longer as a GraalVM component).
17
+
The preferred way to run GraalVM JavaScript (a.k.a. GraalJS) is from a [GraalVM](https://www.graalvm.org/downloads/).
18
+
As of GraalVM for JDK 21, (23.1), GraalVM JavaScript and Node.js runtimes are available as [standalone distributions](https://github.com/oracle/graaljs/releases) and [Maven artifacts](https://central.sonatype.com/artifact/org.graalvm.polyglot/js) (but no longer as GraalVM components).
19
19
See the documentation on the [GraalVM website](https://www.graalvm.org/latest/reference-manual/js/) for more information on how to set up GraalVM JavaScript.
20
20
21
21
### Standalone Distribution
@@ -73,7 +73,7 @@ Due to those limitations, running on a stock JVM is not a supported feature - pl
73
73
## Documentation
74
74
75
75
Extensive documentation is available on [graalvm.org](https://www.graalvm.org/): see [Getting Started](https://www.graalvm.org/docs/getting-started/) and the more extensive [JavaScript and Node.js Reference Manual](https://www.graalvm.org/reference-manual/js/).
76
-
In addition there is documentation in the source code repository in the [`docs`](https://github.com/graalvm/graaljs/tree/master/docs)folder, for [users](https://github.com/graalvm/graaljs/tree/master/docs/user) and [contributors](https://github.com/graalvm/graaljs/tree/master/docs/contributor).
76
+
In addition, there is documentation in the source code repository in the [`docs`](https://github.com/graalvm/graaljs/tree/master/docs)directory, for [users](https://github.com/graalvm/graaljs/tree/master/docs/user) and [contributors](https://github.com/graalvm/graaljs/tree/master/docs/contributor).
77
77
78
78
For contributors, a guide how to build GraalVM JavaScript from source code can be found in [`Building.md`](https://github.com/graalvm/graaljs/tree/master/docs/Building.md).
Copy file name to clipboardExpand all lines: docs/user/FAQ.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Additionally, you can upload your `package-lock.json` or `package.json` file int
85
85
### My application is slower on GraalVM JavaScript than on another engine
86
86
Reason:
87
87
* Ensure your benchmark considers warmup. During the first few iterations, GraalVM JavaScript may be slower than other engines, but after sufficient warmup, this difference should level out.
88
-
* GraalVM JavaScript is shipped in two different standalones: Native (default) and JVM (with a `-jvm` infix). While the default _native_ mode offers faster startup and lower latency, it might exhibit slower peak performance (lower throughput) once the application is warmed up. In the _JVM_ mode, the application might need hundreds of milliseconds more to start, but typically shows better peak performance.
88
+
* GraalVM JavaScript is shipped in two different standalones: Native (default) and JVM (with a `-jvm` infix). While the default _Native_ mode offers faster startup and lower latency, it might exhibit slower peak performance (lower throughput) once the application is warmed up. In the _JVM_ mode, the application might need hundreds of milliseconds more to start, but typically shows better peak performance.
89
89
* Repeated execution of code via newly created `org.graalvm.polyglot.Context` is slow, despite the same code being executed every time.
- provides the unhandled promise rejection handler when using option (`js.unhandled-rejections=handler`).
226
-
- the handler is called with two arguments: (rejection, promise).
227
-
-`Graal.setUnhandledPromiseRejectionHandler` can be called with null, undefined, or empty args to clear the handler.
226
+
- the handler is called with two arguments: (rejectionReason, unhandledPromise).
227
+
-`Graal.setUnhandledPromiseRejectionHandler` can be called with `null`, `undefined`, or empty arguments to clear the handler.
228
228
229
229
### Java
230
230
231
231
The `Java` object is only available when [host class lookup](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Context.Builder.html#allowHostClassLookup-java.util.function.Predicate-) is allowed.
232
-
In order to access Java host classes and its members, they first need to be allowed by the [host access policy](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/HostAccess.html) and when running on a Native Image, be registered for [run time reflection](https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Reflection/).
232
+
In order to access Java host classes and its members, they first need to be allowed by the [host access policy](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/HostAccess.html), and when running from a Native Image, be registered for [run time reflection](https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Reflection/).
233
233
234
234
Note that some functions require the Nashorn compatibility mode flag to be set.
235
-
When running on the standalone distribution, this flag can be set with:
235
+
When running from the JVM standalone distribution, this flag can be set with:
Loads the specified Java class and returns a constructible object that has the static members (i.e. methods and fields) of the class and can be used with the `new` keyword to construct new instances:
242
+
`Java.type` loads the specified Java class and returns a constructible object that has the static members (i.e. methods and fields) of the class and can be used with the `new` keyword to construct new instances:
243
243
```js
244
244
var BigDecimal =Java.type('java.math.BigDecimal');
The conversion methods as defined by ECMAScript (e.g., `ToString` and `ToDouble`) are executed when a JavaScript value has to be converted to a Java type.
276
-
Lossy conversion is disallowed and results in a TypeError.
279
+
Lossy conversion is disallowed and results in a `TypeError`.
277
280
278
281
#### `Java.isJavaObject(obj)`
279
282
280
-
- returns whether `obj` is an object of the Java language
283
+
- returns `true` if `obj` is a Java host object
281
284
- returns `false` for native JavaScript objects, as well as for objects of other polyglot languages
282
285
283
286
#### `Java.isType(obj)`
284
287
285
-
- returns `true` if `obj` is an object representing the constructor and static members of a Java class, as obtained (for example) by `Java.type()`
288
+
- returns `true` if `obj` is an object representing the constructor and static members of a Java class, as obtained by `Java.type()` or package objects.
286
289
- returns `false` for all other arguments
287
290
288
291
#### `Java.typeName(obj)`
@@ -295,25 +298,25 @@ Lossy conversion is disallowed and results in a TypeError.
295
298
- returns whether `fn` is an object of the Java language that represents a Java function
296
299
- returns `false` for all other types, including native JavaScript function, and functions of other polyglot languages
297
300
298
-
This function requires the Nashorn compatibility mode flag.
301
+
> This function is only available in Nashorn compatibility mode (`--js.nashorn-compat=true`).
299
302
300
303
#### `Java.isScriptObject(obj)`
301
304
302
305
- returns whether `obj` is an object of the JavaScript language
303
306
- returns `false` for all other types, including objects of Java and other polyglot languages
304
307
305
-
This function requires the Nashorn compatibility mode flag.
308
+
> This function is only available in Nashorn compatibility mode (`--js.nashorn-compat=true`).
306
309
307
310
#### `Java.isScriptFunction(fn)`
308
311
309
312
- returns whether `fn` is a JavaScript function
310
313
- returns `false` for all other types, including Java function, and functions of other polyglot languages
311
314
312
-
This function requires the Nashorn compatibility mode flag.
315
+
> This function is only available in Nashorn compatibility mode (`--js.nashorn-compat=true`).
313
316
314
317
#### `Java.addToClasspath(location)`
315
318
316
-
- adds the specified location (file name or path name, as String) to Java's classpath
319
+
- adds the specified location (a `.jar` file or directory path string) to Java's classpath
Copy file name to clipboardExpand all lines: docs/user/Options.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ For a complete list, use `js --help:js:internal`
81
81
This option provides compatibility to a specific version of the ECMAScript specification.
82
82
It expects an integer value, where both the edition numbers (`5`, `6`, ...) and the publication years (starting from `2015`) are supported.
83
83
As of GraalVM 21.2, `latest`, `staging` are supported, too.
84
-
The default in GraalVM 23.1 is the [`ECMAScript 2023 specification`](https://tc39.es/ecma262/).
84
+
The default in GraalVM 23.1 is the [`ECMAScript 2023 specification`](https://262.ecma-international.org/14.0/).
85
85
GraalVM JavaScript implements some features of the future draft specification and of open proposals, if you explicitly select that version and/or enable specific experimental flags.
86
86
For production settings, it is recommended to set the `ecmascript-version` to a released, finalized version of the specification (e.g., `2022`).
Copy file name to clipboardExpand all lines: docs/user/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,12 @@ To migrate the code previously targeted to the Nashorn or Rhino engines, [migrat
13
13
14
14
## Getting Started
15
15
16
-
As of GraalVM for JDK 21, the JavaScript (GraalJS) and Node.js runtimes are available as standalone distributions.
16
+
As of GraalVM for JDK 21, the JavaScript (GraalJS) and Node.js runtimes are available as standalone distributions.
17
17
Two standalone language runtime options are available for both Oracle GraalVM and GraalVM Community Edition: a Native Image compiled native launcher or a JVM-based runtime (included).
18
-
To distinguish between them, the GraalVM Community Edition version has the suffix `-community` in the name: `graaljs-community-<version>-<os>-<arch>.tar.gz`, `graalnodejs-community-<version>-<os>-<arch>.tar.gz`,
18
+
To distinguish between them, the GraalVM Community Edition version has the suffix `-community` in the name: `graaljs-community-<version>-<os>-<arch>.tar.gz`, `graalnodejs-community-<version>-<os>-<arch>.tar.gz`.
19
19
A standalone that comes with a JVM has a `-jvm` suffix in a name.
20
20
21
-
1. Navigate to [GitHub releases](https://github.com/oracle/graaljs/releases/) and select a desired standalone for your operating system.
21
+
1. Navigate to [GitHub releases](https://github.com/oracle/graaljs/releases/) and select a desired standalone for your operating system.
This example contains a Maven project for a JavaScript benchmark (a prime number generator).
26
26
It allows a user to compare the performance of GraalVM JavaScript running with or without the GraalVM compiler as the optimizing compiler.
27
27
Running with the GraalVM compiler will significantly improve the execution performance of any relatively large JavaScript codebase.
28
28
29
-
In essence, the example `pom.xml` file activates JVMCI to install additional JIT compilers, and configures the JIT compiler to be the Graal Compiler by providing it on `--module-path` and `--upgrade-module-path`.
29
+
In essence, the example `pom.xml` file activates the JVM Compiler Interface (JVMCI) and configures the JIT compiler to be the Graal compiler by providing it on `--module-path` and `--upgrade-module-path`.
30
30
31
31
### ScriptEngine JSR 223
32
32
GraalVM JavaScript can be started via `ScriptEngine` when _js-scriptengine.jar_ is included on the module path.
0 commit comments