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_DIAMOND_H_ | 5 #ifndef V8_COMPILER_DIAMOND_H_ |
6 #define V8_COMPILER_DIAMOND_H_ | 6 #define V8_COMPILER_DIAMOND_H_ |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| 11 #include "src/compiler/node-properties.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 namespace compiler { | 15 namespace compiler { |
15 | 16 |
16 // A helper to make it easier to build diamond-shaped control patterns. | 17 // A helper to make it easier to build diamond-shaped control patterns. |
17 struct Diamond { | 18 struct Diamond { |
18 Graph* graph; | 19 Graph* graph; |
19 CommonOperatorBuilder* common; | 20 CommonOperatorBuilder* common; |
20 Node* branch; | 21 Node* branch; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return graph->NewNode(common->Phi(machine_type, 2), tv, fv, merge); | 54 return graph->NewNode(common->Phi(machine_type, 2), tv, fv, merge); |
54 } | 55 } |
55 | 56 |
56 Node* EffectPhi(Node* tv, Node* fv) { | 57 Node* EffectPhi(Node* tv, Node* fv) { |
57 return graph->NewNode(common->EffectPhi(2), tv, fv, merge); | 58 return graph->NewNode(common->EffectPhi(2), tv, fv, merge); |
58 } | 59 } |
59 | 60 |
60 void OverwriteWithPhi(Node* node, MachineType machine_type, Node* tv, | 61 void OverwriteWithPhi(Node* node, MachineType machine_type, Node* tv, |
61 Node* fv) { | 62 Node* fv) { |
62 DCHECK(node->InputCount() >= 3); | 63 DCHECK(node->InputCount() >= 3); |
63 node->set_op(common->Phi(machine_type, 2)); | |
64 node->ReplaceInput(0, tv); | 64 node->ReplaceInput(0, tv); |
65 node->ReplaceInput(1, fv); | 65 node->ReplaceInput(1, fv); |
66 node->ReplaceInput(2, merge); | 66 node->ReplaceInput(2, merge); |
67 node->TrimInputCount(3); | 67 node->TrimInputCount(3); |
| 68 NodeProperties::ChangeOp(node, common->Phi(machine_type, 2)); |
68 } | 69 } |
69 | 70 |
70 void OverwriteWithEffectPhi(Node* node, Node* te, Node* fe) { | 71 void OverwriteWithEffectPhi(Node* node, Node* te, Node* fe) { |
71 DCHECK(node->InputCount() >= 3); | 72 DCHECK(node->InputCount() >= 3); |
72 node->set_op(common->EffectPhi(2)); | |
73 node->ReplaceInput(0, te); | 73 node->ReplaceInput(0, te); |
74 node->ReplaceInput(1, fe); | 74 node->ReplaceInput(1, fe); |
75 node->ReplaceInput(2, merge); | 75 node->ReplaceInput(2, merge); |
76 node->TrimInputCount(3); | 76 node->TrimInputCount(3); |
| 77 NodeProperties::ChangeOp(node, common->EffectPhi(2)); |
77 } | 78 } |
78 }; | 79 }; |
79 } | 80 } |
80 } | 81 } |
81 } // namespace v8::internal::compiler | 82 } // namespace v8::internal::compiler |
82 | 83 |
83 #endif // V8_COMPILER_DIAMOND_H_ | 84 #endif // V8_COMPILER_DIAMOND_H_ |
OLD | NEW |