| 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_NODE_PROPERTIES_H_ | 5 #ifndef V8_COMPILER_NODE_PROPERTIES_H_ |
| 6 #define V8_COMPILER_NODE_PROPERTIES_H_ | 6 #define V8_COMPILER_NODE_PROPERTIES_H_ |
| 7 | 7 |
| 8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
| 9 #include "src/types.h" | 9 #include "src/types.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 namespace compiler { | 13 namespace compiler { |
| 14 | 14 |
| 15 class Graph; |
| 15 class Operator; | 16 class Operator; |
| 17 class CommonOperatorBuilder; |
| 16 | 18 |
| 17 // A facade that simplifies access to the different kinds of inputs to a node. | 19 // A facade that simplifies access to the different kinds of inputs to a node. |
| 18 class NodeProperties FINAL { | 20 class NodeProperties FINAL { |
| 19 public: | 21 public: |
| 20 // --------------------------------------------------------------------------- | 22 // --------------------------------------------------------------------------- |
| 21 // Input layout. | 23 // Input layout. |
| 22 // Inputs are always arranged in order as follows: | 24 // Inputs are always arranged in order as follows: |
| 23 // 0 [ values, context, frame state, effects, control ] node->InputCount() | 25 // 0 [ values, context, frame state, effects, control ] node->InputCount() |
| 24 | 26 |
| 25 static int FirstValueIndex(Node* node) { return 0; } | 27 static int FirstValueIndex(Node* node) { return 0; } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 75 |
| 74 // --------------------------------------------------------------------------- | 76 // --------------------------------------------------------------------------- |
| 75 // Miscellaneous mutators. | 77 // Miscellaneous mutators. |
| 76 | 78 |
| 77 static void ReplaceContextInput(Node* node, Node* context); | 79 static void ReplaceContextInput(Node* node, Node* context); |
| 78 static void ReplaceControlInput(Node* node, Node* control); | 80 static void ReplaceControlInput(Node* node, Node* control); |
| 79 static void ReplaceEffectInput(Node* node, Node* effect, int index = 0); | 81 static void ReplaceEffectInput(Node* node, Node* effect, int index = 0); |
| 80 static void ReplaceFrameStateInput(Node* node, int index, Node* frame_state); | 82 static void ReplaceFrameStateInput(Node* node, int index, Node* frame_state); |
| 81 static void RemoveNonValueInputs(Node* node); | 83 static void RemoveNonValueInputs(Node* node); |
| 82 | 84 |
| 85 // Merge the control node {node} into the end of the graph, introducing a |
| 86 // merge node or expanding an existing merge node if necessary. |
| 87 static void MergeControlToEnd(Graph* graph, CommonOperatorBuilder* common, |
| 88 Node* node); |
| 89 |
| 83 // Replace value uses of {node} with {value} and effect uses of {node} with | 90 // Replace value uses of {node} with {value} and effect uses of {node} with |
| 84 // {effect}. If {effect == NULL}, then use the effect input to {node}. All | 91 // {effect}. If {effect == NULL}, then use the effect input to {node}. All |
| 85 // control uses will be relaxed assuming {node} cannot throw. | 92 // control uses will be relaxed assuming {node} cannot throw. |
| 86 static void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr, | 93 static void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr, |
| 87 Node* control = nullptr); | 94 Node* control = nullptr); |
| 88 | 95 |
| 89 // --------------------------------------------------------------------------- | 96 // --------------------------------------------------------------------------- |
| 90 // Miscellaneous utilities. | 97 // Miscellaneous utilities. |
| 91 | 98 |
| 92 static Node* FindProjection(Node* node, size_t projection_index); | 99 static Node* FindProjection(Node* node, size_t projection_index); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 121 | 128 |
| 122 private: | 129 private: |
| 123 static inline bool IsInputRange(Edge edge, int first, int count); | 130 static inline bool IsInputRange(Edge edge, int first, int count); |
| 124 }; | 131 }; |
| 125 | 132 |
| 126 } // namespace compiler | 133 } // namespace compiler |
| 127 } // namespace internal | 134 } // namespace internal |
| 128 } // namespace v8 | 135 } // namespace v8 |
| 129 | 136 |
| 130 #endif // V8_COMPILER_NODE_PROPERTIES_H_ | 137 #endif // V8_COMPILER_NODE_PROPERTIES_H_ |
| OLD | NEW |