| 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/compiler-specific.h" |
| 10 #include "src/base/flags.h" | 11 #include "src/base/flags.h" |
| 11 #include "src/base/functional.h" | 12 #include "src/base/functional.h" |
| 13 #include "src/globals.h" |
| 12 #include "src/handles.h" | 14 #include "src/handles.h" |
| 13 #include "src/zone/zone.h" | 15 #include "src/zone/zone.h" |
| 14 | 16 |
| 15 namespace v8 { | 17 namespace v8 { |
| 16 namespace internal { | 18 namespace internal { |
| 17 namespace compiler { | 19 namespace compiler { |
| 18 | 20 |
| 19 // An operator represents description of the "computation" of a node in the | 21 // An operator represents description of the "computation" of a node in the |
| 20 // compiler IR. A computation takes values (i.e. data) as input and produces | 22 // compiler IR. A computation takes values (i.e. data) as input and produces |
| 21 // zero or more values as output. The side-effects of a computation must be | 23 // zero or more values as output. The side-effects of a computation must be |
| 22 // captured by additional control and data dependencies which are part of the | 24 // captured by additional control and data dependencies which are part of the |
| 23 // IR graph. | 25 // IR graph. |
| 24 // Operators are immutable and describe the statically-known parts of a | 26 // Operators are immutable and describe the statically-known parts of a |
| 25 // computation. Thus they can be safely shared by many different nodes in the | 27 // computation. Thus they can be safely shared by many different nodes in the |
| 26 // IR graph, or even globally between graphs. Operators can have "static | 28 // IR graph, or even globally between graphs. Operators can have "static |
| 27 // parameters" which are compile-time constant parameters to the operator, such | 29 // parameters" which are compile-time constant parameters to the operator, such |
| 28 // as the name for a named field access, the ID of a runtime function, etc. | 30 // as the name for a named field access, the ID of a runtime function, etc. |
| 29 // Static parameters are private to the operator and only semantically | 31 // Static parameters are private to the operator and only semantically |
| 30 // meaningful to the operator itself. | 32 // meaningful to the operator itself. |
| 31 class Operator : public ZoneObject { | 33 class V8_EXPORT_PRIVATE Operator : public NON_EXPORTED_BASE(ZoneObject) { |
| 32 public: | 34 public: |
| 33 typedef uint16_t Opcode; | 35 typedef uint16_t Opcode; |
| 34 | 36 |
| 35 // Properties inform the operator-independent optimizer about legal | 37 // Properties inform the operator-independent optimizer about legal |
| 36 // transformations for nodes that have this operator. | 38 // transformations for nodes that have this operator. |
| 37 enum Property { | 39 enum Property { |
| 38 kNoProperties = 0, | 40 kNoProperties = 0, |
| 39 kCommutative = 1 << 0, // OP(a, b) == OP(b, a) for all inputs. | 41 kCommutative = 1 << 0, // 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. | 42 kAssociative = 1 << 1, // OP(a, OP(b,c)) == OP(OP(a,b), c) for all inputs. |
| 41 kIdempotent = 1 << 2, // OP(a); OP(a) == OP(a). | 43 kIdempotent = 1 << 2, // OP(a); OP(a) == OP(a). |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 template <> | 246 template <> |
| 245 struct OpEqualTo<Handle<ScopeInfo>> : public Handle<ScopeInfo>::equal_to {}; | 247 struct OpEqualTo<Handle<ScopeInfo>> : public Handle<ScopeInfo>::equal_to {}; |
| 246 template <> | 248 template <> |
| 247 struct OpHash<Handle<ScopeInfo>> : public Handle<ScopeInfo>::hash {}; | 249 struct OpHash<Handle<ScopeInfo>> : public Handle<ScopeInfo>::hash {}; |
| 248 | 250 |
| 249 } // namespace compiler | 251 } // namespace compiler |
| 250 } // namespace internal | 252 } // namespace internal |
| 251 } // namespace v8 | 253 } // namespace v8 |
| 252 | 254 |
| 253 #endif // V8_COMPILER_OPERATOR_H_ | 255 #endif // V8_COMPILER_OPERATOR_H_ |
| OLD | NEW |