Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
<div algorithm>
The algorithm <dfn>ToValueType</dfn>(|s|) performs the following steps:
1. If |s| equals "i32", return [=𝗂𝟥𝟤=].
1. If |s| equals "i64", return [=𝗂𝟨𝟦=].
1. If |s| equals "f32", return [=𝖿𝟥𝟤=].
1. If |s| equals "f64", return [=𝖿𝟨𝟦=].
1. Otherwise, throw a {{TypeError}} exception.
Expand All @@ -756,6 +757,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
<div algorithm>
The algorithm <dfn>DefaultValue</dfn>(|valuetype|) performs the following steps:
1. If |valuetype| equals [=𝗂𝟥𝟤=], return [=𝗂𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝗂𝟨𝟦=], return [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝖿𝟥𝟤=], return [=𝖿𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝖿𝟨𝟦=], return [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0.
1. Otherwise, throw a {{TypeError}} exception.
Expand All @@ -765,7 +767,11 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
The <dfn constructor for="Global">Global(descriptor, v)</dfn> constructor, when invoked, performs the following steps:
1. Let |mutable| be |descriptor|["mutable"].
1. Let |valuetype| be [=ToValueType=](|descriptor|["value"]).
1. If |v| is undefined, let |value| be [=DefaultValue=](|valuetype|); otherwise, let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|).
1. If |v| is undefined,
1. let |value| be [=DefaultValue=](|valuetype|).
1. Otherwise,
1. If |valuetype| is [=𝗂𝟨𝟦=], throw a {{TypeError}} exception.
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|).
1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|.
1. Let |store| be the current agent's [=associated store=].
1. Let (|store|, |globaladdr|) be [=alloc_global=](|store|, |globaltype|, |value|). <!-- TODO(littledan): Report allocation failure https://github.com/WebAssembly/spec/issues/584 -->
Expand Down