OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "src/snapshot/code-serializer.h" | 8 #include "src/snapshot/code-serializer.h" |
9 #include "src/version.h" | 9 #include "src/version.h" |
10 #include "src/wasm/module-decoder.h" | 10 #include "src/wasm/module-decoder.h" |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 795 |
796 TEST(Run_WasmModule_Global_f32) { | 796 TEST(Run_WasmModule_Global_f32) { |
797 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); | 797 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); |
798 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); | 798 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); |
799 } | 799 } |
800 | 800 |
801 TEST(Run_WasmModule_Global_f64) { | 801 TEST(Run_WasmModule_Global_f64) { |
802 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); | 802 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); |
803 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); | 803 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); |
804 } | 804 } |
| 805 |
| 806 TEST(InitDataAtTheUpperLimit) { |
| 807 { |
| 808 Isolate* isolate = CcTest::InitIsolateOnce(); |
| 809 HandleScope scope(isolate); |
| 810 testing::SetupIsolateForWasmModule(isolate); |
| 811 |
| 812 ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit"); |
| 813 |
| 814 const byte data[] = { |
| 815 WASM_MODULE_HEADER, // -- |
| 816 kMemorySectionCode, // -- |
| 817 U32V_1(4), // section size |
| 818 ENTRY_COUNT(1), // -- |
| 819 kResizableMaximumFlag, // -- |
| 820 1, // initial size |
| 821 2, // maximum size |
| 822 kDataSectionCode, // -- |
| 823 U32V_1(9), // section size |
| 824 ENTRY_COUNT(1), // -- |
| 825 0, // linear memory index |
| 826 WASM_I32V_3(0xffff), // destination offset |
| 827 kExprEnd, |
| 828 U32V_1(1), // source size |
| 829 'c' // data bytes |
| 830 }; |
| 831 |
| 832 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, |
| 833 data + arraysize(data), |
| 834 ModuleOrigin::kWasmOrigin); |
| 835 if (thrower.error()) { |
| 836 thrower.Reify()->Print(); |
| 837 CHECK(false); |
| 838 } |
| 839 } |
| 840 Cleanup(); |
| 841 } |
OLD | NEW |