V(MachUint32) \
V(MachInt64) \
V(MachUint64) \
- V(MachAnyTagged) \
- V(RepBit) \
- V(RepWord8) \
- V(RepWord16) \
- V(RepWord32) \
- V(RepWord64) \
- V(RepFloat32) \
- V(RepFloat64) \
- V(RepTagged)
+ V(MachPtr) \
+ V(MachAnyTagged)
struct MachineOperatorGlobalCache {
MachineOperatorBuilder::MachineOperatorBuilder(Zone* zone, MachineType word,
Flags flags)
- : zone_(zone), cache_(kCache.Get()), word_(word), flags_(flags) {
+ : cache_(kCache.Get()), word_(word), flags_(flags) {
DCHECK(word == kRepWord32 || word == kRepWord64);
}
default:
break;
}
- // Uncached.
- return new (zone_) Operator1<LoadRepresentation>( // --
- IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, "Load", 2, 1, 1,
- 1, 1, 0, rep);
+ UNREACHABLE();
+ return nullptr;
}
default:
break;
}
- // Uncached.
- return new (zone_) Operator1<StoreRepresentation>( // --
- IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, "Store", 3, 1,
- 1, 0, 1, 0, rep);
+ UNREACHABLE();
+ return nullptr;
}
default:
break;
}
- // Uncached.
- return new (zone_) Operator1<CheckedLoadRepresentation>(
- IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite,
- "CheckedLoad", 3, 1, 1, 1, 1, 0, rep);
+ UNREACHABLE();
+ return nullptr;
}
default:
break;
}
- // Uncached.
- return new (zone_) Operator1<CheckedStoreRepresentation>(
- IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow,
- "CheckedStore", 4, 1, 1, 0, 1, 0, rep);
+ UNREACHABLE();
+ return nullptr;
}
} // namespace compiler
#undef PSEUDO_OP_LIST
private:
- Zone* const zone_;
MachineOperatorGlobalCache const& cache_;
MachineType const word_;
Flags const flags_;
}
}
- Node* ExampleWithTypeAndRep(Type* type, MachineType mach_type) {
- FieldAccess access = {kUntaggedBase, 0, Handle<Name>::null(), type,
- mach_type};
- // TODO(titzer): using loads here just to force the representation is ugly.
- Node* node = graph()->NewNode(simplified()->LoadField(access),
- jsgraph.IntPtrConstant(0), graph()->start(),
- graph()->start());
- NodeProperties::SetBounds(node, Bounds(type));
- return node;
- }
-
Node* Use(Node* node, MachineType type) {
if (type & kTypeInt32) {
return graph()->NewNode(machine()->Int32LessThan(), node,
TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32) {
// NumberToInt32(x: kRepFloat64) used as kMachInt32
TestingGraph t(Type::Number());
- Node* p0 = t.ExampleWithTypeAndRep(Type::Number(), kMachFloat64);
+ Node* p0 = t.ExampleWithOutput(kMachFloat64);
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), p0);
Node* use = t.Use(trunc, kMachInt32);
t.Return(use);
TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_uint32) {
// NumberToUint32(x: kRepFloat64) used as kRepWord32
TestingGraph t(Type::Unsigned32());
- Node* input = t.ExampleWithTypeAndRep(Type::Number(), kMachFloat64);
+ Node* input = t.ExampleWithOutput(kMachFloat64);
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), input);
Node* use = t.Use(trunc, kRepWord32);
t.Return(use);
}
-TEST(LowerNumberToUI32_of_Float64_used_as_word32) {
- // NumberTo(Int,Uint)32(x: kRepFloat64 | kType(Int,Uint)32) used as
- // kType(Int,Uint)32 | kRepWord32
- Type* types[] = {Type::Signed32(), Type::Unsigned32()};
- MachineType mach[] = {kTypeInt32, kTypeUint32, kMachNone};
-
- for (int i = 0; i < 2; i++) {
- for (int u = 0; u < 3; u++) {
- TestingGraph t(types[i]);
- Node* input = t.ExampleWithTypeAndRep(
- types[i], static_cast<MachineType>(kRepFloat64 | mach[i]));
- const Operator* op = i == 0 ? t.simplified()->NumberToInt32()
- : t.simplified()->NumberToUint32();
- Node* trunc = t.graph()->NewNode(op, input);
- Node* use = t.Use(trunc, static_cast<MachineType>(kRepWord32 | mach[u]));
- t.Return(use);
- t.Lower();
- IrOpcode::Value opcode = i == 0 ? IrOpcode::kChangeFloat64ToInt32
- : IrOpcode::kChangeFloat64ToUint32;
- CheckChangeOf(opcode, input, use->InputAt(0));
- }
- }
-}
-
-
-TEST(LowerNumberToUI32_of_Float64_used_as_tagged) {
- // NumberTo(Int,Uint)32(x: kRepFloat64 | kType(Int,Uint)32) used as
- // kType(Int,Uint)32 | kRepTagged
- Type* types[] = {Type::Signed32(), Type::Unsigned32(), Type::Any()};
- MachineType mach[] = {kTypeInt32, kTypeUint32, kMachNone};
-
- for (int i = 0; i < 2; i++) {
- for (int u = 0; u < 3; u++) {
- TestingGraph t(types[i]);
- Node* input = t.ExampleWithTypeAndRep(
- types[i], static_cast<MachineType>(kRepFloat64 | mach[i]));
- const Operator* op = i == 0 ? t.simplified()->NumberToInt32()
- : t.simplified()->NumberToUint32();
- Node* trunc = t.graph()->NewNode(op, input);
- // TODO(titzer): we use the store here to force the representation.
- FieldAccess access = {kTaggedBase, 0, Handle<Name>(), types[u],
- static_cast<MachineType>(mach[u] | kRepTagged)};
- Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
- trunc, t.start, t.start);
- t.Effect(store);
- t.Lower();
- CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, input, store->InputAt(2));
- }
- }
-}
-
-
TEST(LowerReferenceEqual_to_wordeq) {
TestingGraph t(Type::Any(), Type::Any());
IrOpcode::Value opcode =
}
-const MachineType kMachineReps[] = {kRepBit, kMachInt8, kMachInt16,
- kMachInt32, kMachInt64, kMachFloat64,
+const MachineType kMachineReps[] = {kMachInt8, kMachInt16, kMachInt32,
+ kMachUint32, kMachInt64, kMachFloat64,
kMachAnyTagged};
} // namespace
TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
- const StoreRepresentation rep(kRepWord8, kNoWriteBarrier);
+ const StoreRepresentation rep(kMachUint8, kNoWriteBarrier);
Node* const base = Parameter(0);
Node* const index = Parameter(1);
Node* const value = Parameter(2);
TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) {
- const StoreRepresentation rep(kRepWord8, kNoWriteBarrier);
+ const StoreRepresentation rep(kMachUint8, kNoWriteBarrier);
Node* const base = Parameter(0);
Node* const index = Parameter(1);
Node* const value = Parameter(2);
TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) {
- const StoreRepresentation rep(kRepWord16, kNoWriteBarrier);
+ const StoreRepresentation rep(kMachUint16, kNoWriteBarrier);
Node* const base = Parameter(0);
Node* const index = Parameter(1);
Node* const value = Parameter(2);
TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) {
- const StoreRepresentation rep(kRepWord16, kNoWriteBarrier);
+ const StoreRepresentation rep(kMachUint16, kNoWriteBarrier);
Node* const base = Parameter(0);
Node* const index = Parameter(1);
Node* const value = Parameter(2);
const MachineType kMachineReps[] = {kRepWord32, kRepWord64};
-const MachineType kMachineTypes[] = {
- kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16,
- kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64,
- kMachPtr, kMachAnyTagged, kRepBit, kRepWord8, kRepWord16,
- kRepWord32, kRepWord64, kRepFloat32, kRepFloat64, kRepTagged};
+const MachineType kMachineTypesForAccess[] = {
+ kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16,
+ kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64,
+ kMachPtr, kMachAnyTagged, kMachPtr};
} // namespace
}
-INSTANTIATE_TEST_CASE_P(MachineOperatorTest, MachineLoadOperatorTest,
- ::testing::Combine(::testing::ValuesIn(kMachineReps),
- ::testing::ValuesIn(kMachineTypes)));
+INSTANTIATE_TEST_CASE_P(
+ MachineOperatorTest, MachineLoadOperatorTest,
+ ::testing::Combine(::testing::ValuesIn(kMachineReps),
+ ::testing::ValuesIn(kMachineTypesForAccess)));
// -----------------------------------------------------------------------------
MachineOperatorTest, MachineStoreOperatorTest,
::testing::Combine(
::testing::ValuesIn(kMachineReps),
- ::testing::Combine(::testing::ValuesIn(kMachineTypes),
+ ::testing::Combine(::testing::ValuesIn(kMachineTypesForAccess),
::testing::Values(kNoWriteBarrier,
kFullWriteBarrier))));
#endif