diff options
Diffstat (limited to 'deps/v8/test/cctest/wasm/test-streaming-compilation.cc')
-rw-r--r-- | deps/v8/test/cctest/wasm/test-streaming-compilation.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc index 08c0c1dd46..4d3f83daff 100644 --- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc +++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc @@ -1215,6 +1215,39 @@ STREAM_TEST(TestCompileErrorFunctionName) { } } +STREAM_TEST(TestSetModuleCodeSection) { + StreamTester tester; + + uint8_t code[] = { + U32V_1(1), // functions count + U32V_1(4), // body size + U32V_1(0), // locals count + kExprLocalGet, 0, kExprEnd // body + }; + + const uint8_t bytes[] = { + WASM_MODULE_HEADER, // module header + kTypeSectionCode, // section code + U32V_1(1 + SIZEOF_SIG_ENTRY_x_x), // section size + U32V_1(1), // type count + SIG_ENTRY_x_x(kLocalI32, kLocalI32), // signature entry + kFunctionSectionCode, // section code + U32V_1(1 + 1), // section size + U32V_1(1), // functions count + 0, // signature index + kCodeSectionCode, // section code + U32V_1(arraysize(code)), // section size + }; + + tester.OnBytesReceived(bytes, arraysize(bytes)); + tester.OnBytesReceived(code, arraysize(code)); + tester.FinishStream(); + tester.RunCompilerTasks(); + CHECK_EQ(tester.native_module()->module()->code.offset(), arraysize(bytes)); + CHECK_EQ(tester.native_module()->module()->code.length(), arraysize(code)); + CHECK(tester.IsPromiseFulfilled()); +} + #undef STREAM_TEST } // namespace wasm |