Commit 78dfed35 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][cleanup] Rename kResizableMaximumFlag kHasMaximumFlag

This flag describes that the memory defined in a wasm module has a
maximum size. Therefore I think kHasMaximumFlag is more appropriate.

R=titzer@chromium.org

Bug: v8:6921
Change-Id: Ie794d670f74e7f1f9a42822e2f774da85aaaaa4b
Reviewed-on: https://chromium-review.googlesource.com/718198Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48517}
parent 9ac716d7
......@@ -21,7 +21,7 @@ namespace wasm {
const uint8_t kWasmFunctionTypeForm = 0x60;
const uint8_t kWasmAnyFunctionTypeForm = 0x70;
const uint8_t kResizableMaximumFlag = 1;
const uint8_t kHasMaximumFlag = 1;
const uint8_t kNoMaximumFlag = 0;
enum MemoryFlags : uint8_t {
......
......@@ -389,7 +389,7 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer& buffer) const {
size_t start = EmitSection(kTableSectionCode, buffer);
buffer.write_u8(1); // table count
buffer.write_u8(kWasmAnyFunctionTypeForm);
buffer.write_u8(kResizableMaximumFlag);
buffer.write_u8(kHasMaximumFlag);
buffer.write_size(indirect_functions_.size());
buffer.write_size(indirect_functions_.size());
FixupSection(buffer, start);
......
......@@ -930,18 +930,18 @@ TEST(InitDataAtTheUpperLimit) {
ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit");
const byte data[] = {
WASM_MODULE_HEADER, // --
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kResizableMaximumFlag, // --
1, // initial size
2, // maximum size
kDataSectionCode, // --
U32V_1(9), // section size
ENTRY_COUNT(1), // --
0, // linear memory index
WASM_I32V_3(0xffff), // destination offset
WASM_MODULE_HEADER, // --
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kHasMaximumFlag, // --
1, // initial size
2, // maximum size
kDataSectionCode, // --
U32V_1(9), // section size
ENTRY_COUNT(1), // --
0, // linear memory index
WASM_I32V_3(0xffff), // destination offset
kExprEnd,
U32V_1(1), // source size
'c' // data bytes
......@@ -967,18 +967,18 @@ TEST(EmptyMemoryNonEmptyDataSegment) {
ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit");
const byte data[] = {
WASM_MODULE_HEADER, // --
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kResizableMaximumFlag, // --
0, // initial size
0, // maximum size
kDataSectionCode, // --
U32V_1(7), // section size
ENTRY_COUNT(1), // --
0, // linear memory index
WASM_I32V_1(8), // destination offset
WASM_MODULE_HEADER, // --
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kHasMaximumFlag, // --
0, // initial size
0, // maximum size
kDataSectionCode, // --
U32V_1(7), // section size
ENTRY_COUNT(1), // --
0, // linear memory index
WASM_I32V_1(8), // destination offset
kExprEnd,
U32V_1(1), // source size
'c' // data bytes
......@@ -1002,18 +1002,18 @@ TEST(EmptyMemoryEmptyDataSegment) {
ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit");
const byte data[] = {
WASM_MODULE_HEADER, // --
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kResizableMaximumFlag, // --
0, // initial size
0, // maximum size
kDataSectionCode, // --
U32V_1(6), // section size
ENTRY_COUNT(1), // --
0, // linear memory index
WASM_I32V_1(0), // destination offset
WASM_MODULE_HEADER, // --
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kHasMaximumFlag, // --
0, // initial size
0, // maximum size
kDataSectionCode, // --
U32V_1(6), // section size
ENTRY_COUNT(1), // --
0, // linear memory index
WASM_I32V_1(0), // destination offset
kExprEnd,
U32V_1(0), // source size
};
......@@ -1040,7 +1040,7 @@ TEST(MemoryWithOOBEmptyDataSegment) {
kMemorySectionCode, // --
U32V_1(4), // section size
ENTRY_COUNT(1), // --
kResizableMaximumFlag, // --
kHasMaximumFlag, // --
1, // initial size
1, // maximum size
kDataSectionCode, // --
......
......@@ -78,7 +78,7 @@ let kLocalNamesCode = 2;
let kWasmFunctionTypeForm = 0x60;
let kWasmAnyFunctionTypeForm = 0x70;
let kResizableMaximumFlag = 1;
let kHasMaximumFlag = 1;
// Function declaration flags
let kDeclFunctionName = 0x01;
......
......@@ -494,7 +494,7 @@ TEST_F(WasmModuleVerifyTest, DataSegmentWithImmutableImportedGlobal) {
0, // mutability
SECTION(Memory, 4),
ENTRY_COUNT(1),
kResizableMaximumFlag,
kHasMaximumFlag,
28,
28,
SECTION(Data, 9),
......@@ -527,7 +527,7 @@ TEST_F(WasmModuleVerifyTest, DataSegmentWithMutableImportedGlobal) {
1, // mutability
SECTION(Memory, 4),
ENTRY_COUNT(1),
kResizableMaximumFlag,
kHasMaximumFlag,
28,
28,
SECTION(Data, 9),
......@@ -546,7 +546,7 @@ TEST_F(WasmModuleVerifyTest, DataSegmentWithImmutableGlobal) {
const byte data[] = {
SECTION(Memory, 4),
ENTRY_COUNT(1),
kResizableMaximumFlag,
kHasMaximumFlag,
28,
28,
SECTION(Global, 8), // --
......@@ -571,7 +571,7 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) {
const byte data[] = {
SECTION(Memory, 4),
ENTRY_COUNT(1),
kResizableMaximumFlag,
kHasMaximumFlag,
28,
28,
SECTION(Data, 11),
......@@ -610,7 +610,7 @@ TEST_F(WasmModuleVerifyTest, TwoDataSegments) {
const byte data[] = {
SECTION(Memory, 4),
ENTRY_COUNT(1),
kResizableMaximumFlag,
kHasMaximumFlag,
28,
28,
SECTION(Data, 29),
......@@ -678,15 +678,13 @@ TEST_F(WasmModuleVerifyTest, DataWithoutMemory) {
TEST_F(WasmModuleVerifyTest, MaxMaximumMemorySize) {
{
const byte data[] = {
SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0,
U32V_3(65536),
SECTION(Memory, 6), ENTRY_COUNT(1), kHasMaximumFlag, 0, U32V_3(65536),
};
EXPECT_VERIFIES(data);
}
{
const byte data[] = {
SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0,
U32V_3(65537),
SECTION(Memory, 6), ENTRY_COUNT(1), kHasMaximumFlag, 0, U32V_3(65537),
};
EXPECT_FAILURE(data);
}
......@@ -696,7 +694,7 @@ TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) {
const byte data[] = {
SECTION(Memory, 4),
ENTRY_COUNT(1),
kResizableMaximumFlag,
kHasMaximumFlag,
28,
28,
SECTION(Data, 11),
......@@ -715,7 +713,7 @@ TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) {
TEST_F(WasmModuleVerifyTest, DataSegmentEndOverflow) {
const byte data[] = {
SECTION(Memory, 4), // memory section
ENTRY_COUNT(1), kResizableMaximumFlag, 28, 28,
ENTRY_COUNT(1), kHasMaximumFlag, 28, 28,
SECTION(Data, 10), // data section
ENTRY_COUNT(1), // one entry
LINEAR_MEMORY_INDEX_0, // mem index
......
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