Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DeepDive] JavaScript/ECMAScript, V8, Node, WebAssembly, embedded JavaScript, etc #25

Open
0xdevalias opened this issue Dec 18, 2019 · 0 comments
Labels
deep-dive A research deep dive/link dump of various things related to a topic. May eventually become a blog.

Comments

@0xdevalias
Copy link
Owner

0xdevalias commented Dec 18, 2019

V8

V8 implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

V8 compiles and executes JavaScript source code, handles memory allocation for objects, and garbage collects objects it no longer needs. V8’s stop-the-world, generational, accurate garbage collector is one of the keys to V8’s performance.

JavaScript / ECMAScript / TC39

  • https://tc39.es/
    • Ecma International's TC39 is a group of JavaScript developers, implementers, academics, and more, collaborating with the community to maintain and evolve the definition of JavaScript.

    • https://tc39.es/ecma262/
      • ECMAScript 2020 Language Specification

Profiling JavaScript

WebAssembly

AssemblyScript

See Also

Babel

Chrome

JavaScript on Java (JVM, JDK, GraalVM, etc)

(Originally written as a comment on JetBrains/js-graphql-intellij-plugin#296 (comment)))

I decided to do a little googling to see what the state of JavaScript in JVM is these days.

Rhino is the original JavaScript engine for JVM that I remember hearing about, but it seems it is still maintained, with a stable release in January 2020

Between Java 8 and 11, Nashorn was the JavaScript engine shipped with the JDK, but it is deprecated since Java 11, with GraalVM as the suggested replacement.

GraalVM supports many different programming languages on top of the JVM, of which JavaScript is one of them:

  • GraalVM JavaScript: ECMAScript 2019 compliant JavaScript runtime, with support for Node.js

In the JavaScript & Node.js section of the docs on the main GraalVM website it claims even more updated compatibility:

  • GraalVM is ECMAScript 2020 compliant and fully compatible with a diverse range of active Node.js (npm) modules. More than 100,000 npm packages are regularly tested and are compatible with GraalVM, including modules like express, react, async, request, browserify, grunt, mocha, and underscore. The latest release of GraalVM is based on Node.js version 12.15.0.

The main docs page talks about the various methods of being able to use GrallVM features, of which the most relevant here is as a library (jar files) rather than as a runtime:

  • Libraries (jar files)

    • GraalVM Compiler – a dynamic just-in-time (JIT) compiler that improves efficiency and speed of applications through unique approaches to code analysis and optimization.

    • JavaScript interpreter – an ECMAScript compliant JavaScript engine.

While you can apparently get a GraalVM-based replacement of the standard Java JDK, it's also possible to use it as a jar dependency on the standard JDK:

The GraalVM GraalJS repo is on GitHub, and they also have documentation on how to use it with a standard (non-GraalVM) JDK as part of a maven project, or just by referencing the jar files.


There are also various methods for 'calling out' to the hosting system's node, if a non-fully-native-JVM solution is considered acceptable; eg:

Another potential method could be to run node to parse the JS config files, and then export a more Java friendly 'intermediary' config file, that this lib could then read from.

Unsorted

@0xdevalias 0xdevalias added the deep-dive A research deep dive/link dump of various things related to a topic. May eventually become a blog. label Dec 18, 2019
@0xdevalias 0xdevalias changed the title [DeepDive] V8, Embedded JavaScript, etc [DeepDive] V8, Node, Embedded JavaScript, etc Dec 18, 2019
@0xdevalias 0xdevalias changed the title [DeepDive] V8, Node, Embedded JavaScript, etc [DeepDive] JavaScript/ECMAScript, V8, Node, embedded JavaScript, etc Dec 18, 2019
@0xdevalias 0xdevalias changed the title [DeepDive] JavaScript/ECMAScript, V8, Node, embedded JavaScript, etc [DeepDive] JavaScript/ECMAScript, V8, Node, WebAssembly, embedded JavaScript, etc Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deep-dive A research deep dive/link dump of various things related to a topic. May eventually become a blog.
Projects
None yet
Development

No branches or pull requests

1 participant