Turn on -Wmissing-field-initializers on Linux.

Because not initializing fields can be, you know, dangerous.

Review-Url: https://codereview.chromium.org/1952703002
Cr-Commit-Position: refs/heads/master@{#36071}
This commit is contained in:
jkummerow 2016-05-06 03:20:01 -07:00 committed by Commit bot
parent 1d941a4466
commit 148e7076ca
7 changed files with 168 additions and 89 deletions

View File

@ -710,8 +710,7 @@
'-Wno-long-long',
'-pthread',
'-pedantic',
# Don't warn about the "struct foo f = {0};" initialization pattern.
'-Wno-missing-field-initializers',
'-Wmissing-field-initializers',
'-Wno-gnu-zero-variadic-macro-arguments',
],
'cflags_cc': [

View File

@ -165,8 +165,19 @@ class ModuleDecoder : public Decoder {
uint32_t functions_count = consume_u32v(&length, "functions count");
module->functions.reserve(SafeReserve(functions_count));
for (uint32_t i = 0; i < functions_count; i++) {
module->functions.push_back(
{nullptr, i, 0, 0, 0, 0, 0, 0, false, false});
module->functions.push_back({nullptr, // sig
i, // func_index
0, // sig_index
0, // name_offset
0, // name_length
0, // code_start_offset
0, // code_end_offset
0, // local_i32_count
0, // local_i64_count
0, // local_f32_count
0, // local_f64_count
false, // exported
false}); // external
WasmFunction* function = &module->functions.back();
function->sig_index = consume_sig_index(module, &function->sig);
}
@ -213,8 +224,19 @@ class ModuleDecoder : public Decoder {
TRACE("DecodeFunction[%d] module+%d\n", i,
static_cast<int>(pc_ - start_));
module->functions.push_back(
{nullptr, i, 0, 0, 0, 0, 0, 0, false, false});
module->functions.push_back({nullptr, // sig
i, // func_index
0, // sig_index
0, // name_offset
0, // name_length
0, // code_start_offset
0, // code_end_offset
0, // local_i32_count
0, // local_i64_count
0, // local_f32_count
0, // local_f64_count
false, // exported
false}); // external
WasmFunction* function = &module->functions.back();
DecodeFunctionInModule(module, function, false);
}
@ -283,7 +305,10 @@ class ModuleDecoder : public Decoder {
if (failed()) break;
TRACE("DecodeDataSegment[%d] module+%d\n", i,
static_cast<int>(pc_ - start_));
module->data_segments.push_back({0, 0, 0});
module->data_segments.push_back({0, // dest_addr
0, // source_offset
0, // source_size
false}); // init
WasmDataSegment* segment = &module->data_segments.back();
DecodeDataSegmentInModule(module, segment);
}
@ -337,7 +362,12 @@ class ModuleDecoder : public Decoder {
TRACE("DecodeImportTable[%d] module+%d\n", i,
static_cast<int>(pc_ - start_));
module->import_table.push_back({nullptr, 0, 0});
module->import_table.push_back({nullptr, // sig
0, // sig_index
0, // module_name_offset
0, // module_name_length
0, // function_name_offset
0}); // function_name_length
WasmImport* import = &module->import_table.back();
import->sig_index = consume_sig_index(module, &import->sig);
@ -365,7 +395,9 @@ class ModuleDecoder : public Decoder {
TRACE("DecodeExportTable[%d] module+%d\n", i,
static_cast<int>(pc_ - start_));
module->export_table.push_back({0, 0});
module->export_table.push_back({0, // func_index
0, // name_offset
0}); // name_length
WasmExport* exp = &module->export_table.back();
WasmFunction* func;

View File

@ -106,13 +106,15 @@ TEST(RunNumberToInt32_float64) {
double input;
int32_t result;
SimplifiedLoweringTester<Object*> t;
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
MachineType::Float64()};
FieldAccess load = {kUntaggedBase, 0,
Handle<Name>(), Type::Number(),
MachineType::Float64(), kNoWriteBarrier};
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
NodeProperties::SetType(loaded, Type::Number());
Node* convert = t.NumberToInt32(loaded);
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Signed32(),
MachineType::Int32()};
FieldAccess store = {kUntaggedBase, 0,
Handle<Name>(), Type::Signed32(),
MachineType::Int32(), kNoWriteBarrier};
t.StoreField(store, t.PointerConstant(&result), convert);
t.Return(t.jsgraph.TrueConstant());
t.LowerAllNodesAndLowerChanges();
@ -133,13 +135,15 @@ TEST(RunNumberToUint32_float64) {
double input;
uint32_t result;
SimplifiedLoweringTester<Object*> t;
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
MachineType::Float64()};
FieldAccess load = {kUntaggedBase, 0,
Handle<Name>(), Type::Number(),
MachineType::Float64(), kNoWriteBarrier};
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
NodeProperties::SetType(loaded, Type::Number());
Node* convert = t.NumberToUint32(loaded);
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Unsigned32(),
MachineType::Uint32()};
FieldAccess store = {kUntaggedBase, 0,
Handle<Name>(), Type::Unsigned32(),
MachineType::Uint32(), kNoWriteBarrier};
t.StoreField(store, t.PointerConstant(&result), convert);
t.Return(t.jsgraph.TrueConstant());
t.LowerAllNodesAndLowerChanges();
@ -298,8 +302,12 @@ TEST(RunLoadFieldFromUntaggedBase) {
for (size_t i = 0; i < arraysize(smis); i++) {
int offset = static_cast<int>(i * sizeof(Smi*));
FieldAccess access = {kUntaggedBase, offset, Handle<Name>(),
Type::Integral32(), MachineType::AnyTagged()};
FieldAccess access = {kUntaggedBase,
offset,
Handle<Name>(),
Type::Integral32(),
MachineType::AnyTagged(),
kNoWriteBarrier};
SimplifiedLoweringTester<Object*> t;
Node* load = t.LoadField(access, t.PointerConstant(smis));
@ -320,8 +328,12 @@ TEST(RunStoreFieldToUntaggedBase) {
for (size_t i = 0; i < arraysize(smis); i++) {
int offset = static_cast<int>(i * sizeof(Smi*));
FieldAccess access = {kUntaggedBase, offset, Handle<Name>(),
Type::Integral32(), MachineType::AnyTagged()};
FieldAccess access = {kUntaggedBase,
offset,
Handle<Name>(),
Type::Integral32(),
MachineType::AnyTagged(),
kNoWriteBarrier};
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
Node* p0 = t.Parameter(0);
@ -347,7 +359,7 @@ TEST(RunLoadElementFromUntaggedBase) {
for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index
int offset = static_cast<int>(i * sizeof(Smi*));
ElementAccess access = {kUntaggedBase, offset, Type::Integral32(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kNoWriteBarrier};
SimplifiedLoweringTester<Object*> t;
Node* load = t.LoadElement(access, t.PointerConstant(smis),
@ -373,7 +385,7 @@ TEST(RunStoreElementFromUntaggedBase) {
for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index
int offset = static_cast<int>(i * sizeof(Smi*));
ElementAccess access = {kUntaggedBase, offset, Type::Integral32(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kNoWriteBarrier};
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
Node* p0 = t.Parameter(0);
@ -525,7 +537,7 @@ class AccessTester : public HandleAndZoneScope {
ElementAccess GetElementAccess() {
ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase,
tagged ? FixedArrayBase::kHeaderSize : 0,
Type::Any(), rep};
Type::Any(), rep, kFullWriteBarrier};
return access;
}
@ -533,7 +545,10 @@ class AccessTester : public HandleAndZoneScope {
int offset = field * sizeof(E);
FieldAccess access = {tagged ? kTaggedBase : kUntaggedBase,
offset + (tagged ? FixedArrayBase::kHeaderSize : 0),
Handle<Name>(), Type::Any(), rep};
Handle<Name>(),
Type::Any(),
rep,
kFullWriteBarrier};
return access;
}
@ -1312,8 +1327,9 @@ const MachineType kMachineReps[] = {
TEST(LowerLoadField_to_load) {
for (size_t i = 0; i < arraysize(kMachineReps); i++) {
TestingGraph t(Type::Any(), Type::Signed32());
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(), kMachineReps[i]};
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
kMachineReps[i], kNoWriteBarrier};
Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0,
t.start, t.start);
@ -1335,9 +1351,9 @@ TEST(LowerStoreField_to_store) {
TestingGraph t(Type::Any(), Type::Signed32());
for (size_t i = 0; i < arraysize(kMachineReps); i++) {
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(), kMachineReps[i]};
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
kMachineReps[i], kNoWriteBarrier};
Node* val = t.ExampleWithOutput(kMachineReps[i]);
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
@ -1360,9 +1376,9 @@ TEST(LowerStoreField_to_store) {
Zone* z = scope.main_zone();
TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(),
Type::TaggedSigned(), z));
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
MachineType::AnyTagged()};
FieldAccess access = {
kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
Type::Any(), MachineType::AnyTagged(), kNoWriteBarrier};
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
t.p1, t.start, t.start);
t.Effect(store);
@ -1379,7 +1395,7 @@ TEST(LowerLoadElement_to_load) {
for (size_t i = 0; i < arraysize(kMachineReps); i++) {
TestingGraph t(Type::Any(), Type::Signed32());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Type::Any(), kMachineReps[i]};
Type::Any(), kMachineReps[i], kNoWriteBarrier};
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0,
t.p1, t.start, t.start);
@ -1402,7 +1418,7 @@ TEST(LowerStoreElement_to_store) {
TestingGraph t(Type::Any(), Type::Signed32());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Type::Any(), kMachineReps[i]};
Type::Any(), kMachineReps[i], kNoWriteBarrier};
Node* val = t.ExampleWithOutput(kMachineReps[i]);
Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access),
@ -1427,7 +1443,8 @@ TEST(LowerStoreElement_to_store) {
Type::Any(), Type::Signed32(),
Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z));
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Type::Any(), MachineType::AnyTagged()};
Type::Any(), MachineType::AnyTagged(),
kNoWriteBarrier};
Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0,
t.p1, t.p2, t.start, t.start);
t.Effect(store);
@ -1445,7 +1462,7 @@ TEST(InsertChangeForLoadElementIndex) {
// Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k))
TestingGraph t(Type::Any(), Type::Signed32());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kNoWriteBarrier};
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0,
t.p1, t.start, t.start);
@ -1462,7 +1479,7 @@ TEST(InsertChangeForStoreElementIndex) {
// Store(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k), val)
TestingGraph t(Type::Any(), Type::Signed32());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kFullWriteBarrier};
Node* store =
t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, t.p1,
@ -1479,7 +1496,7 @@ TEST(InsertChangeForLoadElement) {
// TODO(titzer): test all load/store representation change insertions.
TestingGraph t(Type::Any(), Type::Signed32(), Type::Any());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
MachineType::Float64()};
MachineType::Float64(), kNoWriteBarrier};
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0,
t.p1, t.start, t.start);
@ -1494,9 +1511,9 @@ TEST(InsertChangeForLoadElement) {
TEST(InsertChangeForLoadField) {
// TODO(titzer): test all load/store representation change insertions.
TestingGraph t(Type::Any(), Type::Signed32());
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
MachineType::Float64()};
FieldAccess access = {
kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
Type::Any(), MachineType::Float64(), kNoWriteBarrier};
Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0,
t.start, t.start);
@ -1512,7 +1529,7 @@ TEST(InsertChangeForStoreElement) {
// TODO(titzer): test all load/store representation change insertions.
TestingGraph t(Type::Any(), Type::Signed32());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
MachineType::Float64()};
MachineType::Float64(), kFullWriteBarrier};
Node* store =
t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0,
@ -1529,9 +1546,9 @@ TEST(InsertChangeForStoreElement) {
TEST(InsertChangeForStoreField) {
// TODO(titzer): test all load/store representation change insertions.
TestingGraph t(Type::Any(), Type::Signed32());
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
MachineType::Float64()};
FieldAccess access = {
kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
Type::Any(), MachineType::Float64(), kNoWriteBarrier};
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
t.p1, t.start, t.start);
@ -1551,8 +1568,9 @@ TEST(UpdatePhi) {
Type* kTypes[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()};
for (size_t i = 0; i < arraysize(kMachineTypes); i++) {
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), kTypes[i], kMachineTypes[i]};
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), kTypes[i],
kMachineTypes[i], kFullWriteBarrier};
Node* load0 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0,
t.start, t.start);

