As the ECMAScript specification evolves, industrial-scale JavaScript compilers face the challenge of supporting modern language syntax while maintaining compatibility for diverse execution environments. Traditionally, compilers solve this by running transpilation passes in a monolithic pipeline, where the transpilation passes are chosen to execute strictly based on a target language level. This results in significant computational waste, as compilers perform expensive Abstract Syntax Tree (AST) traversals to lower features that may not exist in the actual input source code. We present a compiler improvement that conditionally executes transpiler passes based on accurately tracking and dynamically maintaining the exact set of language features present in the compilation unit throughout the transpilation process. It is implemented in the production Google Closure Compiler. By populating and maintaining a FeatureSet at every JavaScript script-level, it dynamically skips running unnecessary lowering passes. We detail the architectural safeguards -- including strategic pass ordering and dynamic validation of the transpiled code for feature-correctness. Evaluation of this improvement on large-scale production monorepos produced a considerable reduction in compilation time and saved compute and memory usage.


翻译:随着ECMAScript规范的演进,工业级JavaScript编译器面临支持现代语言语法同时保持对不同执行环境兼容性的挑战。传统上,编译器通过在单一管道中运行转译通道来解决这一问题,其中转译通道的选择严格基于目标语言级别执行。这导致了显著的计算浪费,因为编译器会执行昂贵的抽象语法树遍历来降低实际输入源代码中可能不存在的特性。我们提出了一种编译器改进方案,该方案基于在整个转译过程中准确追踪并动态维护编译单元中存在的精确语言特征集,从而条件性地执行转译通道。该方案已在谷歌闭包编译器(Google Closure Compiler)的生产环境中实现。通过在每个JavaScript脚本级别填充并维护特征集(FeatureSet),系统动态跳过不必要的降级通道执行。我们详细介绍了架构保障措施——包括策略性通道排序和对转译代码进行特征正确性的动态验证。在大型生产级单体仓库上的评估表明,该改进方案显著减少了编译时间,并节省了计算和内存资源的使用。

0
下载
关闭预览

相关内容

编译器(Compiler),是一种计算机程序,它会将用某种编程语言写成的源代码(原始语言),转换成另一种编程语言(目标语言)。
《软件定义网络元素与机器代码的形式化验证》
专知会员服务
14+阅读 · 2025年11月18日
Transformer文本分类代码
专知会员服务
118+阅读 · 2020年2月3日
【翻译技术速递】测评:免费的术语抽取工具
翻译技术沙龙
139+阅读 · 2019年11月2日
Xsser 一款自动检测XSS漏洞工具
黑白之道
14+阅读 · 2019年8月26日
多图带你读懂 Transformers 的工作原理
AI研习社
10+阅读 · 2019年3月18日
React Native 分包哪家强?看这文就够了!
程序人生
13+阅读 · 2019年1月16日
WebAssembly在QQ邮箱中的一次实践
IMWeb前端社区
13+阅读 · 2018年12月19日
【干货】深入理解自编码器(附代码实现)
【干货】一文读懂什么是变分自编码器
专知
12+阅读 · 2018年2月11日
神经网络机器翻译原理:LSTM、seq2seq到Zero-Shot
北京思腾合力科技有限公司
11+阅读 · 2017年8月10日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
ECCV 2026 | MIMFlow:MIM与归一化流统一图像生成
专知会员服务
1+阅读 · 22分钟前
网状网络及其在军事领域的运用
专知会员服务
4+阅读 · 今天6:18
无美国参与的欧洲战争方式(万字长文)
专知会员服务
4+阅读 · 今天5:54
《国防领域敏感性分析白皮书》
专知会员服务
5+阅读 · 今天3:42
综述 | 从问答到任务完成:Agent系统与Harness设计
Agentic RL:框架、实践与长程智能体训练
专知会员服务
4+阅读 · 6月24日
重新思考无人机时代的生存能力
专知会员服务
8+阅读 · 6月24日
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
6+阅读 · 6月24日
在人工智能加速决策环境中拓展OODA循环
专知会员服务
8+阅读 · 6月24日
相关资讯
【翻译技术速递】测评:免费的术语抽取工具
翻译技术沙龙
139+阅读 · 2019年11月2日
Xsser 一款自动检测XSS漏洞工具
黑白之道
14+阅读 · 2019年8月26日
多图带你读懂 Transformers 的工作原理
AI研习社
10+阅读 · 2019年3月18日
React Native 分包哪家强?看这文就够了!
程序人生
13+阅读 · 2019年1月16日
WebAssembly在QQ邮箱中的一次实践
IMWeb前端社区
13+阅读 · 2018年12月19日
【干货】深入理解自编码器(附代码实现)
【干货】一文读懂什么是变分自编码器
专知
12+阅读 · 2018年2月11日
神经网络机器翻译原理:LSTM、seq2seq到Zero-Shot
北京思腾合力科技有限公司
11+阅读 · 2017年8月10日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员