| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
| 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/compiler/machine-type.h" | 9 #include "src/compiler/machine-type.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool operator==(StoreRepresentation, StoreRepresentation); | 46 bool operator==(StoreRepresentation, StoreRepresentation); |
| 47 bool operator!=(StoreRepresentation, StoreRepresentation); | 47 bool operator!=(StoreRepresentation, StoreRepresentation); |
| 48 | 48 |
| 49 size_t hash_value(StoreRepresentation); | 49 size_t hash_value(StoreRepresentation); |
| 50 | 50 |
| 51 std::ostream& operator<<(std::ostream&, StoreRepresentation); | 51 std::ostream& operator<<(std::ostream&, StoreRepresentation); |
| 52 | 52 |
| 53 StoreRepresentation const& StoreRepresentationOf(Operator const*); | 53 StoreRepresentation const& StoreRepresentationOf(Operator const*); |
| 54 | 54 |
| 55 | 55 |
| 56 // A CheckedLoad needs a MachineType. |
| 57 typedef MachineType CheckedLoadRepresentation; |
| 58 |
| 59 CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const*); |
| 60 |
| 61 |
| 62 // A CheckedStore needs a MachineType. |
| 63 typedef MachineType CheckedStoreRepresentation; |
| 64 |
| 65 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const*); |
| 66 |
| 67 |
| 56 // Interface for building machine-level operators. These operators are | 68 // Interface for building machine-level operators. These operators are |
| 57 // machine-level but machine-independent and thus define a language suitable | 69 // machine-level but machine-independent and thus define a language suitable |
| 58 // for generating code to run on architectures such as ia32, x64, arm, etc. | 70 // for generating code to run on architectures such as ia32, x64, arm, etc. |
| 59 class MachineOperatorBuilder FINAL : public ZoneObject { | 71 class MachineOperatorBuilder FINAL : public ZoneObject { |
| 60 public: | 72 public: |
| 61 // Flags that specify which operations are available. This is useful | 73 // Flags that specify which operations are available. This is useful |
| 62 // for operations that are unsupported by some back-ends. | 74 // for operations that are unsupported by some back-ends. |
| 63 enum Flag { | 75 enum Flag { |
| 64 kNoFlags = 0u, | 76 kNoFlags = 0u, |
| 65 kFloat64Floor = 1u << 0, | 77 kFloat64Floor = 1u << 0, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 179 |
| 168 // load [base + index] | 180 // load [base + index] |
| 169 const Operator* Load(LoadRepresentation rep); | 181 const Operator* Load(LoadRepresentation rep); |
| 170 | 182 |
| 171 // store [base + index], value | 183 // store [base + index], value |
| 172 const Operator* Store(StoreRepresentation rep); | 184 const Operator* Store(StoreRepresentation rep); |
| 173 | 185 |
| 174 // Access to the machine stack. | 186 // Access to the machine stack. |
| 175 const Operator* LoadStackPointer(); | 187 const Operator* LoadStackPointer(); |
| 176 | 188 |
| 189 // checked-load heap, index, length |
| 190 const Operator* CheckedLoad(CheckedLoadRepresentation); |
| 191 // checked-store heap, index, length, value |
| 192 const Operator* CheckedStore(CheckedStoreRepresentation); |
| 193 |
| 177 // Target machine word-size assumed by this builder. | 194 // Target machine word-size assumed by this builder. |
| 178 bool Is32() const { return word() == kRepWord32; } | 195 bool Is32() const { return word() == kRepWord32; } |
| 179 bool Is64() const { return word() == kRepWord64; } | 196 bool Is64() const { return word() == kRepWord64; } |
| 180 MachineType word() const { return word_; } | 197 MachineType word() const { return word_; } |
| 181 | 198 |
| 182 // Pseudo operators that translate to 32/64-bit operators depending on the | 199 // Pseudo operators that translate to 32/64-bit operators depending on the |
| 183 // word-size of the target machine assumed by this builder. | 200 // word-size of the target machine assumed by this builder. |
| 184 #define PSEUDO_OP_LIST(V) \ | 201 #define PSEUDO_OP_LIST(V) \ |
| 185 V(Word, And) \ | 202 V(Word, And) \ |
| 186 V(Word, Or) \ | 203 V(Word, Or) \ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 216 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); | 233 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); |
| 217 }; | 234 }; |
| 218 | 235 |
| 219 | 236 |
| 220 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 237 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
| 221 } // namespace compiler | 238 } // namespace compiler |
| 222 } // namespace internal | 239 } // namespace internal |
| 223 } // namespace v8 | 240 } // namespace v8 |
| 224 | 241 |
| 225 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 242 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
| OLD | NEW |