Chromium Code Reviews| Index: test/mjsunit/wasm/test-import-export-wrapper.js |
| diff --git a/test/mjsunit/wasm/test-import-export-wrapper.js b/test/mjsunit/wasm/test-import-export-wrapper.js |
| index df03aec9f5f499957f1c47975756b597e29ef061..793c478ab82dc86f1e549c6680dd5b684f6b35f3 100644 |
| --- a/test/mjsunit/wasm/test-import-export-wrapper.js |
| +++ b/test/mjsunit/wasm/test-import-export-wrapper.js |
| @@ -66,6 +66,66 @@ var expect_no_elison = 1; |
| assertEquals(%CheckWasmWrapperElision(the_export, expect_elison), true); |
| })(); |
| +// Function calls stack: first_export -> first_func -> first_import -> |
| +// second_export -> second_import |
| +// In this case, first_import and second_export have same signature, |
| +// So that wrappers will be removed. If the wrappers do are not removed, then |
|
Mircea Trofin
2016/11/03 14:38:29
remove "do" (If the wrappers...)
ahaas
2016/11/07 08:10:51
I fixed it in https://codereview.chromium.org/2481
|
| +// the test crashes because of the int64 parameter, which is not allowed in the |
|
Mircea Trofin
2016/11/03 14:38:29
while at it - the test fails, right? (OK, maybe it
ahaas
2016/11/07 08:10:51
I do not understand your question. This test would
|
| +// wrappers. |
| +(function TestWasmWrapperElisionInt64() { |
| + var imported = function (a) { |
| + return a; |
| + }; |
| + |
| + var second_module = new WasmModuleBuilder(); |
| + var sig_index1 = second_module.addType(kSig_i_i); |
| + var sig_index_ll = second_module.addType(kSig_l_l); |
| + second_module |
| + .addImportWithModule("import_module_2", "import_name_2", sig_index1); |
| + second_module |
| + .addFunction("second_export", sig_index_ll) |
| + .addBody([ |
| + kExprGetLocal, 0, |
| + kExprI32ConvertI64, |
| + kExprCallFunction, 0, |
| + kExprI64SConvertI32, |
| + kExprReturn |
| + ]) |
| + .exportFunc(); |
| + |
| + var first_module = new WasmModuleBuilder(); |
| + var sig_index = first_module.addType(kSig_i_v); |
| + var sig_index_ll = first_module.addType(kSig_l_l); |
| + first_module |
| + .addImportWithModule("import_module_1", "import_name_1", sig_index_ll); |
| + first_module |
| + .addFunction("first_export", sig_index) |
| + .addBody([ |
| + kExprI64Const, 2, |
| + kExprCallFunction, 2, |
| + kExprI32ConvertI64, |
| + kExprReturn |
| + ]) |
| + .exportFunc(); |
| + first_module |
| + .addFunction("first_func", sig_index_ll) |
| + .addBody([ |
| + kExprI64Const, 1, |
| + kExprGetLocal, 0, |
| + kExprI64Add, |
| + kExprCallFunction, 0, |
| + kExprReturn |
| + ]); |
| + |
| + var f = second_module |
| + .instantiate({import_module_2: {import_name_2: imported}}) |
| + .exports.second_export; |
| + var the_export = first_module |
| + .instantiate({import_module_1: {import_name_1: f}}) |
| + .exports.first_export; |
| + assertEquals(the_export(), 3); |
| +})(); |
| + |
| // function calls stack: first_export -> first_func -> first_import -> |
| // second_export -> second_import |
| // In this case, second_export has less params than first_import, |