| 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 --allow-natives-syntax | 5 // Flags: --expose-wasm --allow-natives-syntax |
| 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 var expect_elison = 0; | 10 var expect_elison = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 .exports.first_export; | 61 .exports.first_export; |
| 62 assertEquals(the_export(2), 3); | 62 assertEquals(the_export(2), 3); |
| 63 assertEquals(the_export(-1), 0); | 63 assertEquals(the_export(-1), 0); |
| 64 assertEquals(the_export(0), 1); | 64 assertEquals(the_export(0), 1); |
| 65 assertEquals(the_export(5.5), 6); | 65 assertEquals(the_export(5.5), 6); |
| 66 assertEquals(%CheckWasmWrapperElision(the_export, expect_elison), true); | 66 assertEquals(%CheckWasmWrapperElision(the_export, expect_elison), true); |
| 67 })(); | 67 })(); |
| 68 | 68 |
| 69 // Function calls stack: first_export -> first_func -> first_import -> | 69 // Function calls stack: first_export -> first_func -> first_import -> |
| 70 // second_export -> second_import | 70 // second_export -> second_import |
| 71 // In this case, first_import and second_export have same signature, | 71 // In this test, first_import and second_export have the same signature, and |
| 72 // So that wrappers will be removed. If the wrappers do are not removed, then | 72 // therefore the wrappers will be removed. If the wrappers are not removed, then |
| 73 // the test crashes because of the int64 parameter, which is not allowed in the | 73 // the test crashes because of the int64 parameter, which is not allowed in the |
| 74 // wrappers. | 74 // wrappers. |
| 75 (function TestWasmWrapperElisionInt64() { | 75 (function TestWasmWrapperElisionInt64() { |
| 76 var imported = function (a) { | 76 var imported = function (a) { |
| 77 return a; | 77 return a; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 var second_module = new WasmModuleBuilder(); | 80 var second_module = new WasmModuleBuilder(); |
| 81 var sig_index1 = second_module.addType(kSig_i_i); | 81 var sig_index1 = second_module.addType(kSig_i_i); |
| 82 var sig_index_ll = second_module.addType(kSig_l_l); | 82 var sig_index_ll = second_module.addType(kSig_l_l); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 .exports.second_export; | 292 .exports.second_export; |
| 293 var the_export = first_module | 293 var the_export = first_module |
| 294 .instantiate({import_module_1: {import_name_1: f}}) | 294 .instantiate({import_module_1: {import_name_1: f}}) |
| 295 .exports.first_export; | 295 .exports.first_export; |
| 296 assertEquals(the_export(2.8, 9.1), 11); | 296 assertEquals(the_export(2.8, 9.1), 11); |
| 297 assertEquals(the_export(-1.7, -2.5), -3); | 297 assertEquals(the_export(-1.7, -2.5), -3); |
| 298 assertEquals(the_export(0.0, 0.0), 0); | 298 assertEquals(the_export(0.0, 0.0), 0); |
| 299 assertEquals(the_export(2, -2), 0); | 299 assertEquals(the_export(2, -2), 0); |
| 300 assertEquals(%CheckWasmWrapperElision(the_export, expect_no_elison), true); | 300 assertEquals(%CheckWasmWrapperElision(the_export, expect_no_elison), true); |
| 301 })(); | 301 })(); |
| OLD | NEW |