Commit d53fd7b0 authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Simplify CheckUnorderedSection by splitting and inlining

R=ahaas@chromium.org

Change-Id: Ib6c69345f6c00580ba444ec885c46057dc8a3d48
Reviewed-on: https://chromium-review.googlesource.com/c/1408992Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58777}
parent bd502b2b
......@@ -353,17 +353,7 @@ class ModuleDecoderImpl : public Decoder {
return false;
}
set_seen_unordered_section(section_code);
switch (section_code) {
case kDataCountSectionCode:
return CheckSectionOrder(section_code, kElementSectionCode,
kCodeSectionCode);
case kExceptionSectionCode:
return CheckSectionOrder(section_code, kGlobalSectionCode,
kExportSectionCode);
default:
UNREACHABLE();
}
return true;
}
void DecodeSection(SectionCode section_code, Vector<const uint8_t> bytes,
......@@ -385,11 +375,16 @@ class ModuleDecoderImpl : public Decoder {
case kUnknownSectionCode:
break;
case kDataCountSectionCode:
if (!CheckUnorderedSection(section_code)) return;
if (!CheckSectionOrder(section_code, kElementSectionCode,
kCodeSectionCode))
return;
break;
case kExceptionSectionCode:
// Note: These sections have a section code that is numerically
// out-of-order with respect to their required location. So they are
// treated as a special case.
if (!CheckUnorderedSection(section_code)) return;
if (!CheckSectionOrder(section_code, kGlobalSectionCode,
kExportSectionCode))
return;
break;
case kSourceMappingURLSectionCode:
// sourceMappingURL is a custom section and currently can occur anywhere
......
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