diff options
| author | JF Bastien <jfb@chromium.org> | 2015-06-04 13:09:12 -0700 |
|---|---|---|
| committer | JF Bastien <jfb@chromium.org> | 2015-06-04 13:09:12 -0700 |
| commit | e5ae3cf844ded15daada4dbaf4afff90ffee4c05 (patch) | |
| tree | 79ba2afb0ce5c05396b22f3d146f65261f5fcfef | |
| parent | cd35f9b39f4d8bc186ea8b8fb889dc451113b8d7 (diff) | |
| download | nanowasm-design-e5ae3cf844ded15daada4dbaf4afff90ffee4c05.tar.gz | |
Refactor polyfill quite a bit.
| -rw-r--r-- | AstSemantics.md | 2 | ||||
| -rw-r--r-- | BinaryEncoding.md | 2 | ||||
| -rw-r--r-- | EssentialPostMVPFeatures.md | 9 | ||||
| -rw-r--r-- | HighLevelGoals.md | 2 | ||||
| -rw-r--r-- | MVP.md | 11 | ||||
| -rw-r--r-- | Polyfill.md | 29 |
6 files changed, 29 insertions, 26 deletions
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 @@ -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 |
