• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jterrace/js.js: js.js: A JavaScript JavaScript interpreter

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

jterrace/js.js

开源软件地址:

https://github.com/jterrace/js.js

开源编程语言:

JavaScript 100.0%

开源软件介绍:

js.js is a JavaScript interpreter in JavaScript. Instead of trying to create an interpreter from scratch, SpiderMonkey is compiled into LLVM and then emscripten translates the output into JavaScript.


Demos

See several running demos here.

Paper

Academic paper to appear at WebApps 2012 located here.

Status

The compiled version of js.js is 3MB and only 594KB after gzip compression. Using the Sunspider benchmark, the interpreter is about 200 times slower than Spidermonkey's native interpreter with the JIT compiler turned off. More optimizations 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); //2
JSJS.End(jsObjs);

More examples are available in the examples directory.

Files

The following files are located in the src directory.

File Description
js.O0.js Command-line JS shell, no optimizations
js.O0.min.js Command-line JS shell, no optimizations, closure compiled
js.O1.js Command-line JS shell, O1 optimizations
js.O1.min.js Command-line JS shell, O1 optimizations, closure compiled
js.O2.js Command-line JS shell, O2 optimizations
js.O2.min.js Command-line JS shell, O2 optimizations, closure compiled
libjs.O0.js JSAPI shared library, no optimizations
libjs.O0.min.js JSAPI shared library, no optimizations, closure compiled with js.js wrapper
libjs.O1.js JSAPI shared library, O1 optimizations
libjs.O1.min.js JSAPI shared library, O1 optimizations, closure compiled with js.js wrapper
libjs.O2.js JSAPI shared library, O2 optimizations
libjs.O2.min.js JSAPI shared library, O2 optimizations, closure compiled with js.js wrapper
jsjs-wrapper.js js.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-minified version (useful for debugging and modifications):

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
nhn/tui.calendar: 发布时间:2022-07-07
下一篇:
metafloor/bwip-js: Barcode Writer in Pure JavaScript发布时间:2022-07-07
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap