Commit 81efb932 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][bulk-memory] Adjust elem and data segment to recent spec changes

R=binji@chromium.org

Change-Id: I8eeff7dbc92749c4b9ea6bedd9123b9e6635ab5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1709048
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarBen Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62906}
parent 0ed85c1d
......@@ -656,6 +656,7 @@ void InstanceBuilder::LoadDataSegments(Handle<WasmInstanceObject> instance) {
uint32_t size = segment.source.length();
if (enabled_.bulk_memory) {
if (size == 0) continue;
// Passive segments are not copied during instantiation.
if (!segment.active) continue;
......@@ -1629,6 +1630,7 @@ bool LoadElemSegmentImpl(Isolate* isolate, Handle<WasmInstanceObject> instance,
uint32_t table_index,
const WasmElemSegment& elem_segment, uint32_t dst,
uint32_t src, size_t count) {
if (count == 0) return true;
// TODO(wasm): Move this functionality into wasm-objects, since it is used
// for both instantiation and in the implementation of the table.init
// instruction.
......@@ -1701,6 +1703,7 @@ void InstanceBuilder::LoadTableSegments(Handle<WasmInstanceObject> instance) {
uint32_t dst = EvalUint32InitExpr(instance, elem_segment.offset);
uint32_t src = 0;
size_t count = elem_segment.entries.size();
if (enabled_.bulk_memory && count == 0) continue;
bool success = LoadElemSegmentImpl(
isolate_, instance,
......
......@@ -910,6 +910,8 @@ TEST(EmptyMemoryEmptyDataSegment) {
TEST(MemoryWithOOBEmptyDataSegment) {
{
FlagScope<bool> no_bulk_memory(
&v8::internal::FLAG_experimental_wasm_bulk_memory, false);
Isolate* isolate = CcTest::InitIsolateOnce();
HandleScope scope(isolate);
testing::SetupIsolateForWasmModule(isolate);
......
......@@ -10,14 +10,11 @@
# the bulk-memory proposal. Since we've enabled bulk-memory by default, we
# need to update to use its testsuite.
'tests/linking': [FAIL],
'tests/elem': [FAIL],
'tests/data': [FAIL],
# TODO(ahaas): Needs investigation, I disable the test for now.
'tests/conversions': [PASS, ['system == windows and arch == ia32', FAIL]],
# TODO(ahaas): Incorporate recent changes to the bulk-memory-operations
# proposal.
'tests/proposals/bulk-memory-operations/elem': [FAIL],
'tests/proposals/bulk-memory-operations/data': [FAIL],
}], # ALWAYS
['arch == mipsel or arch == mips64el or arch == mips or arch == mips64', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment