summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/machine-operator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/machine-operator.cc')
-rw-r--r--deps/v8/src/compiler/machine-operator.cc138
1 files changed, 84 insertions, 54 deletions
diff --git a/deps/v8/src/compiler/machine-operator.cc b/deps/v8/src/compiler/machine-operator.cc
index 43f7eda5c6..511a10dd02 100644
--- a/deps/v8/src/compiler/machine-operator.cc
+++ b/deps/v8/src/compiler/machine-operator.cc
@@ -47,7 +47,7 @@ std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) {
bool operator==(StoreRepresentation lhs, StoreRepresentation rhs) {
- return lhs.machine_type() == rhs.machine_type() &&
+ return lhs.representation() == rhs.representation() &&
lhs.write_barrier_kind() == rhs.write_barrier_kind();
}
@@ -58,16 +58,22 @@ bool operator!=(StoreRepresentation lhs, StoreRepresentation rhs) {
size_t hash_value(StoreRepresentation rep) {
- return base::hash_combine(rep.machine_type(), rep.write_barrier_kind());
+ return base::hash_combine(rep.representation(), rep.write_barrier_kind());
}
std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) {
- return os << "(" << rep.machine_type() << " : " << rep.write_barrier_kind()
+ return os << "(" << rep.representation() << " : " << rep.write_barrier_kind()
<< ")";
}
+LoadRepresentation LoadRepresentationOf(Operator const* op) {
+ DCHECK_EQ(IrOpcode::kLoad, op->opcode());
+ return OpParameter<LoadRepresentation>(op);
+}
+
+
StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kStore, op->opcode());
return OpParameter<StoreRepresentation>(op);
@@ -122,7 +128,10 @@ CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
V(Uint32Mod, Operator::kNoProperties, 2, 1, 1) \
V(Uint32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Int64AddWithOverflow, Operator::kAssociative | Operator::kCommutative, 2, \
+ 0, 2) \
V(Int64Sub, Operator::kNoProperties, 2, 0, 1) \
+ V(Int64SubWithOverflow, Operator::kNoProperties, 2, 0, 2) \
V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
V(Int64Div, Operator::kNoProperties, 2, 1, 1) \
V(Int64Mod, Operator::kNoProperties, 2, 1, 1) \
@@ -135,9 +144,15 @@ CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \
V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 0, 1) \
+ V(TryTruncateFloat32ToInt64, Operator::kNoProperties, 1, 0, 2) \
+ V(TryTruncateFloat64ToInt64, Operator::kNoProperties, 1, 0, 2) \
+ V(TryTruncateFloat32ToUint64, Operator::kNoProperties, 1, 0, 2) \
+ V(TryTruncateFloat64ToUint64, Operator::kNoProperties, 1, 0, 2) \
V(ChangeInt32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
V(RoundInt64ToFloat32, Operator::kNoProperties, 1, 0, 1) \
V(RoundInt64ToFloat64, Operator::kNoProperties, 1, 0, 1) \
+ V(RoundUint64ToFloat32, Operator::kNoProperties, 1, 0, 1) \
+ V(RoundUint64ToFloat64, Operator::kNoProperties, 1, 0, 1) \
V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1) \
V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1) \
@@ -182,24 +197,40 @@ CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
V(Float32Min, Operator::kNoProperties, 2, 0, 1) \
V(Float64Max, Operator::kNoProperties, 2, 0, 1) \
V(Float64Min, Operator::kNoProperties, 2, 0, 1) \
+ V(Float32RoundDown, Operator::kNoProperties, 1, 0, 1) \
V(Float64RoundDown, Operator::kNoProperties, 1, 0, 1) \
+ V(Float32RoundUp, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64RoundUp, Operator::kNoProperties, 1, 0, 1) \
+ V(Float32RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
- V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1)
+ V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \
+ V(Float32RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64RoundTiesEven, Operator::kNoProperties, 1, 0, 1)
#define MACHINE_TYPE_LIST(V) \
- V(MachFloat32) \
- V(MachFloat64) \
- V(MachInt8) \
- V(MachUint8) \
- V(MachInt16) \
- V(MachUint16) \
- V(MachInt32) \
- V(MachUint32) \
- V(MachInt64) \
- V(MachUint64) \
- V(MachPtr) \
- V(MachAnyTagged)
+ V(Float32) \
+ V(Float64) \
+ V(Int8) \
+ V(Uint8) \
+ V(Int16) \
+ V(Uint16) \
+ V(Int32) \
+ V(Uint32) \
+ V(Int64) \
+ V(Uint64) \
+ V(Pointer) \
+ V(AnyTagged)
+
+
+#define MACHINE_REPRESENTATION_LIST(V) \
+ V(kFloat32) \
+ V(kFloat64) \
+ V(kWord8) \
+ V(kWord16) \
+ V(kWord32) \
+ V(kWord64) \
+ V(kTagged)
struct MachineOperatorGlobalCache {
@@ -234,14 +265,14 @@ struct MachineOperatorGlobalCache {
Load##Type##Operator() \
: Operator1<LoadRepresentation>( \
IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
- "Load", 2, 1, 1, 1, 1, 0, k##Type) {} \
+ "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
}; \
struct CheckedLoad##Type##Operator final \
: public Operator1<CheckedLoadRepresentation> { \
CheckedLoad##Type##Operator() \
: Operator1<CheckedLoadRepresentation>( \
IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \
- "CheckedLoad", 3, 1, 1, 1, 1, 0, k##Type) {} \
+ "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \
}; \
Load##Type##Operator kLoad##Type; \
CheckedLoad##Type##Operator kCheckedLoad##Type;
@@ -254,7 +285,8 @@ struct MachineOperatorGlobalCache {
: Operator1<StoreRepresentation>( \
IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \
"Store", 3, 1, 1, 0, 1, 0, \
- StoreRepresentation(k##Type, write_barrier_kind)) {} \
+ StoreRepresentation(MachineRepresentation::Type, \
+ write_barrier_kind)) {} \
}; \
struct Store##Type##NoWriteBarrier##Operator final \
: public Store##Type##Operator { \
@@ -281,7 +313,8 @@ struct MachineOperatorGlobalCache {
CheckedStore##Type##Operator() \
: Operator1<CheckedStoreRepresentation>( \
IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \
- "CheckedStore", 4, 1, 1, 0, 1, 0, k##Type) {} \
+ "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \
+ } \
}; \
Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \
Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \
@@ -289,7 +322,7 @@ struct MachineOperatorGlobalCache {
kStore##Type##PointerWriteBarrier; \
Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \
CheckedStore##Type##Operator kCheckedStore##Type;
- MACHINE_TYPE_LIST(STORE)
+ MACHINE_REPRESENTATION_LIST(STORE)
#undef STORE
};
@@ -298,10 +331,12 @@ static base::LazyInstance<MachineOperatorGlobalCache>::type kCache =
LAZY_INSTANCE_INITIALIZER;
-MachineOperatorBuilder::MachineOperatorBuilder(Zone* zone, MachineType word,
+MachineOperatorBuilder::MachineOperatorBuilder(Zone* zone,
+ MachineRepresentation word,
Flags flags)
: cache_(kCache.Get()), word_(word), flags_(flags) {
- DCHECK(word == kRepWord32 || word == kRepWord64);
+ DCHECK(word == MachineRepresentation::kWord32 ||
+ word == MachineRepresentation::kWord64);
}
@@ -334,39 +369,36 @@ const Operator* MachineOperatorBuilder::TruncateFloat64ToInt32(
const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
- switch (rep) {
-#define LOAD(Type) \
- case k##Type: \
- return &cache_.kLoad##Type;
+#define LOAD(Type) \
+ if (rep == MachineType::Type()) { \
+ return &cache_.kLoad##Type; \
+ }
MACHINE_TYPE_LIST(LOAD)
#undef LOAD
- default:
- break;
- }
UNREACHABLE();
return nullptr;
}
-const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) {
- switch (rep.machine_type()) {
-#define STORE(Type) \
- case k##Type: \
- switch (rep.write_barrier_kind()) { \
+const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
+ switch (store_rep.representation()) {
+#define STORE(kRep) \
+ case MachineRepresentation::kRep: \
+ switch (store_rep.write_barrier_kind()) { \
case kNoWriteBarrier: \
- return &cache_.k##Store##Type##NoWriteBarrier; \
+ return &cache_.k##Store##kRep##NoWriteBarrier; \
case kMapWriteBarrier: \
- return &cache_.k##Store##Type##MapWriteBarrier; \
+ return &cache_.k##Store##kRep##MapWriteBarrier; \
case kPointerWriteBarrier: \
- return &cache_.k##Store##Type##PointerWriteBarrier; \
+ return &cache_.k##Store##kRep##PointerWriteBarrier; \
case kFullWriteBarrier: \
- return &cache_.k##Store##Type##FullWriteBarrier; \
+ return &cache_.k##Store##kRep##FullWriteBarrier; \
} \
break;
- MACHINE_TYPE_LIST(STORE)
+ MACHINE_REPRESENTATION_LIST(STORE)
#undef STORE
-
- default:
+ case MachineRepresentation::kBit:
+ case MachineRepresentation::kNone:
break;
}
UNREACHABLE();
@@ -376,15 +408,12 @@ const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) {
const Operator* MachineOperatorBuilder::CheckedLoad(
CheckedLoadRepresentation rep) {
- switch (rep) {
-#define LOAD(Type) \
- case k##Type: \
- return &cache_.kCheckedLoad##Type;
+#define LOAD(Type) \
+ if (rep == MachineType::Type()) { \
+ return &cache_.kCheckedLoad##Type; \
+ }
MACHINE_TYPE_LIST(LOAD)
#undef LOAD
- default:
- break;
- }
UNREACHABLE();
return nullptr;
}
@@ -393,12 +422,13 @@ const Operator* MachineOperatorBuilder::CheckedLoad(
const Operator* MachineOperatorBuilder::CheckedStore(
CheckedStoreRepresentation rep) {
switch (rep) {
-#define STORE(Type) \
- case k##Type: \
- return &cache_.kCheckedStore##Type;
- MACHINE_TYPE_LIST(STORE)
+#define STORE(kRep) \
+ case MachineRepresentation::kRep: \
+ return &cache_.kCheckedStore##kRep;
+ MACHINE_REPRESENTATION_LIST(STORE)
#undef STORE
- default:
+ case MachineRepresentation::kBit:
+ case MachineRepresentation::kNone:
break;
}
UNREACHABLE();