[资料] [链接帖] 各JavaScript引擎的简介,及相关资料/博客收集帖
RednaxelaFX
2013-04-21
Jurassic
官方网站: http://jurassic.codeplex.com/ -------------------------------------------------------------------------- 我的评论: 不基于DLR的.NET上的JavaScript实现。下苦力把很多DLR已有的功能自己又实现了一遍。感觉就像明明已经有了基于DLR的IronPython 2,却模仿尚未有DLR时的IronPython 1来实现一样⋯ JavaScript对象由Jurassic.Library.ObjectInstance类实现。属性存在object[]里。 有隐藏类,就叫HiddenClassSchema。 -------------------------------------------------------------------------- |
|
RednaxelaFX
2013-04-21
dynjs
官方网站: http://dynjs.org/ 官方博客: http://blog.qmx.me/tag/dynjs/ 讨论组: http://groups.google.com/group/dynjs-dev 代码: https://github.com/dynjs/dynjs 兼容标准: ECMAScript 3(作者本意似乎是想实现ECMAScript 5,但是…) 主要人物: Douglas Campos -------------------------------------------------------------------------- 我的评论: 原本是想练手试试用invokedynamic在JVM上实现JavaScript。 后来发现要学明白invokedynamic到底干了什么还是先不用invokedynamic来实现个渣版本好。 结果就渣了。 dynjs现在的代码质量不咋的。同样是新一个基于JVM的JavaScript实现,dynjs的性能远不如Nashorn,ECMAScript标准的兼容性也尚不乐观。 感觉挺奇怪的,为什么这年头还会用些很别扭的设计⋯例如说那DynObject的实现就相当不伦不类,貌似是想要做点优化,但主体还真是个HashMap<String, PropertyDescriptor>⋯,不,是两个这样的map orz 然后PropertyDescriptor也巨肥 (我以前做过的一个talk里正好把这种设计作为一个烂实现到一个好实现的变换过程中的中间状态的例子⋯这仍然在烂实现级别) dynjs真不像是现代Java码农会写的代码⋯ e.g. Types.trimNumericString()里字符串拼接还用StringBuffer。 在DynObject里显式存着className也是缺乏经验。直接做成虚返回常量字符串就完事了嘛。回头应该顺便发个patch给dynjs把这些吐槽点都修了。 dynjs里JavaScript对象的属性访问都必须先把key转换成String类型来访问,包括对数组的下标访问。这很符合ECMAScript规范所定义的表面行为,但真的在实现里这样做就太低效了。就是一个个细节上都处理得很粗糙,dynjs的性能才会远不如Nashorn。 可以解释为uint32的属性key的值存在一个Object[]里,但访问却仍然是通过一个HashMap。巨诡异的设计。 什么都要自己发明一次的Bob McWhirter: rephract (基本上跟dynalink是同类但显然没dynalink成熟) -------------------------------------------------------------------------- 2013-03-24: Douglas Campos the release 2012: Douglas Campos building dynjs - the saga, DevInSampa 2012 2012-10-12: Douglas Campos dynjs: (almost) 100% invokedynamic JS implementation, JUDCon 2012 Boston Slides 2012-02-21: eller How dynjs handles function 2012-01-30: eller How dynjs runs javascript 2011-10-25: Douglas Campos dyn.js - 100% invokedynamic JavaScript implementation, JSConf.eu 2011 2011-10-02: Werner Schuster InvokeDynamic and Javascript: New Compiler Dyn.js, Oracle Nashorn and Rhino, InfoQ |
|
RednaxelaFX
2013-04-21
SPUR
2010-04-15: Charles Torre, Wolfram Schulte, Herman Venter, Nikolai Tillmann, and Manuel Fahndrich and Erik Meijer Inside SPUR - A Trace-Based JIT Compiler for CIL, Channel 9 2010-03-25: Michael Bebenita, Florian Brandner, Manuel Fahndrich, Francesco Logozzo, Wolfram Schulte, Nikolai Tillmann and Herman Venter SPUR: A Trace-Based JIT Compiler for CIL, Microsoft Research |
|
RednaxelaFX
2013-04-21
Rhino
官方网站: https://developer.mozilla.org/en/docs/Rhino 代码: https://github.com/mozilla/rhino 代码版本控制工具: CVS/Git -------------------------------------------------------------------------- 我的评论: 廉颇老矣… Rhino是Java版的SpiderMonkey。当时Netscape想用纯Java来实现新版浏览器,自然需要一个Java版的JavaScript引擎实现;另外也希望能在服务器端把JavaScript当作Java应用里的脚本语言使用。于是Rhino就诞生了。 官网自带Rhino历史,跟Wikipedia上的Rhino词条基本上一样,有兴趣的话可以去看看。 Parser是从SpiderMonkey移植过来的。自然也是手写的纯递归下降式。 JavaScript对象的接口是org.mozilla.javascript.Scriptable。主要实现类是IdScriptableObject、ScriptableObject。用Object[]来存字段,挺高效的。 IdScriptableObject { Object[] valueArray; short[] attributeArray; // ... } Rhino可以通过参数从11个预设的优化基本中选择一个使用。只从JVM以上的层面看,Rhino既可以工作于纯解释模式(-1),也可以工作于纯编译模式(0-9)。这11个级别分别是: -1: 只使用解释器。 0: 使用字节码编译器,但不做任何优化。 1: 2: 3: 4: 5: 6: 7: 8: 9: Oracle JDK7内嵌的Rhino的说明:https://jdk7.java.net/rhino/README.TXT 配置了security manager的时候JDK7自带的Rhino就只能用纯解释模式了。 -------------------------------------------------------------------------- 2012-04-25: 吴拓邦 Javascript对象字面量 2012-03-27: 吴拓邦 null == 0 ? 2012-03-14: 吴拓邦 new Object慢在哪儿(2) 2012-03-13: 吴拓邦 new Object慢在哪儿(1) 2011-10-13: Attila Szegedi Mozilla Rhino, GOTO Amsterdam 2011 Conference Slides 2010-09-21: John Rose Great Thundering Rhinos! (an expedition into JavaScript optimization) 2008-06-17: 莫枢 Rhino 1.7与Java集成的一个小例子 2008-06: Steve Yegg Rhinos and Tigers |
|
RednaxelaFX
2013-04-21
DMDScript
官方网站: http://www.digitalmars.com/dscript/ 兼容标准: ECMAScript 3.0 开源许可证: Boost 代码: https://github.com/DigitalMars/DMDScript 最新版本: v1.16 -------------------------------------------------------------------------- 我的评论: DMDScript是Digital Mars的ECMAScript 3实现。基本上是Walter Bright一个人的项目。 它的实现思路应该可以算是同时代JavaScript有代表性的了。它宣称比Netscape的JavaScript实现和Microsoft的JScript实现都快很多。不过后来Walter Bright没兴趣继续开发它了,所以它也就停留在只能跟老一代JavaScript较量的水平。 有两个版本,一个用D语言实现的自由版,和一个用C++实现的商业版。两版本都以源码形式发布。C++版有提供预先构造好的二进制动态链接库。 下面考察D语言实现的版本。 JavaScript对象的属性用D语言内建的关联数组(也就是一个hashmap)来存。 Dobject { PropTable* proptable; Dobject internal_prototype; d_string className; // ... } PropTable { Property[Value] table; // D语言的关联数组:key : Value -> value : Property PropTable* previous; // 链到internal_prototype的PropTable } Property { uint attributes; Value value; } 这里并没有专门针对密集数组做优化,依赖D语言自身的关联数组的性能。这个关联数组是一个hashmap,基于数组来实现buckets,hash冲突用二叉树来解决。 编译器的中心数据结构是AST。每个节点的toIR()方法实现codegen逻辑。看起来是个很简单的单趟编译器。 [source] -> parser -> [ast] -> ast.toIR() -> [IR] 执行引擎的核心是一个字节码解释器。准确说是一个“线性IR解释器“。IR的设计比较肥,行号之类的信息都挂在IR结构体里。 解释器核心循环在opcodes.d里。基本的for(;;) { switch(opcode) { } } 形式解释器循环。字节码指令是基于寄存器形式的。这个基于寄存器的设计恐怕是它比JScript的老版本快的一个重要原因。 所有成员访问(x.y、x[y])都会对x的值临时装箱成对象。 自动内存管理是靠D语言自带的GC。 也顺带考察一下C++实现的版本吧。主要实现方式跟D语言版基本一致,所以只是要看个大概的话不用看C++版。 当然这边有些D语言版没有的功能,例如跟COM对象交互。 GC用的似乎是mark bits和allocation bits在外部分配的保守式、BIBOP式mark-sweep。对被管理的对象无侵入,这是个优点;但保守式GC会留下漂浮垃圾的问题自然也存在。 C++版的PropTable仍然是一个hashtable,自己实现的。 -------------------------------------------------------------------------- 2011-08-11: Mike Parker DMDScript Now on GitHub 2010-03-22: Mike Parker DMDScript Now Under Boost License 2007-07-28: Compairing Adobe AIR to dmdscript / fastcgijs / gtkjs 2007-07-27: javascript2, ECMAScript4 and dmdscript. 2007-07-13: dmdscript with fastcgi 2007-05-20: dmdscript - the EMCAScript (javascript) engine in D - adding objects |
|
RednaxelaFX
2013-04-21
JScript
(特指老版本(<= 5.8)的JScript) 官方博客: http://blogs.msdn.com/b/jscript/ 兼容标准: ECMAScript 3.0 (或者说JScript版的标准) JScript Versio Information -------------------------------------------------------------------------- 我的评论: 只要你不在用IE8或更老的IE,或者是WSH (Windows Script Host),那你多半已经没什么机会碰到这个古老的JavaScript实现。JScript 5.8(IE8里的JScript)之后版本号重新计算了,下一个大版本就是IE9里的JScript 9.0,代号Chakra,在前面有介绍。 JScript里对象里属性的存储基本上是靠Hashtable;数组性质的对象最初也是为稀疏数组优化,背后仍然是用Hashtable来存储。到IE8/JScript 5.8才加上了对密集数组的存储/访问优化。 执行引擎是个简单的解释器,switch-threading形式的解释器主循环,位于CScriptRuntime::Run(VAR*)。在jscript.dll里这个switch被编译为一个table-based dispatch。 被这两处调用: ScrFncObj::CallWithFrameOnStack(VAR *,int,VAR *,VAR *,ulong) ScrFncObj::Call(VAR *,int,VAR *,VAR *,ulong) 用于优化字符串拼接用的BuildString类。在Chakra里也继承了下来。 JScript里包装类型的对象似乎会有奇怪的内存泄漏问题。Mark两帖回头研究下 http://bbs.51js.com/viewthread.php?tid=70162&page=1 http://www.cnblogs.com/winter-cn/archive/2008/06/26/1213151.html 如果寒冬大大得出的结论是正确的,那么IE6的JScript是怎么会把临时包装对象给挂住了,甚是奇怪。或许包装对象有缓存?那用一个新的小值冲掉缓存就好了? 有趣的是JScript不但有微软自家的实现,还有Wine项目重新实现的版本。随手抓个链接。 要Bug-for-bug兼容JScript真辛苦了这群开发…好吧他们做这个(重新)实现时其实从SpiderMonkey借了些代码。 -------------------------------------------------------------------------- 2013-01-10: Daniel F Pupius Gmail and the GC 2010-04-14: Moving from Out of proc to in proc com, in IE 8 这里有组有趣的stack trace可以看到JScript的一些执行路径,截取一段: jscript.dll!CScriptRuntime::Run() + 0x233e bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e796 bytes jscript.dll!NameTbl::InvokeInternal() + 0xb1 bytes jscript.dll!VAR::InvokeByDispID() + 0x5cd bytes jscript.dll!VAR::InvokeJSObj<SYM *>() + 0x136a bytes jscript.dll!VAR::InvokeByName() + 0x64 bytes jscript.dll!VAR::InvokeDispName() + 0x73 bytes jscript.dll!VAR::InvokeByDispID() + 0x1f3d bytes jscript.dll!CScriptRuntime::Run() + 0x41bd bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e796 bytes jscript.dll!NameTbl::InvokeInternal() + 0xb1 bytes jscript.dll!VAR::InvokeByDispID() + 0x5cd bytes jscript.dll!VAR::InvokeJSObj<SYM *>() + 0x136a bytes jscript.dll!VAR::InvokeByName() + 0x64 bytes jscript.dll!VAR::InvokeDispName() + 0x73 bytes jscript.dll!VAR::InvokeByDispID() + 0x1f3d bytes jscript.dll!CScriptRuntime::Run() + 0x41bd bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e796 bytes jscript.dll!CSession::Execute() + 0x14a bytes jscript.dll!NameTbl::InvokeDef() + 0x146 bytes jscript.dll!NameTbl::InvokeEx() - 0x42f bytes jscript.dll!NameTbl::Invoke() + 0x3f bytes 跟这帖里VBScript的stack trace对比就可以发现JScript跟VBScript确实是近亲。 这里也有一组IE/JScript的stack trace: ntdll.dll!@RtlpLowFragHeapFree@8() - 0xf3 bytes ntdll.dll!_RtlFreeHeap@12() + 0x26e8f bytes ole32.dll!CRetailMalloc_Free() + 0x1c bytes oleaut32.dll!APP_DATA::FreeCachedMem() + 0x88 bytes oleaut32.dll!_SysFreeString@4() + 0x35 bytes oleaut32.dll!_VariantClear@4() + 0x1d3 bytes ieframe.dll!Detour_VariantClear() + 0x2f bytes jscript.dll!VAR::Clear() + 0x52 bytes jscript.dll!GcAlloc::ReclaimGarbage() + 0xa2 bytes jscript.dll!GcContext::Reclaim() + 0x8d bytes jscript.dll!GcContext::CollectCore() + 0xd7 bytes jscript.dll!GcContext::Collect() + 0x34 bytes jscript.dll!CScriptRuntime::Run() - 0x1565a bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e4d7 bytes jscript.dll!NameTbl::InvokeInternal() + 0xb1 bytes jscript.dll!VAR::InvokeByDispID() + 0x5cd bytes jscript.dll!VAR::InvokeJSObj<SYM *>() + 0x136a bytes jscript.dll!VAR::InvokeByName() + 0x64 bytes jscript.dll!VAR::InvokeDispName() + 0x73 bytes jscript.dll!VAR::InvokeByDispID() + 0x1f3d bytes jscript.dll!CScriptRuntime::Run() + 0x233e bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e4d7 bytes jscript.dll!NameTbl::InvokeInternal() + 0xb1 bytes jscript.dll!VAR::InvokeByDispID() + 0x5cd bytes jscript.dll!VAR::InvokeJSObj<SYM *>() + 0x136a bytes jscript.dll!VAR::InvokeByName() + 0x64 bytes jscript.dll!VAR::InvokeDispName() + 0x73 bytes jscript.dll!VAR::InvokeByDispID() + 0x1f3d bytes jscript.dll!CScriptRuntime::Run() + 0x233e bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e4d7 bytes jscript.dll!NameTbl::InvokeInternal() + 0xb1 bytes jscript.dll!VAR::InvokeByDispID() + 0x5cd bytes jscript.dll!VAR::InvokeJSObj<SYM *>() + 0x136a bytes jscript.dll!VAR::InvokeByName() + 0x64 bytes jscript.dll!VAR::InvokeDispName() + 0x73 bytes jscript.dll!VAR::InvokeByDispID() + 0x1f3d bytes jscript.dll!CScriptRuntime::Run() + 0x233e bytes jscript.dll!ScrFncObj::CallWithFrameOnStack() + 0x9f bytes jscript.dll!ScrFncObj::Call() - 0x3e4d7 bytes jscript.dll!CSession::Execute() + 0x14a bytes jscript.dll!COleScript::ExecutePendingScripts() + 0x1a0 bytes jscript.dll!COleScript::ParseScriptTextCore() + 0x1e9 bytes jscript.dll!COleScript::ParseScriptText() + 0x30 bytes mshtml.dll!CScriptCollection::ParseScriptText() + 0x18d bytes mshtml.dll!CScriptElement::CommitCode() - 0x42 bytes mshtml.dll!CScriptElement::Execute() + 0x8f bytes mshtml.dll!CHtmParse::Execute() + 0x577b bytes mshtml.dll!CHtmPost::Broadcast() + 0xf bytes mshtml.dll!CHtmPost::Exec() + 0x16a bytes mshtml.dll!CHtmPost::Run() + 0x15 bytes mshtml.dll!PostManExecute() + 0x90 bytes mshtml.dll!PostManResume() + 0x92 bytes mshtml.dll!CHtmPost::OnDwnChanCallback() + 0x10 bytes mshtml.dll!CDwnChan::OnMethodCall() + 0x19 bytes mshtml.dll!GlobalWndOnMethodCall() + 0xcc bytes mshtml.dll!GlobalWndProc() + 0xae bytes user32.dll!_InternalCallWinProc@20() + 0x28 bytes user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes user32.dll!_DispatchMessageWorker@8() + 0xdc bytes user32.dll!_DispatchMessageW@4() + 0xf bytes ieframe.dll!CTabWindow::_TabWindowThreadProc() - 0x3216a bytes ieframe.dll!LCIETab_ThreadProc() + 0x4423 bytes iertutil.dll!CIsoScope::RegisterThread() - 0x3223 bytes kernel32.dll!_BaseThreadStart@8() + 0x37 bytes 2008-09-08: Janakiram MSV What's New for JScript in IE8?, Channel 9 2008-04-23: Jaiprakash GC Improvements in JScript for Internet Explorer 8 Beta 1, JScript Blog 2008-04-08: Jaiprakash Performance Optimization of Arrays - Part II, JScript Blog 2008-03-25: Jaiprakash Performance Optimization of Arrays - Part I, JScript Blog 2008-03-19: Jaiprakash Insight into String Concatenation in JScript, JScript Blog 2008-02-08: Patrick Dussud Patrick Dussud: Managing Garbage Collection, Channel 9 Patrick Dussud可称为微软各种VM里的GC的奠基人。JScript、早期的VBScript、早期的CLR,这些VM的GC都是由他主导设计实现的。这个访谈(大概19分钟开始)可以听到他描述JScript一开始就用保守式GC,从来没用过引用计数方式实现自动内存管理;而VBScript虽然一开始也用同一个GC,但后来被别人接手后改为使用引用计数,性能反而比JScript差。 2007-10-17: Jaiprakash Performance issues with "String Concatenation" in JScript., JScript Blog 2007-09-05: Don Raman Regular Expression optimization done in Jscript 5.7 release, JScript Blog 2007-07-26: Don Raman Scope chain of JScript Functions, JScript Blog 2007-01-04: Peter Gurevich IE+JScript Performance Recommendations Part 3: JavaScript Code Inefficiencies, IE Blog 2006-11-16: Peter Gurevich IE+JavaScript Performance Recommendations Part 2: JavaScript Code Inefficiencies, IE Blog 2006-08-29: Peter Gurevich IE + JavaScript Performance Recommendations - Part 1, IE Blog 2005-04-26: Eric Lippert How Do Script Engines Implement Object Identity? 这篇提到了JScript里的对象实现为VARIANT。用COM真悲催系列。 2004-11-01: Bradley Grainger Profiling JScript, Part 1 2004-10-30: Bradley Grainger Profiling JScript, Part 0 2004-07-26: Eric Lippert JScript Equality Operators, plus More On Mad Crushes 2003-09-17: Eric Lippert How Do The Script Garbage Collectors Work? 这篇描述的是早期JScript里的GC的实现方式:无分代的mark-and-sweep。 2003-09-17: Eric Lippert Are JScript strings passed by reference? 虽然ECMAScript规范里说string是值类型,但实际上JScript的实现里string的传递还是用引用——反正传值(拷贝整个string的内容)和传引用(只拷贝指向某个string的指针)从JavaScript程序里看不出区别,因为string不可变。 2003-09-14: Peter Torr Compiled, interpreted, whatever 主要讲的是JScript.NET的一些实现特点,里面也穿插着关于JScript的一些信息。这里我们关心的JScript在文中叫做“JScript classic”。留意Eric Lippert的评论,他是当年真的参与实现JScript的开发之一,所说的东西可信度高: Eric Lippert 写道 Peter Torr 写道 Every now and then, people talk about "compiled" versus "interpreted" languages, and how they are different.
This distinction is both arbitrary and vague, and indeed, JScript Classic blurs the line considerably. JScript Classic acts like a compiled language in the sense that before any JScript Classic program runs, we fully syntax check the code, generate a full parse tree, and generate a bytecode. We then run the bytecode through a bytecode interpreter. In that sense, JScript is every bit as "compiled" as Java. The difference is that JScript does not allow you to persist or examine our proprietary bytecode. Also, the bytecode is much higher-level than the JVM bytecode -- the JScript Classic bytecode language is little more than a linearization of the parse tree, whereas the JVM bytecode is clearly intended to operate on a low-level stack machine. JScript .NET is even harder to characterize as "compiled" or "interpreted". Like JScript Classic, the JScript .NET compiler produces bytecode, but this time it is Common Language Runtime Intermediate Language (IL) bytecode. Instead of interpreting the bytecode, the CLR JIT-compiles it into native machine language. But that's not all -- to implement features like "eval", JScript .NET also provides the ability to generate a parse tree and then run an interpreter _directly_ on the parse tree. In JScript .NET, calling "eval" does not generate a byte code which is then interpreted, it generates a parse tree which can interpret itself. "Compiled" and "interpreted" have ceased to be useful buckets for categorizing programming languages. There are some "interpreted" languages which are faster than some "compiled" languages, there are some "compiled" languages which are more flexible than some "interpreted" languages -- at some point you have to look at the actual relevant characteristics of each tool rather than trying to summarize them as "just another interpreted language" or "just another compiled language". Eric |
|
RednaxelaFX
2013-04-21
Managed JScript
-------------------------------------------------------------------------- 我的评论: Managed JScript是微软写的基于DLR的ECMAScript实现。 当初这个项目还活着的时候,它就只公开了在Silverlight上运行的版本。当然,所有能在Silverlight上运行的程序都“应该”能在桌面CLR上运行,所以通过一些“小改造”我们也可以让Managed JScript在桌面上跑。 最后一个外界可下载到的Managed JScript是2008年10月发布的,在CodePlex上:Silverlight Dynamic Languages SDK 0.4.0 Silverlight Dynamic Languages SDK 0.4.0里包含的Managed JScript实现方式相当简单。基本上就是怎样实现起来快就怎么做,尽可能的多利用DLR和.NET基本库里现成的功能。所以确实,就算它开源出来继续发展也未必就能比后来出现的IronJS快。所以大家也不必太为Managed JScript的消逝而感到可惜;原本对Managed JScript有所期待的,请关注同样基于DLR的IronJS吧。 Managed JScript基本上也是依赖Dictionary<SymbolId, object>来存属性,没有用上hidden class之类的优化技巧;自然的,inline caching也没用上。 比较有趣的地方是它的parser用纯运算符优先级方式实现。这在其它JavaScript引擎里相当少见。 -------------------------------------------------------------------------- 2009-06-02: Future of Managed JScript (IronJScript)? Managed JScript已死,有事请烧纸系列。 回帖里Bill Chi说除了parser外当时的Managed JScript也没啥还能用的了,所以开源出来给大家也没意义。诶… 2008-10-29: Anders Heijsberg The Future of C#, PDC 2008 这个演讲里,26:00左右演示了C# 4.0的dynamic特性与Managed JScript交互的例子。 2008-10-08: 莫枢 在WinXP上构建V8 这篇的末尾简要提了下Managed JScript跟当时另外几个JavaScript引擎的对比。 2007-08-16: Gaurav Seth Difference between JScript, JScript.NET and Managed JScript 2007-05-31: Michael Schwarz Running managed JavaScript in Silverlight 2007-05-06: Jim Hugunin, John Lam Just Glue It! Ruby and the DLR in Silverlight, MIX07 2007-05-04: Deepak Jain Managed JScript announced, JScript Blog 2007-04-30: Jim Hugunin A Dynamic Language Runtime (DLR) |
|
RednaxelaFX
2013-04-21
Narcissus
代码: https://github.com/mozilla/narcissus 代码版本控制工具: Git https://github.com/mozilla/narcissus/wiki/Narcissus-internals -------------------------------------------------------------------------- 我的评论: 用JavaScript实现的JavaScript引擎。所谓的“元循环虚拟机”(metacircular VM)。 新Narcisus的parser是纯递归下降式。但老Narcissus的却是递归下降+表达式级别的运算符优先级方式混合型。 (老版本的Narcissus在这里: http://mxr.mozilla.org/mozilla/source/js/narcissus/) JavaScript对象直接用宿主VM的原生JavaScript对象。好偷懒。 -------------------------------------------------------------------------- 2011-08-08: w3ctech 2011 JavaScript专题会议(广州站)综述, InfoQ China JS in JS 视频 2011-07-26: Zaphod 1.2 available, Mozilla Labs Blog 2010-09-22: Dave Herman Zaphod: A Browser Language Lab for JS 2010-11-17: 赵劼 使用Narcissus解析JavaScript代码 2010-09-18: Tom Austin Zaphod/Narcissus — tools for JavaScript language research, Mozilla Labs Blog 2010-09-17: Andreas Gal Narcissus/Zaphod JavaScript Research VM for Firefox 4 2010-09-16: Tom Austin Zaphod 1.0 Released, Mozilla Labs Blog |
|
RednaxelaFX
2013-04-22
Continuum
官方网站: http://benvie.github.io/continuum/ 代码: https://github.com/Benvie/continuum 代码版本控制工具: Git 兼容标准: ECMAScript 6 -------------------------------------------------------------------------- 我的评论: 跟上面提到的Narcisuss一样是元循环VM。不过这个实现的标准是ECMAScript 6,而使用的实现语言是ECMAScript 3,没有依赖特殊扩展,所以在较老的IE上都可以运行。 -------------------------------------------------------------------------- |
|
RednaxelaFX
2013-04-22
先占楼留作扩展用 2
JavaScript Performance Thread 这长楼值得爬 2011-10-02: 鈴木勇介 Let's WeakMap 2010-10-12: Ariya Hidayat JavaScript Engines: How to Compile Them 2011-07-28: Andreas Gal High Performance JavaScript 2011-07-01 High Performance JavaScript: JITs in Firefox 2011 IonMonkey: One JIT to Rule Them All 2013-08-20: 任寰(奇虎360) JavaScript引擎的性能优化, Velocity 2013 Beijing http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/ 只是个rant,论据不够实力 http://www.aosd.net/2012/images/stories/bak.pdf http://dl.acm.org/citation.cfm?id=2429069.2429114&coll=DL&dl=ACM&CFID=228518743&CFTOKEN=78973405 http://www.slideshare.net/WillHuangTW/java-script-jsdc2013 我編譯故我在:誰說 Node.JS 程式不能編成Binary / Fred Chien Video Slides https://github.com/cfsghost/npk 把压缩最小化后的JavaScript源码直接嵌入一个C++文件里调用V8来eval()⋯这怎能算编译 XDD 2007-11-14: John Resig The World of ECMAScript http://bga.github.io/list-of-ecmascript-engines/ 2007-11-29: 周爱民 JavaScript引擎技术, 2007软件开发2.0大会 (上面Google Group的链接不知为啥无效,百度文库分流) 2011-09-11: http://www.slideshare.net/ElenDonda/artigo-web30-1 2011-09-19: JavaScript Engines: Under the Hood Video Slides 引用 A browser's JavaScript engine can seem like a magical black box. During this session, we'll show you how they work from 10,000 feet and give you the tricks to compile all the popular engines out there including JavaScriptCore, V8, and SpiderMonkey). We'll inspect the internals of the engine, and debug+profile your favorite code snippets. Armed with just a little extra knowledge about this black box, you will be ready to take a new look at JavaScript apps.
For more videos from SenchaCon visit www.sencha.com/conference/videos http://www.slideshare.net/paullfc/js-engine-performance-10916857 http://www.slideshare.net/axemclion/understanding-javascript-engines https://gist.github.com/mattpodwysocki/1256066 http://www.slideshare.net/iamdvander/js-math-jiting-jsconfeu Garbage collection in JavaScript - Erik Corry https://github.com/mozilla/shumway/wiki/Getting-Started-with-AVM2 http://www.fd.ise.shibaura-it.ac.jp/blog/?p=314 http://www.jamesward.com/2007/12/18/qvm-mozillas-new-mobile-vm-for-ecmascript-4/ http://www.onflex.org/ACDS/AS3TuningInsideAVM2JIT.pdf http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf http://influxis.com/project-variant-and-a-question-to-the-community/ http://www.infoq.com/news/2007/11/understanding-actionscript-vm Lightspark http://lightspark.github.io https://github.com/lightspark/lightspark http://lightspark.sourceforge.net/lightspark-thesys.pdf An efficient ActionScript 3.0 Just-In-Time compiler implementation http://www.bluishcoder.co.nz/2008/05/extending-tamarin-tracing-with-forth.html <- dead link [Flash开发者交流][2010.05.30]avm2虚拟机浅析与as3性能优化(陈士凯) http://www.slideshare.net/isnda/flash20100530avm2as3 TAJS: Type Analyzer for JavaScript http://www.brics.dk/TAJS/ TAJS is a program analysis tool that can infer detailed and sound type information for JavaScript programs using abstract interpretation. 2012-12-15: Ben Liv_hits Static Analysis of Javascript, Air Mozilla Practical Static Analysis of JavaScript Applications in the Presence of Frameworks and Libraries Fully Abstract Compilation to JavaScript. Ejscript http://ejscript.org/ https://github.com/embedthis/ejs-2 Embedthis Open Source Software License http://www.ejscript.org/products/ejs/doc/ref/ejs/architecture.html 2012-05-07: Michael O'Brien Javascript for Embedded Servers Tachyon Maxime Chevalier https://github.com/Tachyon-Team/Tachyon/tree/master/source http://pointersgonewild.files.wordpress.com/2011/10/dls-talk.pdf http://pointersgonewild.wordpress.com/tachyon/ http://pointersgonewild.files.wordpress.com/2011/09/predoc.pdf Bootstrapping a Self-Hosted Research Virtual Machine for JavaScript, DLS2011 Tachyon: a Meta-circular Optimizing JavaScript Virtual Machine, CDP2010 Tachyon依赖于一个名为rlwrap的库来运行REPL。在Mac上可以在port里装。 2013-02-02: Erick Lavoie In Praise of Metacircular Virtual Machine Layering, Air Mozilla 2012-04-20: Maxime Chevalier-Boisvert The Indirection Problem 2012-04-02: Maxime Chevalier-Boisvert Inefficient Numerical Operators http://pointersgonewild.files.wordpress.com/2012/01/tachyon_gc.pdf 2012-01-12: Maxime Chevalier-Boisvert About Tachyon’s Garbage Collector 2012-01-06: Maxime Chevalier-Boisvert Tachyon’s Design Principles 2011-12-17: Maxime Chevalier-Boisvert Tachyon has a Garbage Collector! 2011-12-11: Maxime Chevalier-Boisvert Type Analysis for JavaScript 2011-11-29: Maxime Chevalier-Boisvert Good News for JavaScript! Bad News for Me… 2011-11-01: Maxime Chevalier-Boisvert Metaprogramming in JavaScript 2011-10-31: Maxime Chevalier-Boisvert What I’d like to Know about JavaScript Programs 2011-10-31: Maxime Chevalier-Boisvert Code Compactness and Optimization Levels 2011-10-25: Maxime Chevalier-Boisvert Presented at DLS 2011 2011-10-08: Maxime Chevalier-Boisvert Optimizing Global Value Numbering 2011-10-05: Maxime Chevalier-Boisvert What’s Next for Tachyon 2011-09-28: Maxime Chevalier-Boisvert New x86 Backend and… JavaScript Macros? 2011-08-27: Maxime Chevalier-Boisvert The Tachyon JavaScript Compiler Fast and Precise Hybrid Type Inference for JavaScript <- TODO get this paper! http://rfrn.org/~shu/drafts/ti.pdf Higgs http://dconf.org/2013/talks/chevalier_boisvert.html https://github.com/maximecb/Higgs http://pointersgonewild.files.wordpress.com/2013/01/higgs-presentation.pdf 2013-06-21: Maxime Chevalier-Boisvert How I miss you, dear SSA 2013-06-03: Maxime Chevalier-Boisvert Inlining in Higgs 2013-05-10: Maxime Chevalier-Boisvert Presented at DConf 2013 http://dconf.org/talks/chevalier_boisvert.html, DConf 2013 http://pointersgonewild.files.wordpress.com/2013/05/slides-maxime.pdf 2013-03-31: Maxime Chevalier-Boisvert Progress on the Higgs JIT 2013-03-04: Maxime Chevalier-Boisvert A Simple JIT Compiler 2013-02-02: Maxime Chevalier-Boisvert Higgs, a Monitoring JIT for JavaScript, Air Mozilla 2013-01-22: Maxime Chevalier-Boisvert Higgs has a Garbage Collector 2012-12-18: Maxime Chevalier-Boisvert Higgs has Exceptions 2012-12-08: Maxime Chevalier-Boisvert Higgs: My New Tracing JIT for JavaScript langjs https://bitbucket.org/pypy/lang-js/ https://bitbucket.org/pypy/lang-js/src/tip/js/javascript-interpreter.txt?at=default DMonkey http://sourceforge.jp/projects/dmonkey/ 实现语言: Delphi CVS VxEditor & DMonkey布教ページ -> DMonkey解説 JE - JavaScript::Engine https://metacpan.org/module/JE 实现语言: Perl J4P5 http://j4p5.sourceforge.net/ 实现语言: PHP 5 SEE - Simple ECMAScript Engine http://adaptive-enterprises.com/~d/software/see/ http://freecode.com/projects/see http://svn.mandriva.com/viewvc/packages/cooker/see/ svn co http://svn.mandriva.com/svn/packages/cooker/see/current ECMAScript 3.0 2010-12-19: Has anybody retained the sources to SEE (Simple Ecmascript Engine)? 树遍历解释器,discriminated union形式的值表现形式(SEE_value),相当简单的一个解释器。 依赖于libgc(Boehm GC)来提供GC功能。工作于保守GC模式。 https://github.com/jterrace/js.js 计子大大的JSinJS https://github.com/kissjs/JSinJS NJS JavaScript Interpreter Brian Bassett http://www.bbassett.net/njs/ http://www.njs-javascript.org/ <- 此链接已坏,请不要点 http://sourceforge.net/projects/njs/ 由NGS JavaScript Interpreter进化而来。NGS是一个名为New Generation Software的芬兰公司。 ROScript - RemObjects Script http://www.remobjects.com/script.aspx https://github.com/remobjects/script A fully native ECMAScript 1.5 (a.k.a. JavaScript) engine for .NET and Mono. http://www.remobjects.com/script 实现标准: ECMAScript 3.0 实现语言: Delphi .NET RemObjects Script 1.0基于DLR,而2.0版改写为不基于DLR。 一看到这种结构就可以大概知道对象模型是怎样实现的了: fValues: Dictionary<String, PropertyValue> MyJScript http://myjscript.codeplex.com/ 实现语言: C# 并非完整的ECMAScript 3.0实现,而是一个DLR例子。 EcmaScript.NET http://code.google.com/p/ecmascript-net/ Rhino的C#移植版 Jint - Javascript Interpreter for .NET http://jint.codeplex.com/ 实现语言: C# AST解释器。基于ANTLR的parser。 对象模型基本上是基于Dictionary<string, Descriptor>,有简易优化,但这优化的位置不太对,不是在callsite而是在对象里,感觉没啥用。 Mono JScript http://www.mono-project.com/JScript https://github.com/mono/old-code/tree/master/Microsoft.JScript/Microsoft.JScript 已死 Parser是从Rhino移植到C#而来。对象存储基于System.Collections.Hashtable。 quad-wheel http://code.google.com/p/quad-wheel/ 实现语言: C 标准: EMCAScript 3.0 群众喜闻乐见的引用计数方式的自动内存管理。 乍一看以为看到了COM…有些名字的选择实在是跟COM相似。用引用计数这点也很COM。 作者wenxichang,国人? tiny-js http://code.google.com/p/tiny-js/ 实现语言: C++ 边做词法/语法分析边直接执行,连AST都不构造,只构造符号表和变量的存储之类。跑循环的话需要反复parse。 JSMeter http://research.microsoft.com/en-us/projects/jsmeter/ Paruj Ratanaworabhan, Benjamin Livs_hits and Benjamin G. Zorn JSMeter: Comparing the Behavior of JavaScript Benchmarks with Real Web Applications http://archive.org/details/JeffTupholme-PythonJavascriptInterpreter-PyconUk2007 http://renesd.blogspot.com/2011/08/lets-make-%73hit-javascript-interpreter.html http://trac.parrot.org/parrot/wiki/Languages Parrot VM-based JavaScript implementations: ecmascript, PJS both inactive Winxed this one is JavaScript-like, but not compatible Dmitry Soshnikov JavaScript. The core. <- 帮助理解ECMAScript规范的系列文 2011-08-12: Yehuda Katz Understanding “Prototypes” in JavaScript http://javascript.crockford.com/prototypal.html http://discerning.com/burstproject.org/build/doc/shells.html 老文,关于当时能找到的一些JavaScript引擎/shell。 纯题外:Parenscript 大家关注ClojureScript的时候可能都不知道这种事情早就有人做过了。 Room 101: Constructors Considered Harmful http://vreugdenhilresearch.nl/Pwn2Own-2010-Windows7-InternetExplorer8.pdf 在Win7上绕开DEP和ASLR的例子 https://deepsec.net/docs/Slides/2012/DeepSec_2012_Rosario_Valotta_-_Taking_Browsers_Fuzzing_to_the_next_(DOM)_Level.pdf How to break on First-chance exception Microsoft C++ exception: Js::JavascriptExceptionObject at memory location 0x03CEE0E4 2013-01-02: Luis Cantero JS: Improve performance when starting IE using Visual Studio ToString() method causes app to crash Ming's Coding Blog: Rhino JavaScript security http://hacks.mozilla.org/2010/03/a-quick-note-on-javascript-engine-components/ Webkit - LLInt without JIT - Mac OS Forge - Nabble jsbcc 引用 jsbcc stands for JavasScript Byte Code Compiler. It compiles javascript files to SpiderMonkey byte code files.
http://www.christianwimmer.at/Publications/Chang09a/Chang09a.pdf 超古老+无甚营养,考古用 http://ce.aut.ac.ir/~a_hashemi/IT_engineering_I/fa06/lecutures/IT%20Engineering%20I.JavaScript-2(all).4spp.color.sec.pdf Esprima http://esprima.org/ https://github.com/ariya/esprima/blob/master/esprima.js 递归下降+运算符优先级混合式parser。在parseBinaryExpression部分是运算符优先级式的。这个parser是大量参考V8的parser的吧?<- 要考察 Twitter / esprima: How improvement in Google V8 ... https://twitter.com/esprima/status/212731699770032128 Jun 12, 2012 – Esprima @esprima 12 Jun. How improvement in Google V8 really helps #Esprima parsing speed with #Chrome pic.twitter.com/HoiYWvG3 ... 2011-12-13: Ariya Hidayat introducing esprima: blazing-fast javascript parser https://speakerdeck.com/josephj/javascript-code-quality asm.js asmjs.org/ 2013-05-31: Paul Krill C and C++ apps get Web boost from a JavaScript subset that allows Web browsers to better perform optimization, InfoWorld 2013-05-23: Peter Bright Surprise! Mozilla can produce near-native performance on the Web, Ars Technica 2013-03-28: Vyacheslav Egorov Why asm.js bothers me 2013-03-21: Luke Wagner asm.js in Firefox Nightly BESEN - Bero's EcmaScript Engine http://code.google.com/p/besen/ 实现语言: Object Pascal LGPL-2.1+ 有x86/x64 JIT http://code.google.com/p/besen/source/browse/trunk/docs/jit-design.txt InScript http://www.muchsoft.com/inscript/ iCab?这年头居然还有收费的浏览器,真神… TIScript https://code.google.com/p/tiscript/ 题外:Portable Just-in-time Specialization of Dynamically Typed Scripting Languages https://www.scss.tcd.ie/~mccandjm/papers/lcpc09_pres.pdf 讲对Lua解释器改造优化为JIT的。里面的技巧很取巧,拿C编译器当JIT编译器用orz 为啥Object.create()会慢这么多: http://jsperf.com/object-create-vs-constructor-vs-object-literal/85 原因主要是:1、现在JS引擎对它优化还不够;2、优化起来稍麻烦:至少要检查Object.create()没被重定义过,这形成了一个依赖。 http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/ Hear about the evolution of Javascript from a panel of experts who have taken it from an idea to where it stands today, and learn what is on the horizon for the little scripting language that became one of the most popular programming languages in the world. http://vimeopro.com/joyent/node-summit/video/46515491 From http://houbie.blogspot.ca/2013/06/javascript-on-jvm-experimenting-with.html?spref=tw : "I didn't use the Rhino specific less script, but instead used the standard less-1.3.3.js. I only had to add a few lines of JavaScript in front, to stub a little browser functionality, and add a compile function at the back to be called from Java." 2013-06: azakai What asm.js is and what asm.js isn't GATEKEEPER: Mostly Static Enforcement of Security and Reliability Policies for JavaScript Code, Microsoft Research Dependent Types for JavaScript, by Ravi Chugh, David Herman, Ranjit Jhala http://lambda-the-ultimate.org/node/4700 http://channel9.msdn.com/Blogs/Charles/From-the-Archives-Erik-Meijer-and-Mark-Shields-Compiling-MSIL-to-JS http://www.zdnet.com/mobile-pwn2own-iphone-4s-hacked-by-dutch-team-7000004498/ 纯个人怨念,Scan大大的东西 http://user.qzone.qq.com/215292260/blog/1373486539 https://github.com/PublicScan/JSMinus_v1 |
相关讨论
相关资源推荐
- 微软开源 JavaScript 引擎 ChakraCore-易语言
- 各类链接
- 《现代Javascript高级教程》JavaScript引擎的垃圾回收机制
- 深入了解JavaScript引擎精华,让你的代码执行更高效
- php js解析引擎,拿下JavaScript引擎的基本原理
- understand-js-runtimes:有关Java引擎的不同最新资源列表
- JS引擎(1):JS引擎擂台赛,JavaScript引擎的特征比较及术语科普
- V8 javascript 引擎
- JS引擎(0):JavaScript引擎群雄演义—起底JavaScript引擎
- JavaScript 引擎基本原理:Shapes 和 Inline Caches