From adeeb06bed5a14ea655b6ed2830824734f9f29af Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Wed, 3 Jun 2015 13:25:25 -0700 Subject: Polyfill to JavaScript As [discussed](https://github.com/WebAssembly/spec/issues/96#issuecomment-108582323) asm.js is a smart implementation strategy to get polyfills to execute fast, but isn't a requirement. Some features aren't supported by asm.js, and a polyfill may decide to avoid asm.js on some browsers when performance isn't quite there. --- HighLevelGoals.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'HighLevelGoals.md') diff --git a/HighLevelGoals.md b/HighLevelGoals.md index 6d6863a..06ef385 100644 --- a/HighLevelGoals.md +++ b/HighLevelGoals.md @@ -4,11 +4,10 @@ to serve as a compilation target which can be compiled to execute at native speed by taking advantage of common hardware capabilities. 2. Specify and implement incrementally: - * design [v.1](V1.md) of the standard as a Minimum Viable Product with roughly - the same functionality as [asm.js](http://asmjs.org); + * design [v.1](V1.md) of the standard as a Minimum Viable Product; * ship an effective [polyfill](V1.md#polyfill) library for v.1 that translates - WebAssembly code into asm.js in the client so that WebAssembly v.1 can run on - existing browsers at high speeds; + WebAssembly code into JavaScript in the client so that WebAssembly v.1 can run + on existing browsers at high speeds; * ship a follow-up to v.1 which adds several more [essential features](EssentialPostV1Features.md); and * continue to iteratively specify [additional features](FutureFeatures.md), -- cgit v1.2.3 From cd35f9b39f4d8bc186ea8b8fb889dc451113b8d7 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Thu, 4 Jun 2015 12:46:48 -0700 Subject: Drop 'at high speeds', polyfill is already 'effective'. --- HighLevelGoals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'HighLevelGoals.md') diff --git a/HighLevelGoals.md b/HighLevelGoals.md index 7252b01..99653d6 100644 --- a/HighLevelGoals.md +++ b/HighLevelGoals.md @@ -8,7 +8,7 @@ roughly the same functionality as [asm.js](http://asmjs.org); * ship an effective [polyfill](MVP.md#polyfill) library for the MVP that translates WebAssembly code into JavaScript in the client so that - WebAssembly MVP can run on existing browsers at high speeds; + WebAssembly MVP can run on existing browsers; * ship a follow-up to the MVP which adds several more [essential features](EssentialPostMVPFeatures.md); and * continue to iteratively specify [additional features](FutureFeatures.md), -- cgit v1.2.3 From e5ae3cf844ded15daada4dbaf4afff90ffee4c05 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Thu, 4 Jun 2015 13:09:12 -0700 Subject: Refactor polyfill quite a bit. --- AstSemantics.md | 2 +- BinaryEncoding.md | 2 +- EssentialPostMVPFeatures.md | 9 +++++---- HighLevelGoals.md | 2 +- MVP.md | 11 ++--------- Polyfill.md | 29 +++++++++++++++++++---------- 6 files changed, 29 insertions(+), 26 deletions(-) (limited to 'HighLevelGoals.md') diff --git a/AstSemantics.md b/AstSemantics.md index ee16571..2adb7b8 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -248,7 +248,7 @@ immediate use. The following primitives provide AST nodes that express control flow and thus allow more opportunities to build bigger expression trees and further reduce `SetLocal`/`GetLocal` usage (which constitute 30-40% of total bytes in the polyfill prototype). Additionally, these primitives are useful -building blocks for WebAssembly-generators (including the asm.js polyfill). +building blocks for WebAssembly-generators (including the JavaScript polyfill). * Comma - evaluate and ignore the result of the first operand, evaluate and return the second operand * Conditional - basically ternary ?: operator diff --git a/BinaryEncoding.md b/BinaryEncoding.md index a01f423..e605ea5 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -13,7 +13,7 @@ it as having three layers: compression algorithm like gzip to achieve. * This is not meant to be standardized, at least not initially, as it can be done with a downloaded decompressor that runs as web content on the client, and in particular - can be implemented in the polyfill. Not standardizing it leaves the binary + can be implemented in a polyfill. Not standardizing it leaves the binary encoding as the only thing a WebAssembly implementation is required to implement, which is nice. However, if the benefits are shown to be substantial, this will be reconsidered in the future. diff --git a/EssentialPostMVPFeatures.md b/EssentialPostMVPFeatures.md index fa20eb1..03ce2b2 100644 --- a/EssentialPostMVPFeatures.md +++ b/EssentialPostMVPFeatures.md @@ -1,9 +1,10 @@ # Essential Post-MVP Features -This is a list of essential features that are known to be needed ASAP, but were removed from -[the MVP](MVP.md) since there was not (yet) a portably-efficient polyfill via asm.js. There is a much bigger -[list of features](FutureFeatures.md) that will be added after this list, prioritized by feedback and -experience. +This is a list of essential features that are known to be needed ASAP, but were +removed from [the MVP](MVP.md) since there was not (yet) a portably-efficient +polyfill via JavaScript. There is a much bigger +[list of features](FutureFeatures.md) that will be added after this list, +prioritized by feedback and experience. ## Threads * Provide low-level buildings blocks for pthreads-style shared memory: shared memory, diff --git a/HighLevelGoals.md b/HighLevelGoals.md index 99653d6..d4b2772 100644 --- a/HighLevelGoals.md +++ b/HighLevelGoals.md @@ -6,7 +6,7 @@ 2. Specify and implement incrementally: * design [the MVP](MVP.md) of the standard as a Minimum Viable Product with roughly the same functionality as [asm.js](http://asmjs.org); - * ship an effective [polyfill](MVP.md#polyfill) library for the MVP that + * ship an effective [polyfill](Polyfill.md) library for the MVP that translates WebAssembly code into JavaScript in the client so that WebAssembly MVP can run on existing browsers; * ship a follow-up to the MVP which adds several more diff --git a/MVP.md b/MVP.md index 1f2d4be..5c36325 100644 --- a/MVP.md +++ b/MVP.md @@ -7,9 +7,10 @@ and need, but are post-MVP; these are in a separate [essential post-MVP features This document explains the contents of the MVP at a high-level. There are also separate docs with more precise descriptions of: + * the [polyfill to JavaScript](Polyfill.md) * the [AST semantics](AstSemantics.md) * the [binary encoding](BinaryEncoding.md) - + ## Modules * The primary unit of loadable, executable code is a *module*. * In a host environment with ES6 modules (browser, node.js), a WebAssembly @@ -142,14 +143,6 @@ precise descriptions of: * To keep an ArrayBuffer's length immutable, resizing a module's heap detaches any existent ArrayBuffers. * See the [AST Semantics heap section](AstSemantics.md#accessing-the-heap) for more details. - -## Polyfill - * A working prototype is in the [polyfill repo](https://github.com/WebAssembly/polyfill). - * Even before browsers ship native support for WebAssembly, users can derive - value from the polyfill due to the decreased download size of the - [binary encoding](BinaryEncoding.md) and minimal impact on startup performance. - * To maintain good polyfill performance, the [polyfill library will diverge](Polyfill.md#polyfill-deviations) - from the specified WebAssembly semantics in certain corner case scenarios. ## Non-browser embedding * Host environments can define builtin modules that are implemented natively but can otherwise diff --git a/Polyfill.md b/Polyfill.md index eb51fcf..66bc6fb 100644 --- a/Polyfill.md +++ b/Polyfill.md @@ -1,19 +1,28 @@ -# Polyfill to asm.js +# Polyfill to JavaScript -Even before browsers ship native support for WebAssembly, users can derive -value from a polyfill to asm.js due to the decreased download size of the -[binary encoding](BinaryEncoding.md) and minimal impact on startup performance. -This also allows us to experiment on the early binary encoding and get -developer feedback before finalizing the format and supporting it natively. +Even before browsers ship native support for WebAssembly, users can derive value +from a [polyfill](https://remysharp.com/2010/10/08/what-is-a-polyfill) to +JavaScript due to: -A working prototype to unpack the WebAssembly binary format into asm.js is in -the [polyfill repo](https://github.com/WebAssembly/polyfill). +* Decreased download size of the [binary encoding](BinaryEncoding.md); +* Minimal impact on startup performance; +* Building on existing proven approaches of running compiled C++ on the web with + good performance, such as through [asm.js](http://asmjs.org). + +This polyfill further allows us to experiment on the early binary encoding and +get developer feedback before finalizing the format and supporting it natively +as part of [MVP](MVP.md). + +A working prototype to unpack the WebAssembly binary format into JavaScript is +in the [polyfill repo](https://github.com/WebAssembly/polyfill). We leave open +the possibility of multiple polyfills existing to meet different developers' +needs. ## Polyfill Deviations A polyfill doesn't need to be 100% correct with respect to the WebAssembly -specification to be useful in practice. There are corner cases (which -generally fall into undefined behavior in C/C++) where asm.js does not have +specification to be useful in practice. There are corner cases (which generally +fall into undefined behavior in C/C++) where JavaScript and asm.js don't have ideal semantics to maintain correctness. To maintain good polyfill performance, the polyfill library will purposely -- cgit v1.2.3 From d94d55d8a900fa507ecfc59d37bba0ff33b70271 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Thu, 4 Jun 2015 13:22:59 -0700 Subject: Effective and efficient. --- HighLevelGoals.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'HighLevelGoals.md') diff --git a/HighLevelGoals.md b/HighLevelGoals.md index d4b2772..56c1bdb 100644 --- a/HighLevelGoals.md +++ b/HighLevelGoals.md @@ -6,8 +6,8 @@ 2. Specify and implement incrementally: * design [the MVP](MVP.md) of the standard as a Minimum Viable Product with roughly the same functionality as [asm.js](http://asmjs.org); - * ship an effective [polyfill](Polyfill.md) library for the MVP that - translates WebAssembly code into JavaScript in the client so that + * ship an effective and efficient [polyfill](Polyfill.md) library for the + MVP that translates WebAssembly code into JavaScript in the client so that WebAssembly MVP can run on existing browsers; * ship a follow-up to the MVP which adds several more [essential features](EssentialPostMVPFeatures.md); and -- cgit v1.2.3