| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
| 6 | 6 |
| 7 load("test/mjsunit/wasm/wasm-constants.js"); | 7 load("test/mjsunit/wasm/wasm-constants.js"); |
| 8 load("test/mjsunit/wasm/wasm-module-builder.js"); | 8 load("test/mjsunit/wasm/wasm-module-builder.js"); |
| 9 | 9 |
| 10 (function testExportedMain() { | 10 (function testExportedMain() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 assertEquals(String(f.index), e.a.name); | 134 assertEquals(String(f.index), e.a.name); |
| 135 })(); | 135 })(); |
| 136 | 136 |
| 137 | 137 |
| 138 (function testReexportJSMultipleIdentity() { | 138 (function testReexportJSMultipleIdentity() { |
| 139 print("TestReexportMultipleIdentity..."); | 139 print("TestReexportMultipleIdentity..."); |
| 140 var builder = new WasmModuleBuilder(); | 140 var builder = new WasmModuleBuilder(); |
| 141 | 141 |
| 142 function js() {} | 142 function js() {} |
| 143 | 143 |
| 144 var a = builder.addImport("a", kSig_v_v); | 144 var a = builder.addImport("m", "a", kSig_v_v); |
| 145 builder.addExport("f", a); | 145 builder.addExport("f", a); |
| 146 builder.addExport("g", a); | 146 builder.addExport("g", a); |
| 147 | 147 |
| 148 let instance = builder.instantiate({a: js}); | 148 let instance = builder.instantiate({m: {a: js}}); |
| 149 let e = instance.exports; | 149 let e = instance.exports; |
| 150 assertEquals("function", typeof e.f); | 150 assertEquals("function", typeof e.f); |
| 151 assertEquals("function", typeof e.g); | 151 assertEquals("function", typeof e.g); |
| 152 assertFalse(e.f == js); | 152 assertFalse(e.f == js); |
| 153 assertFalse(e.g == js); | 153 assertFalse(e.g == js); |
| 154 assertTrue(e.f == e.g); | 154 assertTrue(e.f == e.g); |
| 155 })(); | 155 })(); |
| 156 | 156 |
| 157 | 157 |
| 158 (function testReexportJSMultiple() { | 158 (function testReexportJSMultiple() { |
| 159 print("TestReexportMultiple..."); | 159 print("TestReexportMultiple..."); |
| 160 var builder = new WasmModuleBuilder(); | 160 var builder = new WasmModuleBuilder(); |
| 161 | 161 |
| 162 function js() {} | 162 function js() {} |
| 163 | 163 |
| 164 var a = builder.addImport("a", kSig_v_v); | 164 var a = builder.addImport("q", "a", kSig_v_v); |
| 165 var b = builder.addImport("b", kSig_v_v); | 165 var b = builder.addImport("q", "b", kSig_v_v); |
| 166 builder.addExport("f", a); | 166 builder.addExport("f", a); |
| 167 builder.addExport("g", b); | 167 builder.addExport("g", b); |
| 168 | 168 |
| 169 let instance = builder.instantiate({a: js, b: js}); | 169 let instance = builder.instantiate({q: {a: js, b: js}}); |
| 170 let e = instance.exports; | 170 let e = instance.exports; |
| 171 assertEquals("function", typeof e.f); | 171 assertEquals("function", typeof e.f); |
| 172 assertEquals("function", typeof e.g); | 172 assertEquals("function", typeof e.g); |
| 173 assertFalse(e.f == js); | 173 assertFalse(e.f == js); |
| 174 assertFalse(e.g == js); | 174 assertFalse(e.g == js); |
| 175 assertFalse(e.f == e.g); | 175 assertFalse(e.f == e.g); |
| 176 })(); | 176 })(); |
| OLD | NEW |