зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1308056: wasm: remove default memory/table option and simplify flags; r=luke
MozReview-Commit-ID: IH6rtY4mrkA --HG-- extra : rebase_source : 0c6e2e31a4556bfcf0a6516ab2ebae253e695f14
This commit is contained in:
Родитель
50d9c231a4
Коммит
2bccffb569
|
@ -148,17 +148,15 @@ wasm::DecodeLimits(Decoder& d, Limits* limits)
|
|||
if (!d.readVarU32(&flags))
|
||||
return d.fail("expected flags");
|
||||
|
||||
if (flags & ~uint32_t(ResizableFlags::AllowedMask))
|
||||
return d.fail("unexpected bits set in flags: %lu",
|
||||
(flags & ~uint32_t(ResizableFlags::AllowedMask)));
|
||||
|
||||
if (!(flags & uint32_t(ResizableFlags::Default)))
|
||||
return d.fail("currently, every memory/table must be declared default");
|
||||
// TODO (bug 1310149): tighten this check (s/3/1) when the AngryBots demo
|
||||
// gets updated.
|
||||
if (flags & ~uint32_t(0x3))
|
||||
return d.fail("unexpected bits set in flags: %lu", (flags & ~uint32_t(0x3)));
|
||||
|
||||
if (!d.readVarU32(&limits->initial))
|
||||
return d.fail("expected initial length");
|
||||
|
||||
if (flags & uint32_t(ResizableFlags::HasMaximum)) {
|
||||
if (flags & 0x1) {
|
||||
uint32_t maximum;
|
||||
if (!d.readVarU32(&maximum))
|
||||
return d.fail("expected maximum length");
|
||||
|
|
|
@ -123,13 +123,6 @@ enum class DefinitionKind
|
|||
Global = 0x03
|
||||
};
|
||||
|
||||
enum class ResizableFlags
|
||||
{
|
||||
Default = 0x1,
|
||||
HasMaximum = 0x2,
|
||||
AllowedMask = 0x3
|
||||
};
|
||||
|
||||
enum class GlobalFlags
|
||||
{
|
||||
IsMutable = 0x1,
|
||||
|
|
|
@ -4288,10 +4288,7 @@ EncodeBytes(Encoder& e, AstName wasmName)
|
|||
static bool
|
||||
EncodeLimits(Encoder& e, const Limits& limits)
|
||||
{
|
||||
uint32_t flags = uint32_t(ResizableFlags::Default);
|
||||
if (limits.maximum)
|
||||
flags |= uint32_t(ResizableFlags::HasMaximum);
|
||||
|
||||
uint32_t flags = limits.maximum ? 1 : 0;
|
||||
if (!e.writeVarU32(flags))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -92,6 +92,5 @@ const MemoryCode = 0x02;
|
|||
const GlobalCode = 0x03;
|
||||
|
||||
// ResizableFlags
|
||||
const DefaultFlag = 0x1;
|
||||
const HasMaximumFlag = 0x2;
|
||||
const HasMaximumFlag = 0x1;
|
||||
|
||||
|
|
|
@ -190,18 +190,16 @@ function tableSection(initialSize) {
|
|||
var body = [];
|
||||
body.push(...varU32(1)); // number of tables
|
||||
body.push(...varU32(AnyFuncCode));
|
||||
body.push(...varU32(DefaultFlag)); // for now, no maximum
|
||||
body.push(...varU32(0x0)); // for now, no maximum
|
||||
body.push(...varU32(initialSize));
|
||||
// for now, no maximum
|
||||
return { name: tableId, body };
|
||||
}
|
||||
|
||||
function memorySection(initialSize) {
|
||||
var body = [];
|
||||
body.push(...varU32(1)); // number of memories
|
||||
body.push(...varU32(DefaultFlag)); // for now, no maximum
|
||||
body.push(...varU32(0x0)); // for now, no maximum
|
||||
body.push(...varU32(initialSize));
|
||||
// for now, no maximum
|
||||
return { name: memoryId, body };
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче