| 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 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 static bool IsExceptionalCall(Node* node); | 77 static bool IsExceptionalCall(Node* node); |
| 78 | 78 |
| 79 // --------------------------------------------------------------------------- | 79 // --------------------------------------------------------------------------- |
| 80 // Miscellaneous mutators. | 80 // Miscellaneous mutators. |
| 81 | 81 |
| 82 static void ReplaceValueInput(Node* node, Node* value, int index); | 82 static void ReplaceValueInput(Node* node, Node* value, int index); |
| 83 static void ReplaceContextInput(Node* node, Node* context); | 83 static void ReplaceContextInput(Node* node, Node* context); |
| 84 static void ReplaceControlInput(Node* node, Node* control, int index = 0); | 84 static void ReplaceControlInput(Node* node, Node* control, int index = 0); |
| 85 static void ReplaceEffectInput(Node* node, Node* effect, int index = 0); | 85 static void ReplaceEffectInput(Node* node, Node* effect, int index = 0); |
| 86 static void ReplaceFrameStateInput(Node* node, int index, Node* frame_state); | 86 static void ReplaceFrameStateInput(Node* node, int index, Node* frame_state); |
| 87 static void RemoveFrameStateInput(Node* node, int index); | |
| 88 static void RemoveNonValueInputs(Node* node); | 87 static void RemoveNonValueInputs(Node* node); |
| 89 static void RemoveValueInputs(Node* node); | 88 static void RemoveValueInputs(Node* node); |
| 90 | 89 |
| 91 // Replaces all value inputs of {node} with the single input {value}. | 90 // Replaces all value inputs of {node} with the single input {value}. |
| 92 static void ReplaceValueInputs(Node* node, Node* value); | 91 static void ReplaceValueInputs(Node* node, Node* value); |
| 93 | 92 |
| 94 // Merge the control node {node} into the end of the graph, introducing a | 93 // Merge the control node {node} into the end of the graph, introducing a |
| 95 // merge node or expanding an existing merge node if necessary. | 94 // merge node or expanding an existing merge node if necessary. |
| 96 static void MergeControlToEnd(Graph* graph, CommonOperatorBuilder* common, | 95 static void MergeControlToEnd(Graph* graph, CommonOperatorBuilder* common, |
| 97 Node* node); | 96 Node* node); |
| 98 | 97 |
| 99 // Replace all uses of {node} with the given replacement nodes. All occurring | 98 // Replace all uses of {node} with the given replacement nodes. All occurring |
| 100 // use kinds need to be replaced, {nullptr} is only valid if a use kind is | 99 // use kinds need to be replaced, {nullptr} is only valid if a use kind is |
| 101 // guaranteed not to exist. | 100 // guaranteed not to exist. |
| 102 static void ReplaceUses(Node* node, Node* value, Node* effect = nullptr, | 101 static void ReplaceUses(Node* node, Node* value, Node* effect = nullptr, |
| 103 Node* success = nullptr, Node* exception = nullptr); | 102 Node* success = nullptr, Node* exception = nullptr); |
| 104 | 103 |
| 105 // Safe wrapper to mutate the operator of a node. Checks that the node is | 104 // Safe wrapper to mutate the operator of a node. Checks that the node is |
| 106 // currently in a state that satisfies constraints of the new operator. | 105 // currently in a state that satisfies constraints of the new operator. |
| 107 static void ChangeOp(Node* node, const Operator* new_op); | 106 static void ChangeOp(Node* node, const Operator* new_op); |
| 108 | 107 |
| 109 // --------------------------------------------------------------------------- | 108 // --------------------------------------------------------------------------- |
| 110 // Miscellaneous utilities. | 109 // Miscellaneous utilities. |
| 111 | 110 |
| 111 // Find the last frame state that is effect-wise before the given node. This |
| 112 // assumes a linear effect-chain up to a {CheckPoint} node in the graph. |
| 113 static Node* FindFrameStateBefore(Node* node); |
| 114 |
| 115 // Collect the output-value projection for the given output index. |
| 112 static Node* FindProjection(Node* node, size_t projection_index); | 116 static Node* FindProjection(Node* node, size_t projection_index); |
| 113 | 117 |
| 114 // Collect the branch-related projections from a node, such as IfTrue, | 118 // Collect the branch-related projections from a node, such as IfTrue, |
| 115 // IfFalse, IfSuccess, IfException, IfValue and IfDefault. | 119 // IfFalse, IfSuccess, IfException, IfValue and IfDefault. |
| 116 // - Branch: [ IfTrue, IfFalse ] | 120 // - Branch: [ IfTrue, IfFalse ] |
| 117 // - Call : [ IfSuccess, IfException ] | 121 // - Call : [ IfSuccess, IfException ] |
| 118 // - Switch: [ IfValue, ..., IfDefault ] | 122 // - Switch: [ IfValue, ..., IfDefault ] |
| 119 static void CollectControlProjections(Node* node, Node** proj, size_t count); | 123 static void CollectControlProjections(Node* node, Node** proj, size_t count); |
| 120 | 124 |
| 121 // --------------------------------------------------------------------------- | 125 // --------------------------------------------------------------------------- |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 161 |
| 158 private: | 162 private: |
| 159 static inline bool IsInputRange(Edge edge, int first, int count); | 163 static inline bool IsInputRange(Edge edge, int first, int count); |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 } // namespace compiler | 166 } // namespace compiler |
| 163 } // namespace internal | 167 } // namespace internal |
| 164 } // namespace v8 | 168 } // namespace v8 |
| 165 | 169 |
| 166 #endif // V8_COMPILER_NODE_PROPERTIES_H_ | 170 #endif // V8_COMPILER_NODE_PROPERTIES_H_ |
| OLD | NEW |