View File

@ -107,9 +107,9 @@ class ChangeLoweringCommonTest
};
TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) {
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
MachineType::AnyTagged()};
FieldAccess access = {
kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
Type::Any(), MachineType::AnyTagged(), kNoWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* p1 = Parameter(Type::TaggedSigned());
Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
@ -126,9 +126,9 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) {
TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldTagged) {
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
MachineType::AnyTagged()};
FieldAccess access = {
kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
Type::Any(), MachineType::AnyTagged(), kFullWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* p1 = Parameter(Type::Tagged());
Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
@ -145,9 +145,9 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldTagged) {
TARGET_TEST_P(ChangeLoweringCommonTest, LoadField) {
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(),
MachineType::AnyTagged()};
FieldAccess access = {
kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(),
Type::Any(), MachineType::AnyTagged(), kNoWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* load = graph()->NewNode(simplified()->LoadField(access), p0,
graph()->start(), graph()->start());
@ -164,7 +164,7 @@ TARGET_TEST_P(ChangeLoweringCommonTest, LoadField) {
TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementTagged) {
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kFullWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* p1 = Parameter(Type::Signed32());
Node* p2 = Parameter(Type::Tagged());
@ -191,7 +191,8 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementTagged) {
TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementUint8) {
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Type::Signed32(), MachineType::Uint8()};
Type::Signed32(), MachineType::Uint8(),
kNoWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* p1 = Parameter(Type::Signed32());
Node* p2 = Parameter(Type::Signed32());
@ -215,7 +216,7 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementUint8) {
TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementTagged) {
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kNoWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* p1 = Parameter(Type::Signed32());
Node* load = graph()->NewNode(simplified()->LoadElement(access), p0, p1,
@ -239,7 +240,8 @@ TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementTagged) {
TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementInt8) {
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Type::Signed32(), MachineType::Int8()};
Type::Signed32(), MachineType::Int8(),
kNoWriteBarrier};
Node* p0 = Parameter(Type::TaggedPointer());
Node* p1 = Parameter(Type::Signed32());
Node* load = graph()->NewNode(simplified()->LoadElement(access), p0, p1,

View File

@ -146,14 +146,18 @@ class EscapeAnalysisTest : public GraphTest {
}
FieldAccess FieldAccessAtIndex(int offset) {
FieldAccess access = {kTaggedBase, offset, MaybeHandle<Name>(), Type::Any(),
MachineType::AnyTagged()};
FieldAccess access = {kTaggedBase,
offset,
MaybeHandle<Name>(),
Type::Any(),
MachineType::AnyTagged(),
kFullWriteBarrier};
return access;
}
ElementAccess MakeElementAccess(int header_size) {
ElementAccess access = {kTaggedBase, header_size, Type::Any(),
MachineType::AnyTagged()};
MachineType::AnyTagged(), kFullWriteBarrier};
return access;
}

View File

@ -203,39 +203,46 @@ namespace {
const ElementAccess kElementAccesses[] = {
{kTaggedBase, FixedArray::kHeaderSize, Type::Any(),
MachineType::AnyTagged()},
{kUntaggedBase, 0, Type::Any(), MachineType::Int8()},
{kUntaggedBase, 0, Type::Any(), MachineType::Int16()},
{kUntaggedBase, 0, Type::Any(), MachineType::Int32()},
{kUntaggedBase, 0, Type::Any(), MachineType::Uint8()},
{kUntaggedBase, 0, Type::Any(), MachineType::Uint16()},
{kUntaggedBase, 0, Type::Any(), MachineType::Uint32()},
{kUntaggedBase, 0, Type::Signed32(), MachineType::Int8()},
{kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint8()},
{kUntaggedBase, 0, Type::Signed32(), MachineType::Int16()},
{kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint16()},
{kUntaggedBase, 0, Type::Signed32(), MachineType::Int32()},
{kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint32()},
MachineType::AnyTagged(), kFullWriteBarrier},
{kUntaggedBase, 0, Type::Any(), MachineType::Int8(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Any(), MachineType::Int16(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Any(), MachineType::Int32(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Any(), MachineType::Uint8(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Any(), MachineType::Uint16(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Any(), MachineType::Uint32(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Signed32(), MachineType::Int8(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint8(),
kNoWriteBarrier},
{kUntaggedBase, 0, Type::Signed32(), MachineType::Int16(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint16(),
kNoWriteBarrier},
{kUntaggedBase, 0, Type::Signed32(), MachineType::Int32(), kNoWriteBarrier},
{kUntaggedBase, 0, Type::Unsigned32(), MachineType::Uint32(),
kNoWriteBarrier},
{kUntaggedBase, 0, Type::Number(),
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone)},
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone),
kNoWriteBarrier},
{kUntaggedBase, 0, Type::Number(),
MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone)},
MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone),
kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(),
MachineType::Int8()},
MachineType::Int8(), kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(),
MachineType::Uint8()},
MachineType::Uint8(), kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(),
MachineType::Int16()},
MachineType::Int16(), kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(),
MachineType::Uint16()},
MachineType::Uint16(), kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Signed32(),
MachineType::Int32()},
MachineType::Int32(), kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Unsigned32(),
MachineType::Uint32()},
MachineType::Uint32(), kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(),
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone)},
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone),
kNoWriteBarrier},
{kTaggedBase, FixedTypedArrayBase::kDataOffset, Type::Number(),
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone)}};
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone),
kNoWriteBarrier}};
} // namespace

View File

@ -1140,12 +1140,29 @@ class TestModuleEnv : public ModuleEnv {
return static_cast<byte>(mod.signatures.size() - 1);
}
byte AddFunction(FunctionSig* sig) {
mod.functions.push_back({sig, 0, 0, 0, 0, 0, 0, 0, false, false});
mod.functions.push_back({sig, // sig
0, // func_index
0, // sig_index
0, // name_offset
0, // name_length
0, // code_start_offset
0, // code_end_offset
0, // local_i32_count
0, // local_i64_count
0, // local_f32_count
0, // local_f64_count
false, // exported
false}); // external
CHECK(mod.functions.size() <= 127);
return static_cast<byte>(mod.functions.size() - 1);
}
byte AddImport(FunctionSig* sig) {
mod.import_table.push_back({sig, 0, 0});
mod.import_table.push_back({sig, // sig
0, // sig_index
0, // module_name_offset
0, // module_name_length
0, // function_name_offset
0}); // function_name_length
CHECK(mod.import_table.size() <= 127);
return static_cast<byte>(mod.import_table.size() - 1);
}