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

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

Issue 1928513002: Implement UnalignedLoad and UnalignedStore in WASM using LoadByte/Shift/Or and StoreByte/Shift/And. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix nits. Fix compilation error on Windows compiler Created 4 years, 7 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
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator.h
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h
index ed2a758b086e6de240ed907d93c59980558c7f97..8f95a89af3bdf5c0715c8dd8c43f95908ec8899d 100644
--- a/src/compiler/machine-operator.h
+++ b/src/compiler/machine-operator.h
@@ -123,10 +123,74 @@ class MachineOperatorBuilder final : public ZoneObject {
};
typedef base::Flags<Flag, unsigned> Flags;
+ class AlignmentRequirements {
+ public:
+ enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport };
+
+ bool IsUnalignedLoadSupported(const MachineType& machineType,
+ uint8_t alignment) const {
+ return IsUnalignedSupported(unalignedLoadSupportedTypes_, machineType,
+ alignment);
+ }
+
+ bool IsUnalignedStoreSupported(const MachineType& machineType,
+ uint8_t alignment) const {
+ return IsUnalignedSupported(unalignedStoreSupportedTypes_, machineType,
+ alignment);
+ }
+
+ static AlignmentRequirements FullUnalignedAccessSupport() {
+ return AlignmentRequirements(kFullSupport);
+ }
+ static AlignmentRequirements NoUnalignedAccessSupport() {
+ return AlignmentRequirements(kNoSupport);
+ }
+ static AlignmentRequirements SomeUnalignedAccessSupport(
+ const Vector<MachineType>& unalignedLoadSupportedTypes,
+ const Vector<MachineType>& unalignedStoreSupportedTypes) {
+ return AlignmentRequirements(kSomeSupport, unalignedLoadSupportedTypes,
+ unalignedStoreSupportedTypes);
+ }
+
+ private:
+ explicit AlignmentRequirements(
+ AlignmentRequirements::UnalignedAccessSupport unalignedAccessSupport,
+ Vector<MachineType> unalignedLoadSupportedTypes =
+ Vector<MachineType>(NULL, 0),
+ Vector<MachineType> unalignedStoreSupportedTypes =
+ Vector<MachineType>(NULL, 0))
+ : unalignedSupport_(unalignedAccessSupport),
+ unalignedLoadSupportedTypes_(unalignedLoadSupportedTypes),
+ unalignedStoreSupportedTypes_(unalignedStoreSupportedTypes) {}
+
+ bool IsUnalignedSupported(const Vector<MachineType>& supported,
+ const MachineType& machineType,
+ uint8_t alignment) const {
+ if (unalignedSupport_ == kFullSupport) {
+ return true;
+ } else if (unalignedSupport_ == kNoSupport) {
+ return false;
+ } else {
+ for (MachineType m : supported) {
+ if (m == machineType) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ const AlignmentRequirements::UnalignedAccessSupport unalignedSupport_;
+ const Vector<MachineType> unalignedLoadSupportedTypes_;
+ const Vector<MachineType> unalignedStoreSupportedTypes_;
+ };
+
explicit MachineOperatorBuilder(
Zone* zone,
MachineRepresentation word = MachineType::PointerRepresentation(),
- Flags supportedOperators = kNoFlags);
+ Flags supportedOperators = kNoFlags,
+ AlignmentRequirements alignmentRequirements =
+ AlignmentRequirements::NoUnalignedAccessSupport());
const Operator* DebugBreak();
@@ -515,6 +579,18 @@ class MachineOperatorBuilder final : public ZoneObject {
bool Is64() const { return word() == MachineRepresentation::kWord64; }
MachineRepresentation word() const { return word_; }
+ bool UnalignedLoadSupported(const MachineType& machineType,
+ uint8_t alignment) {
+ return alignment_requirements_.IsUnalignedLoadSupported(machineType,
+ alignment);
+ }
+
+ bool UnalignedStoreSupported(const MachineType& machineType,
+ uint8_t alignment) {
+ return alignment_requirements_.IsUnalignedStoreSupported(machineType,
+ alignment);
+ }
+
// Pseudo operators that translate to 32/64-bit operators depending on the
// word-size of the target machine assumed by this builder.
#define PSEUDO_OP_LIST(V) \
@@ -549,6 +625,7 @@ class MachineOperatorBuilder final : public ZoneObject {
MachineOperatorGlobalCache const& cache_;
MachineRepresentation const word_;
Flags const flags_;
+ AlignmentRequirements const alignment_requirements_;
DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder);
};
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698