| 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_OPERATOR_H_ | 5 #ifndef V8_COMPILER_OPERATOR_H_ |
| 6 #define V8_COMPILER_OPERATOR_H_ | 6 #define V8_COMPILER_OPERATOR_H_ |
| 7 | 7 |
| 8 #include <ostream> // NOLINT(readability/streams) | 8 #include <ostream> // NOLINT(readability/streams) |
| 9 | 9 |
| 10 #include "src/base/flags.h" | 10 #include "src/base/flags.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Static parameters are private to the operator and only semantically | 29 // Static parameters are private to the operator and only semantically |
| 30 // meaningful to the operator itself. | 30 // meaningful to the operator itself. |
| 31 class Operator : public ZoneObject { | 31 class Operator : public ZoneObject { |
| 32 public: | 32 public: |
| 33 typedef uint16_t Opcode; | 33 typedef uint16_t Opcode; |
| 34 | 34 |
| 35 // Properties inform the operator-independent optimizer about legal | 35 // Properties inform the operator-independent optimizer about legal |
| 36 // transformations for nodes that have this operator. | 36 // transformations for nodes that have this operator. |
| 37 enum Property { | 37 enum Property { |
| 38 kNoProperties = 0, | 38 kNoProperties = 0, |
| 39 kReducible = 1 << 0, // Participates in strength reduction. | 39 kCommutative = 1 << 0, // OP(a, b) == OP(b, a) for all inputs. |
| 40 kCommutative = 1 << 1, // OP(a, b) == OP(b, a) for all inputs. | 40 kAssociative = 1 << 1, // OP(a, OP(b,c)) == OP(OP(a,b), c) for all inputs. |
| 41 kAssociative = 1 << 2, // OP(a, OP(b,c)) == OP(OP(a,b), c) for all inputs. | 41 kIdempotent = 1 << 2, // OP(a); OP(a) == OP(a). |
| 42 kIdempotent = 1 << 3, // OP(a); OP(a) == OP(a). | 42 kNoRead = 1 << 3, // Has no scheduling dependency on Effects |
| 43 kNoRead = 1 << 4, // Has no scheduling dependency on Effects | 43 kNoWrite = 1 << 4, // Does not modify any Effects and thereby |
| 44 kNoWrite = 1 << 5, // Does not modify any Effects and thereby | |
| 45 // create new scheduling dependencies. | 44 // create new scheduling dependencies. |
| 46 kNoThrow = 1 << 6, // Can never generate an exception. | 45 kNoThrow = 1 << 5, // Can never generate an exception. |
| 46 kNoDeopt = 1 << 6, // Can never generate an eager deoptimization exit. |
| 47 kFoldable = kNoRead | kNoWrite, | 47 kFoldable = kNoRead | kNoWrite, |
| 48 kKontrol = kFoldable | kNoThrow, | 48 kKontrol = kNoDeopt | kFoldable | kNoThrow, |
| 49 kEliminatable = kNoWrite | kNoThrow, | 49 kEliminatable = kNoDeopt | kNoWrite | kNoThrow, |
| 50 kPure = kNoRead | kNoWrite | kNoThrow | kIdempotent | 50 kPure = kNoDeopt | kNoRead | kNoWrite | kNoThrow | kIdempotent |
| 51 }; | 51 }; |
| 52 typedef base::Flags<Property, uint8_t> Properties; | 52 typedef base::Flags<Property, uint8_t> Properties; |
| 53 | 53 |
| 54 // Constructor. | 54 // Constructor. |
| 55 Operator(Opcode opcode, Properties properties, const char* mnemonic, | 55 Operator(Opcode opcode, Properties properties, const char* mnemonic, |
| 56 size_t value_in, size_t effect_in, size_t control_in, | 56 size_t value_in, size_t effect_in, size_t control_in, |
| 57 size_t value_out, size_t effect_out, size_t control_out); | 57 size_t value_out, size_t effect_out, size_t control_out); |
| 58 | 58 |
| 59 virtual ~Operator() {} | 59 virtual ~Operator() {} |
| 60 | 60 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 template <> | 223 template <> |
| 224 struct OpEqualTo<Handle<ScopeInfo>> : public Handle<ScopeInfo>::equal_to {}; | 224 struct OpEqualTo<Handle<ScopeInfo>> : public Handle<ScopeInfo>::equal_to {}; |
| 225 template <> | 225 template <> |
| 226 struct OpHash<Handle<ScopeInfo>> : public Handle<ScopeInfo>::hash {}; | 226 struct OpHash<Handle<ScopeInfo>> : public Handle<ScopeInfo>::hash {}; |
| 227 | 227 |
| 228 } // namespace compiler | 228 } // namespace compiler |
| 229 } // namespace internal | 229 } // namespace internal |
| 230 } // namespace v8 | 230 } // namespace v8 |
| 231 | 231 |
| 232 #endif // V8_COMPILER_OPERATOR_H_ | 232 #endif // V8_COMPILER_OPERATOR_H_ |
| OLD | NEW |