Modified: trunk/JSTests/ChangeLog (213312 => 213313)
--- trunk/JSTests/ChangeLog 2017-03-02 23:43:16 UTC (rev 213312)
+++ trunk/JSTests/ChangeLog 2017-03-02 23:47:16 UTC (rev 213313)
@@ -1,3 +1,12 @@
+2017-03-02 Keith Miller <[email protected]>
+
+ WebAssemblyFunction should have Function.prototype as its prototype
+ https://bugs.webkit.org/show_bug.cgi?id=169101
+
+ Reviewed by Filip Pizlo.
+
+ * wasm/js-api/web-assembly-function.js: Added.
+
2017-02-28 Oleksandr Skachkov <[email protected]>
Use of arguments in arrow function is slow
Added: trunk/JSTests/wasm/js-api/web-assembly-function.js (0 => 213313)
--- trunk/JSTests/wasm/js-api/web-assembly-function.js (rev 0)
+++ trunk/JSTests/wasm/js-api/web-assembly-function.js 2017-03-02 23:47:16 UTC (rev 213313)
@@ -0,0 +1,20 @@
+import * as assert from '../assert.js';
+import Builder from '../Builder.js';
+
+const builder = (new Builder())
+ .Type().End()
+ .Function().End()
+ .Export()
+ .Function("foo")
+ .End()
+ .Code()
+ .Function("foo", { params: [], ret: "i32" })
+ .I32Const(1)
+ .End()
+ .End();
+
+const bin = builder.WebAssembly().get();
+const module = new WebAssembly.Module(bin);
+const instance = new WebAssembly.Instance(module);
+
+assert.eq(Object.getPrototypeOf(instance.exports.foo), Function.prototype);
Modified: trunk/Source/_javascript_Core/ChangeLog (213312 => 213313)
--- trunk/Source/_javascript_Core/ChangeLog 2017-03-02 23:43:16 UTC (rev 213312)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-03-02 23:47:16 UTC (rev 213313)
@@ -1,3 +1,16 @@
+2017-03-02 Keith Miller <[email protected]>
+
+ WebAssemblyFunction should have Function.prototype as its prototype
+ https://bugs.webkit.org/show_bug.cgi?id=169101
+
+ Reviewed by Filip Pizlo.
+
+ Per https://github.com/WebAssembly/design/blob/master/JS.md#exported-function-exotic-objects our JSWebAssemblyFunction
+ objects should have Function.prototype as their prototype.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+
2017-03-02 Mark Lam <[email protected]>
Add Options::alwaysCheckTraps() and Options::usePollingTraps() options.
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (213312 => 213313)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2017-03-02 23:43:16 UTC (rev 213312)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2017-03-02 23:47:16 UTC (rev 213313)
@@ -889,7 +889,7 @@
auto* webAssemblyPrototype = WebAssemblyPrototype::create(vm, this, WebAssemblyPrototype::createStructure(vm, this, m_objectPrototype.get()));
m_webAssemblyStructure.set(vm, this, JSWebAssembly::createStructure(vm, this, webAssemblyPrototype));
m_webAssemblyModuleRecordStructure.set(vm, this, WebAssemblyModuleRecord::createStructure(vm, this, m_objectPrototype.get()));
- m_webAssemblyFunctionStructure.set(vm, this, WebAssemblyFunction::createStructure(vm, this, m_objectPrototype.get()));
+ m_webAssemblyFunctionStructure.set(vm, this, WebAssemblyFunction::createStructure(vm, this, m_functionPrototype.get()));
auto* webAssembly = JSWebAssembly::create(vm, this, m_webAssemblyStructure.get());
putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), webAssembly, DontEnum);