JavaScript Interpreter

1, An interpreter evaluator page

http://cs.calstatela.edu/~abbott/Courses/CS_320a/JavaScript/evalJavaScript.html

2, WebKit’s core JavaScript engine just got a new interpreter, code-named SquirrelFish

SquirrelFish is fast—much faster than WebKit’s previous interpreter. Check out the numbers. On the SunSpider JavaScript benchmark, SquirrelFish is 1.6 times faster than WebKit’s previous interpreter.

http://webkit.org/blog/189/announcing-squirrelfish/

与之前的解释器使用遍历语法树的实现方式不同的是,SquirrelFish的实现采用字节码。
遍历语法树实现方式存在的高代价问题,在SquirrelFish字节码引擎中基本都不存在。首先,一个字节码流能够精确描述执行程序所需的操作,编译成字节码实际上隐性地跳过了不相关的语法结构。其次,字节码调度程序只是一个简单地从内存中直接读取,转而间接调度分支程序的过程。因此,执行字节码指令要比访问语法树节点快得多。第三,由于不再需要语法树,解释器无需继续在语法树节点间传送执行状态。

解释器使用字节码之后能够直接从字节码解释的所有的优化中获益匪浅,这也意味着SquirrelFish的速度还会继续得到提升。
在解析器使用字节码之后,我们目前实现的编译时优化有: 
常量折叠(constant folding)
更强的拷贝传播 
类型推断——包括精确和推测两种方式 
基于表达式上下文的特化——尤其是void和boolean上下文
窥孔优化(peephole optimization)
逃逸分析 (escape analysis)

SquirrelFish团队特别对那些在同一领域工作的人们表示了感谢,正是他们的研究成果激发了SquirrelFish的开发灵感。

3, Some great introductory reading on these topics includes:(from http://webkit.org/blog/189/announcing-squirrelfish/)
The Structure and Performance of Efficient Interpreters (Introduces the fundamentals of virtual machine design and explains the importance of direct threading) 

http://citeseer.ist.psu.edu/cache/papers/cs/32018/http:zSzzSzwww.jilp.orgzSzvol5zSzv5paper12.pdf/ertl03structure.pdf


Virtual Machine Showdown: Stack Versus Registers (Details the benefits of register machines, and the importance of copy propagation) 

http://www.sagecertification.org/events/vee05/full_papers/p153-yunhe.pdf


The Implementation of Lua 5.0 (Outlines the implementation of a real-world register-based bytecode engine, with a sliding register window calling convention)

http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/jucs05.pdf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值