<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210282] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210282">210282</a></dd>
<dt>Author</dt> <dd>jfbastien@apple.com</dd>
<dt>Date</dt> <dd>2017-01-04 11:27:01 -0800 (Wed, 04 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebAssembly JS API: add Module.sections
https://bugs.webkit.org/show_bug.cgi?id=165159
&lt;rdar://problem/29760326&gt;

Reviewed by Mark Lam.

JSTests:

As described here: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections

* wasm/Builder.js: allow custom sections to be duplicated
* wasm/js-api/Module.customSection.js: Added.
(assert.throws.WebAssembly.Module.prototype.customSections):
(assert.eq):

Source/JavaScriptCore:

As described in: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections

This was added for Emscripten, and is likely to be used soon.

* wasm/WasmFormat.h: custom sections are just name + bytes
* wasm/WasmModuleParser.cpp: parse them, instead of skipping over
* wasm/WasmModuleParser.h:
* wasm/js/WebAssemblyModulePrototype.cpp: construct the Array of
ArrayBuffer as described in the spec
(JSC::webAssemblyModuleProtoCustomSections):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmBuilderjs">trunk/JSTests/wasm/Builder.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmFormath">trunk/Source/JavaScriptCore/wasm/WasmFormat.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmModuleParsercpp">trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmWasmModuleParserh">trunk/Source/JavaScriptCore/wasm/WasmModuleParser.h</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyModulePrototypecpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModulePrototype.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestswasmjsapiModulecustomSectionjs">trunk/JSTests/wasm/js-api/Module.customSection.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/JSTests/ChangeLog        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2017-01-04  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+        WebAssembly JS API: add Module.sections
+        https://bugs.webkit.org/show_bug.cgi?id=165159
+        &lt;rdar://problem/29760326&gt;
+
+        Reviewed by Mark Lam.
+
+        As described here: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections
+
+        * wasm/Builder.js: allow custom sections to be duplicated
+        * wasm/js-api/Module.customSection.js: Added.
+        (assert.throws.WebAssembly.Module.prototype.customSections):
+        (assert.eq):
+
</ins><span class="cx"> 2017-01-04  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         We don't properly handle exceptions inside the nativeCallTrampoline macro in the LLInt
</span></span></pre></div>
<a id="trunkJSTestswasmBuilderjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/Builder.js (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/Builder.js        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/JSTests/wasm/Builder.js        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -713,7 +713,8 @@
</span><span class="cx">         if (this._checked) {
</span><span class="cx">             // Check uniqueness.
</span><span class="cx">             for (const s of this._sections)
</span><del>-                assert.falsy(s.name === name &amp;&amp; s.id === number, `Cannot have two sections with the same name &quot;${name}&quot; and ID ${number}`);
</del><ins>+                if (number !== _unknownSectionId)
+                    assert.falsy(s.name === name &amp;&amp; s.id === number, `Cannot have two sections with the same name &quot;${name}&quot; and ID ${number}`);
</ins><span class="cx">             // Check ordering.
</span><span class="cx">             if ((number !== _unknownSectionId) &amp;&amp; (this._sections.length !== 0)) {
</span><span class="cx">                 for (let i = this._sections.length - 1; i &gt;= 0; --i) {
</span></span></pre></div>
<a id="trunkJSTestswasmjsapiModulecustomSectionjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/wasm/js-api/Module.customSection.js (0 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/js-api/Module.customSection.js                                (rev 0)
+++ trunk/JSTests/wasm/js-api/Module.customSection.js        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+import Builder from '../Builder.js';
+import * as assert from '../assert.js';
+
+assert.throws(() =&gt; WebAssembly.Module.prototype.customSections(undefined, &quot;&quot;), TypeError, `WebAssembly.Module.prototype.customSections called with non WebAssembly.Module |this| value`);
+
+{
+    const empty = new WebAssembly.Module((new Builder()).WebAssembly().get());
+    assert.isArray(empty.customSections(&quot;&quot;));
+    assert.eq(empty.customSections(&quot;&quot;).length, 0);
+}
+
+{
+    const single = new WebAssembly.Module((new Builder())
+        .Unknown(&quot;hello&quot;).Byte(0x00).Byte(0x42).Byte(0xFF).End()
+        .WebAssembly().get());
+    assert.eq(single.customSections(&quot;&quot;).length, 0);
+    const hello = single.customSections(&quot;hello&quot;);
+    assert.eq(hello.length, 1);
+    assert.eq(hello[0].byteLength, 3);
+    const helloI8 = new Int8Array(hello[0]);
+    assert.eq(helloI8[0], 0x00);
+    assert.eq(helloI8[1], 0x42);
+    assert.eq(helloI8[2], -1);
+}
+
+{
+    const unicode = new WebAssembly.Module((new Builder())
+        .Unknown(&quot;👨‍❤️‍💋‍👨&quot;).Byte(42).End()
+        .WebAssembly().get());
+    const family = unicode.customSections(&quot;👨‍❤️‍💋‍👨&quot;);
+    assert.eq(family.length, 1);
+    assert.eq(family[0].byteLength, 1);
+    const familyI8 = new Int8Array(family[0]);
+    assert.eq(familyI8[0], 42);
+}
+
+{
+    const many = new WebAssembly.Module((new Builder())
+        .Unknown(&quot;zero&quot;).Byte(0).End()
+        .Unknown(&quot;one&quot;).Byte(1).Byte(1).End()
+        .Unknown(&quot;one&quot;).Byte(2).Byte(2).Byte(2).End()
+        .Unknown(&quot;two&quot;).Byte(3).Byte(3).Byte(3).Byte(3).End()
+        .Unknown(&quot;one&quot;).Byte(4).Byte(4).Byte(4).Byte(4).Byte(4).End()
+        .WebAssembly().get());
+
+    const zero = many.customSections(&quot;zero&quot;);
+    assert.eq(zero.length, 1);
+    assert.eq(zero[0].byteLength, 1);
+    const zeroI8 = new Int8Array(zero[0]);
+    assert.eq(zeroI8[0], 0);
+
+    const two = many.customSections(&quot;two&quot;);
+    assert.eq(two.length, 1);
+    assert.eq(two[0].byteLength, 4);
+    const twoI8 = new Int8Array(two[0]);
+    assert.eq(twoI8[0], 3);
+    assert.eq(twoI8[1], 3);
+    assert.eq(twoI8[2], 3);
+    assert.eq(twoI8[3], 3);
+
+    const one = many.customSections(&quot;one&quot;);
+    assert.eq(one.length, 3);
+    let seen = 0;
+    const expect = [
+        [1, 1],
+        [2, 2, 2],
+        [4, 4, 4, 4, 4],
+    ];
+    for (const section of one) {
+        assert.eq(section.byteLength, expect[seen].length);
+        const I8 = new Int8Array(section);
+        for (let i = 0; i &lt; expect[seen].length; ++i)
+            assert.eq(I8[i], expect[seen][i]);
+        ++seen;
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-01-04  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+        WebAssembly JS API: add Module.sections
+        https://bugs.webkit.org/show_bug.cgi?id=165159
+        &lt;rdar://problem/29760326&gt;
+
+        Reviewed by Mark Lam.
+
+        As described in: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodulecustomsections
+
+        This was added for Emscripten, and is likely to be used soon.
+
+        * wasm/WasmFormat.h: custom sections are just name + bytes
+        * wasm/WasmModuleParser.cpp: parse them, instead of skipping over
+        * wasm/WasmModuleParser.h:
+        * wasm/js/WebAssemblyModulePrototype.cpp: construct the Array of
+        ArrayBuffer as described in the spec
+        (JSC::webAssemblyModuleProtoCustomSections):
+
</ins><span class="cx"> 2017-01-04  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         We don't properly handle exceptions inside the nativeCallTrampoline macro in the LLInt
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmFormath"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmFormat.h (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmFormat.h        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/Source/JavaScriptCore/wasm/WasmFormat.h        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -220,6 +220,11 @@
</span><span class="cx">     bool m_isImport { false };
</span><span class="cx">     bool m_isValid { false };
</span><span class="cx"> };
</span><ins>+    
+struct CustomSection {
+    String name;
+    Vector&lt;uint8_t&gt; payload;
+};
</ins><span class="cx"> 
</span><span class="cx"> struct ModuleInformation {
</span><span class="cx">     Vector&lt;Import&gt; imports;
</span><span class="lines">@@ -235,6 +240,8 @@
</span><span class="cx">     TableInformation tableInformation;
</span><span class="cx">     Vector&lt;Global&gt; globals;
</span><span class="cx">     unsigned firstInternalGlobal { 0 };
</span><ins>+    Vector&lt;CustomSection&gt; customSections;
+
</ins><span class="cx">     size_t functionIndexSpaceSize() const { return importFunctionSignatureIndices.size() + internalFunctionSignatureIndices.size(); }
</span><span class="cx">     bool isImportedFunctionFromFunctionIndexSpace(size_t functionIndex) const
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmModuleParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -87,8 +87,7 @@
</span><span class="cx"> #undef WASM_SECTION_PARSE
</span><span class="cx"> 
</span><span class="cx">         case Section::Unknown: {
</span><del>-            // Ignore section's name LEB and bytes: they're already included in sectionLength.
-            m_offset += sectionLength;
</del><ins>+            WASM_FAIL_IF_HELPER_FAILS(parseCustom(sectionLength));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         }
</span><span class="lines">@@ -600,7 +599,31 @@
</span><span class="cx">     }
</span><span class="cx">     return { };
</span><span class="cx"> }
</span><ins>+    
+auto ModuleParser::parseCustom(uint32_t sectionLength) -&gt; PartialResult
+{
+    const uint32_t customSectionStartOffset = m_offset;
</ins><span class="cx"> 
</span><ins>+    CustomSection section;
+    uint32_t customSectionNumber = m_result.module-&gt;customSections.size() + 1;
+    uint32_t nameLen;
+    WASM_PARSER_FAIL_IF(!m_result.module-&gt;customSections.tryReserveCapacity(customSectionNumber), &quot;can't allocate enough memory for &quot;, customSectionNumber, &quot;th custom section&quot;);
+    WASM_PARSER_FAIL_IF(!parseVarUInt32(nameLen), &quot;can't get &quot;, customSectionNumber, &quot;th custom section's name length&quot;);
+    WASM_PARSER_FAIL_IF(!consumeUTF8String(section.name, nameLen), &quot;nameLen get &quot;, customSectionNumber, &quot;th custom section's name of length &quot;, nameLen);
+
+    uint32_t payloadBytes = sectionLength - (m_offset - customSectionStartOffset);
+    WASM_PARSER_FAIL_IF(!section.payload.tryReserveCapacity(payloadBytes), &quot;can't allocate enough memory for &quot;, customSectionNumber, &quot;th custom section's &quot;, payloadBytes, &quot; bytes&quot;);
+    for (uint32_t byteNumber = 0; byteNumber &lt; payloadBytes; ++byteNumber) {
+        uint8_t byte;
+        WASM_PARSER_FAIL_IF(!parseUInt8(byte), &quot;can't get &quot;, byteNumber, &quot;th data byte from &quot;, customSectionNumber, &quot;th custom section&quot;);
+        section.payload.uncheckedAppend(byte);
+    }
+    
+    m_result.module-&gt;customSections.uncheckedAppend(WTFMove(section));
+
+    return { };
+}
+
</ins><span class="cx"> } } // namespace JSC::Wasm
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBASSEMBLY)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmWasmModuleParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/WasmModuleParser.h (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/WasmModuleParser.h        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/Source/JavaScriptCore/wasm/WasmModuleParser.h        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">     FOR_EACH_WASM_SECTION(WASM_SECTION_DECLARE_PARSER)
</span><span class="cx"> #undef WASM_SECTION_DECLARE_PARSER
</span><span class="cx"> 
</span><ins>+    PartialResult WARN_UNUSED_RETURN parseCustom(uint32_t);
</ins><span class="cx">     PartialResult WARN_UNUSED_RETURN parseGlobalType(Global&amp;);
</span><span class="cx">     PartialResult WARN_UNUSED_RETURN parseMemoryHelper(bool isImport);
</span><span class="cx">     PartialResult WARN_UNUSED_RETURN parseTableHelper(bool isImport);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyModulePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModulePrototype.cpp (210281 => 210282)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModulePrototype.cpp        2017-01-04 19:23:48 UTC (rev 210281)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModulePrototype.cpp        2017-01-04 19:27:01 UTC (rev 210282)
</span><span class="lines">@@ -28,9 +28,16 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx"> 
</span><ins>+#include &quot;ArrayBuffer.h&quot;
</ins><span class="cx"> #include &quot;FunctionPrototype.h&quot;
</span><ins>+#include &quot;JSArrayBuffer.h&quot;
</ins><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><ins>+#include &quot;JSWebAssemblyModule.h&quot;
</ins><span class="cx"> 
</span><ins>+namespace JSC {
+static EncodedJSValue JSC_HOST_CALL webAssemblyModuleProtoCustomSections(ExecState*);
+}
+
</ins><span class="cx"> #include &quot;WebAssemblyModulePrototype.lut.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -39,9 +46,45 @@
</span><span class="cx"> 
</span><span class="cx"> /* Source for WebAssemblyModulePrototype.lut.h
</span><span class="cx">  @begin prototypeTableWebAssemblyModule
</span><ins>+ customSections webAssemblyModuleProtoCustomSections DontEnum|Function 1
</ins><span class="cx">  @end
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL webAssemblyModuleProtoCustomSections(ExecState* exec)
+{
+    VM&amp; vm = exec-&gt;vm();
+    auto* globalObject = exec-&gt;lexicalGlobalObject();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+
+    JSWebAssemblyModule* module = jsDynamicCast&lt;JSWebAssemblyModule*&gt;(exec-&gt;thisValue());
+    if (!module)
+        throwException(exec, throwScope, createTypeError(exec, ASCIILiteral(&quot;WebAssembly.Module.prototype.customSections called with non WebAssembly.Module |this| value&quot;)));
+    RETURN_IF_EXCEPTION(throwScope, { });
+
+    const String sectionNameString = exec-&gt;argument(0).getString(exec);
+    RETURN_IF_EXCEPTION(throwScope, { });
+
+    JSArray* result = constructEmptyArray(exec, nullptr, globalObject);
+    RETURN_IF_EXCEPTION(throwScope, { });
+
+    const auto&amp; customSections = module-&gt;moduleInformation().customSections;
+    for (const Wasm::CustomSection&amp; section : customSections) {
+        if (section.name == sectionNameString) {
+            auto buffer = ArrayBuffer::tryCreate(section.payload.data(), section.payload.size());
+            if (!buffer)
+                throwException(exec, throwScope, createOutOfMemoryError(exec));
+
+            Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, JSValue(), globalObject-&gt;arrayBufferStructure(ArrayBufferSharingMode::Default));
+            RETURN_IF_EXCEPTION(throwScope, { });
+
+            result-&gt;push(exec, JSArrayBuffer::create(vm, arrayBufferStructure, WTFMove(buffer)));
+            RETURN_IF_EXCEPTION(throwScope, { });
+        }
+    }
+
+    return JSValue::encode(result);
+}
+
</ins><span class="cx"> WebAssemblyModulePrototype* WebAssemblyModulePrototype::create(VM&amp; vm, JSGlobalObject*, Structure* structure)
</span><span class="cx"> {
</span><span class="cx">     auto* object = new (NotNull, allocateCell&lt;WebAssemblyModulePrototype&gt;(vm.heap)) WebAssemblyModulePrototype(vm, structure);
</span></span></pre>
</div>
</div>

</body>
</html>