Skip to content
/ jsvm Public

A "javascript" "vm" project. An attempt at static compilation of javascript.

License

Notifications You must be signed in to change notification settings

BobVarioa/jsvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsvm

Discontinued, see my blog post for more information. In short, check out Porffor, a project that has similar goals.

A "javascript" "vm" project. Currently this is very imcomplete, but the goal for this project is to create something that turns a subset of javascript into jvm bytecode currently, but eventually different formats as well.

Rationale

This project came about as somewhat a joke (js -> java) and somewhat something I've really wanted to do for a large period of time. I've noticed in the Javascript ecosystem many people will ignore performance as a whole, leading to the overbloated and incredibly slow web (especially on lower end machines). This project, in a sense, seeks to remedy some of that, and make the web (or nodejs, etc.) faster and more versitile.

Goals

Eventually, I want this project to be completely compatible with all of javascript and beat V8 in terms of performance due to more strict typing, and other optimizations V8 simply can't make at runtime because of their cost.

Roadmap

Any features with a empty checkbox means they are currently in progress, any fully checked checkbox means the feature is complete (though might have bugs).

  • Parse javascript
    • Statements
      • Variable declarations
        • let, const, var
        • Destructuring
      • if
      • for
      • for .. in
      • for .. of
      • while
      • do .. while
      • try .. catch
      • try .. catch .. finally
      • switch
    • Expresions
      • Assignment
        • Increment/Decrement
      • Arithmetic
      • Logical
      • Binary
      • Comparision
      • Ternary
      • typeof
      • instanceof
      • Primatives
        • Number
        • String
        • Boolean
        • Object
        • Array
        • Undefined
        • Null
        • Symbol
    • Constructions
      • Classes
        • Fields
        • Methods
        • Access modifiers
      • Functions
        • Arguments
          • General
          • Rest
          • Default
        • Arrow
        • Generator
  • Run javascript
    • Primative Types
      • Number
      • Boolean
      • String
    • Arithmetic
    • Functions
      • Return
    • Variables
      • Scoping
    • Control flow
      • If
      • Loops
        • For
        • While
        • Break
        • Continue
    • Collections
      • Array
      • Object
    • Operators
      • Typeof
      • Instanceof
    • Prototypes
    • Finish Types
      • Symbol
      • Bigint
      • Undefined
      • Null
    • Arrow functions
    • Async
    • Anything else to pass test262
  • Optimizations
    • Detect monomorphic object literals and convert them into simple structs
      • Potenially create parent and children relationships between similar objects used in the same places
        • Example: { a: 1, b: 3 } { a: 1 } could be placed in the same container in some circumstances with instanceof checks as necessary
    • Detect strings used as enums
      • Might be very difficult to impossible once the input code is large enough
    • Double -> Float -> Int -> Byte when possible
    • Purity checks?
    • Turn datatypes into what they should be, i.e List -> Stack, Object -> Map, Object -> Set, etc.
  • Run typescript

Sources Referenced

About

A "javascript" "vm" project. An attempt at static compilation of javascript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published