Archive

Posts Tagged ‘IonMonkey’

Firefox/SpiderMonkey的龙芯MIPS64后端

November 1st, 2015 1 comment

不久之前写过一篇博客[1]为龙芯CPU”辩护”, 解释为什么龙芯CPU的JavaScript性能会很低.

就我个人的经验而言,龙芯的 SunSpider 性能差异更多的应该是在软件层面。现代的浏览器都通过(多个层级的)JIT来对JavaScript进行加速,开启和关闭JIT的SunSpider、Kraken、Octane 跑分差异可能会相差20~30倍。使用 iPhone 的同学可以在 Safari 和微信自带的浏览器中测试对比下速度差异(iOS 中只有 Safari 可以开 JIT)。三大开源浏览器JIT引擎对于龙芯采用的MIPS后端的支持都还很初级,甚至还不能正常使用。龙芯官方[6]和开源爱好者[5]的数据也印证了龙芯CPU跑 JavaScript 的尴尬。软件层面的缺失,或者往大了说,生态环境的问题,也是龙芯(MIPS架构)需要面对的一个大问题。

但是现在情况可能就要大不同了. 中科梦兰(龙芯系)的 heiher[2] 同学在今年开始频繁地向 Mozilla 提交MIPS64后端代码[3], 相信启用了JavaScript JIT的 Firefox 在龙芯CPU会有很大的性能提升. 到时候(瞎猜)快个20倍也说不定哦 😉

[1]: 龙芯CPU的JavaScript性能

[2]: http://hev.cc

[3]: Bugzilla User Activity

SpiderMonkey 开始计划提供 JS 覆盖率信息

September 9th, 2015 No comments

Mozilla Bugzilla 上已经有了对应的 meta bug. 具体的实现可能需要再等一到两个月.

Nicolas B. Pierron [:nbp] 2015-07-30 08:05:23 PDT
This is a meta bug to add Code Coverage for JavaScript code executed in SpiderMonkey. We have multiple reasons to do that:

The most important is to support release management team, by producing Code Coverage information over executed JavaScript code, and producing gcov-like data files. This would help improve the quality of Firefox, and help evaluate the quality of our tests to accept/refuse new features.

The second reason is to expose this information to the dev-tools, such that JavaScript developers do not have to instrument their code to have code coverage results within the dev-tools.

The third, if the overhead is neglectable, is to make use of the same information to improve IonMonkey register allocation and removal of unused basic blocks ahead of time.

[JS-internals] Jit DevTools 0.0.1

June 18th, 2015 No comments

转发,我一直期待(但是自己没有做)的工具之一:

Nicolas B. Pierron via lists.mozilla.org

Hello everybody,

I am please to do an early announce a new tool named Jit DevTools.

This new tool is an addon which mostly target Jit developers.  It uses the recently added Debugger.onIonCompilation hook to display the latest MIR [1] and LIR graphs within the dev tools.

To use this tool, go to a web page, and open the Jit DevTools panel, then wait until a function got compiled.

Once a function is compiled, you can select a compiled script, which will display the MIR graph of the compilation.  If you need to, you can also have a look at the LIR graph.  The output is similar to the one rendered with iongraph [5].

By selecting any inlined script, the background of the block titles will change color, if the block correspond to the inlined instance.  This feature is quite useful to identify how a function plays in a compiled script.

You might find this tool quite handy to use for the following use cases:
– Investigating DOM optimization.
– Investigating jsperf issues.
– Comparing function implementations, and impacts on the generated code.

This addon works on optimized builds, and even with parallel compilation enabled.

You can download [2] this early version from http://people.mozilla.org/~npierron/jit-dev-tools/ , or build it your-self by using the sources [3] with jpm tool [4].

Have fun, and enjoy.

[1] http://people.mozilla.org/~npierron/jit-dev-tools/jit-dev-tools-0.0.1.png
[2] http://people.mozilla.org/~npierron/jit-dev-tools/jit-dev-tools-0.0.1.xpi
[3] https://github.com/nbp/jit-dev-tools/
[4] https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm
[5] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Hacking_Tips#Using_IonMonkey_spew_%28JS_shell%29

谁在为SpiderMonkey提交代码

June 13th, 2013 No comments

Ehsan Akhgari 在自己的一篇博客[1]中介绍了如何通过 git 的 log 日志统计得到了各个开发人员的提交统计. 并给出了Mozilla SpiderMonkey 引擎开发人员2012年上半年的提交统计, 这是一部分结果:

Ehsan 在博客中同时提供了生成数据的(一行)命令脚本, 并对各个参数进行了详细的解释. 只要是 git 仓库就可以使用这种脚本进行统计(需要改一下起始时间和结束时间). 如果你有兴趣, 可以看看自己的仓库中谁最努力. 🙂

[1]: Data about people’s contribution to the Mozilla code base

 

[SpiderMonkey] 利用 IonSpew 输出调试信息

May 31st, 2013 No comments

SpiderMonkey 中默认提供了 IonSpew, 可以用来输出JIT编译器的内部信息. 使用方法是通过 debug 模式编译 JSShell, 然后在调用 ./js 的时候设置 IONFLAGS 宏. 例如:

JSShell 会在屏幕上输出 IonMonkey JIT 各个编译阶段的 IR 内容, 以及代码生成(CodeGen)的内容. 同时, 还会将完整的  MIR 信息输出到 /tmp/ion.json 和 /tmp/ion.cfg 两个文件中, 分别可以被 IonGraph[1] 和 C1visualizer[2] 图形化的显示.

IonSpew 有一个”通道”的概念, 类似于系统log中的”info”, “verbose”, “error” 等类型, 不同的是 IonSpew 中的通道都是独立的, 没有等级的概念.

可以很方便的在 IonSpew 中建立自己的”通道”, 用于程序的调试或性能分析. 只需要三步:

第一步, 添加通道的名称. 在”mozilla-central/js/src/ion/IonSpewer.h”中找到”IONSPEW_CHANNEL_LIST”宏, 在最后追加一个通道的名字, 这里假设叫”HelloIonSpew”:

第二步, 激活通道. 在”mozilla-central/js/src/ion/IonSpewer.cpp”中找到”ion::CheckLogging()”函数, 照葫芦画瓢的添加两行代码:

第三步, 调用 IonSpew. 在文件中包含”IonSpew.h”, 就可以通过”IonSpew()”输出信息了.

Enjoy. 🙂

[1]: https://github.com/sstangl/iongraph‎

[2]: http://c1visualizer.java.net