Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: src/compiler/machine-operator.cc

Issue 1779713009: Implement optional turbofan UnalignedLoad and UnalignedStore operators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unaligned access simulate using load/shift/or and store/shift/and Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/machine-operator.cc
diff --git a/src/compiler/machine-operator.cc b/src/compiler/machine-operator.cc
index 6a506d26ad334c493ec8c92184eb1bf28b12d0cd..b4628abe085b20015246b57c6c936f5019bb8810 100644
--- a/src/compiler/machine-operator.cc
+++ b/src/compiler/machine-operator.cc
@@ -79,6 +79,16 @@ StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
return OpParameter<StoreRepresentation>(op);
}
+UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const* op) {
+ DCHECK_EQ(IrOpcode::kUnalignedLoad, op->opcode());
+ return OpParameter<UnalignedLoadRepresentation>(op);
+}
+
+UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
+ Operator const* op) {
+ DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode());
+ return OpParameter<UnalignedStoreRepresentation>(op);
+}
CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode());
@@ -284,6 +294,14 @@ struct MachineOperatorGlobalCache {
IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
"Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
}; \
+ struct UnalignedLoad##Type##Operator final \
+ : public Operator1<UnalignedLoadRepresentation> { \
+ UnalignedLoad##Type##Operator() \
+ : Operator1<UnalignedLoadRepresentation>( \
+ IrOpcode::kUnalignedLoad, \
+ Operator::kNoThrow | Operator::kNoWrite, "UnalignedLoad", 2, 1, \
+ 1, 1, 1, 0, MachineType::Type()) {} \
+ }; \
struct CheckedLoad##Type##Operator final \
: public Operator1<CheckedLoadRepresentation> { \
CheckedLoad##Type##Operator() \
@@ -292,6 +310,7 @@ struct MachineOperatorGlobalCache {
"CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \
}; \
Load##Type##Operator kLoad##Type; \
+ UnalignedLoad##Type##Operator kUnalignedLoad##Type; \
CheckedLoad##Type##Operator kCheckedLoad##Type;
MACHINE_TYPE_LIST(LOAD)
#undef LOAD
@@ -337,6 +356,14 @@ struct MachineOperatorGlobalCache {
Store##Type##FullWriteBarrier##Operator() \
: Store##Type##Operator(kFullWriteBarrier) {} \
}; \
+ struct UnalignedStore##Type##Operator final \
+ : public Operator1<UnalignedStoreRepresentation> { \
+ UnalignedStore##Type##Operator() \
+ : Operator1<UnalignedStoreRepresentation>( \
+ IrOpcode::kUnalignedStore, \
+ Operator::kNoRead | Operator::kNoThrow, "UnalignedStore", 3, 1, \
+ 1, 0, 1, 0, MachineRepresentation::Type) {} \
+ }; \
struct CheckedStore##Type##Operator final \
: public Operator1<CheckedStoreRepresentation> { \
CheckedStore##Type##Operator() \
@@ -350,6 +377,7 @@ struct MachineOperatorGlobalCache {
Store##Type##PointerWriteBarrier##Operator \
kStore##Type##PointerWriteBarrier; \
Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \
+ UnalignedStore##Type##Operator kUnalignedStore##Type; \
CheckedStore##Type##Operator kCheckedStore##Type;
MACHINE_REPRESENTATION_LIST(STORE)
#undef STORE
@@ -444,6 +472,35 @@ const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
return nullptr;
}
+const OptionalOperator MachineOperatorBuilder::UnalignedLoad(
+ UnalignedLoadRepresentation rep) {
+#define LOAD(Type) \
+ if (rep == MachineType::Type()) { \
+ return OptionalOperator( \
+ flags_ & kUnalignedLoad ? &cache_.kUnalignedLoad##Type : nullptr); \
+ }
+ MACHINE_TYPE_LIST(LOAD)
+#undef LOAD
+ UNREACHABLE();
+ return OptionalOperator(nullptr);
+}
+
+const OptionalOperator MachineOperatorBuilder::UnalignedStore(
+ UnalignedStoreRepresentation rep) {
+ switch (rep) {
+#define STORE(kRep) \
+ case MachineRepresentation::kRep: \
+ return OptionalOperator( \
+ flags_ & kUnalignedStore ? &cache_.kUnalignedStore##kRep : nullptr);
+ MACHINE_REPRESENTATION_LIST(STORE)
+#undef STORE
+ case MachineRepresentation::kBit:
+ case MachineRepresentation::kNone:
+ break;
+ }
+ UNREACHABLE();
+ return OptionalOperator(nullptr);
+}
const Operator* MachineOperatorBuilder::CheckedLoad(
CheckedLoadRepresentation rep) {

Powered by Google App Engine
This is Rietveld 408576698