Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

js.js: A JavaScript JavaScript interpreter

License

NotificationsYou must be signed in to change notification settings

jterrace/js.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js.js is a JavaScript interpreter in JavaScript. Instead of trying to create aninterpreter from scratch,SpiderMonkey is compiled intoLLVM and thenemscripten translates the output into JavaScript.


Demos

See several running demoshere.

Paper

Academic paper to appear atWebApps 2012 locatedhere.

Status

The compiled version of js.js is 3MB and only594KB after gzip compression.Using theSunspider benchmark, the interpreter is about200 times slowerthan Spidermonkey's native interpreter with the JIT compiler turned off. Moreoptimizations and benchmarks are coming soon.

Example Use

Here is an example of how to use the API:

var jsObjs = JSJS.Init();var rval = JSJS.EvaluateScript(jsObjs.cx, jsObjs.glob, "1 + 1");var d = JSJS.ValueToNumber(jsObjs.cx, rval);window.alert(d); //2JSJS.End(jsObjs);

More examples are available in theexamples directory.

Files

The following files are located in thesrc directory.

FileDescription
js.O0.jsCommand-line JS shell, no optimizations
js.O0.min.jsCommand-line JS shell, no optimizations, closure compiled
js.O1.jsCommand-line JS shell, O1 optimizations
js.O1.min.jsCommand-line JS shell, O1 optimizations, closure compiled
js.O2.jsCommand-line JS shell, O2 optimizations
js.O2.min.jsCommand-line JS shell, O2 optimizations, closure compiled
libjs.O0.jsJSAPI shared library, no optimizations
libjs.O0.min.jsJSAPI shared library, no optimizations, closure compiled with js.js wrapper
libjs.O1.jsJSAPI shared library, O1 optimizations
libjs.O1.min.jsJSAPI shared library, O1 optimizations, closure compiled with js.js wrapper
libjs.O2.jsJSAPI shared library, O2 optimizations
libjs.O2.min.jsJSAPI shared library, O2 optimizations, closure compiled with js.js wrapper
jsjs-wrapper.jsjs.js wrapper API to make using the JSAPI easier

To run the shell, you want to run one of these:

js js.O2.min.js -e "print('hello');"node js.O2.min.js -e "print('hello');"

To include the API in your website, include the minified libjs like this:

<script type="text/javascript" src="libjs.O2.min.js"></script>

Alternatively, you can use the wrapper script directly with a non-minifiedversion (useful for debugging and modifications):

<script type="text/javascript" src="libjs.O2.js"></script><script type="text/javascript" src="jsjs-wrapper.js"></script>

About

js.js: A JavaScript JavaScript interpreter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp