Upgrade V8 to 5.1.281.57 DO NOT MERGE
FPIIM-449
Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/test/mjsunit/wasm/export-table.js b/test/mjsunit/wasm/export-table.js
new file mode 100644
index 0000000..e85da9b
--- /dev/null
+++ b/test/mjsunit/wasm/export-table.js
@@ -0,0 +1,50 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-wasm
+
+load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function testExportedMain() {
+ var kReturnValue = 88;
+ var builder = new WasmModuleBuilder();
+
+ builder.addFunction("main", [kAstI32])
+ .addBody([
+ kExprReturn,
+ kExprI8Const,
+ kReturnValue])
+ .exportFunc();
+
+ var module = builder.instantiate();
+
+ assertEquals("object", typeof module.exports);
+ assertEquals("function", typeof module.exports.main);
+
+ assertEquals(kReturnValue, module.exports.main());
+})();
+
+(function testExportedTwice() {
+ var kReturnValue = 99;
+
+ var builder = new WasmModuleBuilder();
+
+ builder.addFunction("main", [kAstI32])
+ .addBody([
+ kExprReturn,
+ kExprI8Const,
+ kReturnValue])
+ .exportAs("blah")
+ .exportAs("foo");
+
+ var module = builder.instantiate();
+
+ assertEquals("object", typeof module.exports);
+ assertEquals("function", typeof module.exports.blah);
+ assertEquals("function", typeof module.exports.foo);
+
+ assertEquals(kReturnValue, module.exports.foo());
+ assertEquals(kReturnValue, module.exports.blah());
+})();