diff options
| author | Seth Thompson <s3th.thompson@gmail.com> | 2016-10-26 22:52:58 +0200 |
|---|---|---|
| committer | JF Bastien <github@jfbastien.com> | 2016-10-26 13:52:58 -0700 |
| commit | cad0ea9ed5f0ac1dda62abe2c66d0a38ff8c104d (patch) | |
| tree | bc913a187f7442120ba466d7fa28096abf193669 /FeatureTest.md | |
| parent | 35e5e2417964cb6eee4c79d33c0abb84e8b4cf18 (diff) | |
| download | nanowasm-design-cad0ea9ed5f0ac1dda62abe2c66d0a38ff8c104d.tar.gz | |
fix improperly spaced markdown blocks and typos (for formatting on website (#837)
Diffstat (limited to 'FeatureTest.md')
| -rw-r--r-- | FeatureTest.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/FeatureTest.md b/FeatureTest.md index fea9328..14e3bad 100644 --- a/FeatureTest.md +++ b/FeatureTest.md @@ -13,12 +13,14 @@ like. Since some WebAssembly features add operators and all WebAssembly code in a module is validated ahead-of-time, the usual JavaScript feature detection pattern: + ``` if (foo) foo(); else alternativeToFoo(); ``` + won't work in WebAssembly (if `foo` isn't supported, `foo()` will fail to validate). @@ -68,6 +70,7 @@ that one function was an optimized, but feature-dependent, version of another function (similar to the [`ifunc` attribute](https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html#index-g_t_0040code_007bifunc_007d-attribute-2529), but without the callback): + ``` #include <xmmintrin.h> void foo(...) { @@ -85,6 +88,7 @@ void foo_f64x2(...) __attribute__((optimizes("foo","f64x2"))) { ... foo(...); // calls either foo or foo_f64x2 ``` + In this example, the toolchain could emit both `foo` and `foo_f64x2` as function definitions in the "specific layer" binary format. The load-time polyfill would then replace `foo` with `foo_f64x2` if |
