[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: Ben Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62906}
This commit is contained in:
Andreas Haas 2019-07-18 18:20:21 +02:00 committed by Commit Bot
parent 0ed85c1d3e
commit 81efb932b5
3 changed files with 7 additions and 5 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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', {