| 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 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 load("test/mjsunit/wasm/wasm-constants.js"); | 9 load("test/mjsunit/wasm/wasm-constants.js"); |
| 10 load("test/mjsunit/wasm/wasm-module-builder.js"); | 10 load("test/mjsunit/wasm/wasm-module-builder.js"); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 b.addImport("foo", "bar", kSig_v_v); | 74 b.addImport("foo", "bar", kSig_v_v); |
| 75 assertTypeError(b.toBuffer(), {}); | 75 assertTypeError(b.toBuffer(), {}); |
| 76 b = builder(); | 76 b = builder(); |
| 77 b.addImport("foo", "bar", kSig_v_v); | 77 b.addImport("foo", "bar", kSig_v_v); |
| 78 assertLinkError(b.toBuffer(), {foo: {}}); | 78 assertLinkError(b.toBuffer(), {foo: {}}); |
| 79 b = builder(); | 79 b = builder(); |
| 80 b.addImport("foo", "bar", kSig_v_v); | 80 b.addImport("foo", "bar", kSig_v_v); |
| 81 assertLinkError(b.toBuffer(), {foo: {bar: 9}}); | 81 assertLinkError(b.toBuffer(), {foo: {bar: 9}}); |
| 82 | 82 |
| 83 b = builder(); | 83 b = builder(); |
| 84 b.addImportedGlobal("foo", "bar", kAstI32); | 84 b.addImportedGlobal("foo", "bar", kWasmI32); |
| 85 assertTypeError(b.toBuffer(), {}); | 85 assertTypeError(b.toBuffer(), {}); |
| 86 b = builder(); | 86 b = builder(); |
| 87 b.addImportedGlobal("foo", "bar", kAstI32); | 87 b.addImportedGlobal("foo", "bar", kWasmI32); |
| 88 assertLinkError(b.toBuffer(), {foo: {}}); | 88 assertLinkError(b.toBuffer(), {foo: {}}); |
| 89 b = builder(); | 89 b = builder(); |
| 90 b.addImportedGlobal("foo", "bar", kAstI32); | 90 b.addImportedGlobal("foo", "bar", kWasmI32); |
| 91 assertLinkError(b.toBuffer(), {foo: {bar: ""}}); | 91 assertLinkError(b.toBuffer(), {foo: {bar: ""}}); |
| 92 b = builder(); | 92 b = builder(); |
| 93 b.addImportedGlobal("foo", "bar", kAstI32); | 93 b.addImportedGlobal("foo", "bar", kWasmI32); |
| 94 assertLinkError(b.toBuffer(), {foo: {bar: () => 9}}); | 94 assertLinkError(b.toBuffer(), {foo: {bar: () => 9}}); |
| 95 | 95 |
| 96 b = builder(); | 96 b = builder(); |
| 97 b.addImportedMemory("foo", "bar"); | 97 b.addImportedMemory("foo", "bar"); |
| 98 assertTypeError(b.toBuffer(), {}); | 98 assertTypeError(b.toBuffer(), {}); |
| 99 b = builder(); | 99 b = builder(); |
| 100 b.addImportedMemory("foo", "bar"); | 100 b.addImportedMemory("foo", "bar"); |
| 101 assertLinkError(b.toBuffer(), {foo: {}}); | 101 assertLinkError(b.toBuffer(), {foo: {}}); |
| 102 b = builder(); | 102 b = builder(); |
| 103 b.addImportedMemory("foo", "bar", 1); | 103 b.addImportedMemory("foo", "bar", 1); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 134 let b = builder(); | 134 let b = builder(); |
| 135 b.addImport("foo", "bar", kSig_v_l); | 135 b.addImport("foo", "bar", kSig_v_l); |
| 136 assertConversionError(b.addFunction("run", kSig_v_v).addBody([ | 136 assertConversionError(b.addFunction("run", kSig_v_v).addBody([ |
| 137 kExprI64Const, 0, kExprCallFunction, 0 | 137 kExprI64Const, 0, kExprCallFunction, 0 |
| 138 ]).exportFunc().end().toBuffer()); | 138 ]).exportFunc().end().toBuffer()); |
| 139 | 139 |
| 140 assertConversionError(builder().addFunction("run", kSig_l_v).addBody([ | 140 assertConversionError(builder().addFunction("run", kSig_l_v).addBody([ |
| 141 kExprI64Const, 0 | 141 kExprI64Const, 0 |
| 142 ]).exportFunc().end().toBuffer()); | 142 ]).exportFunc().end().toBuffer()); |
| 143 })(); | 143 })(); |
| OLD | NEW |