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_PROPERTIES_INL_H_ | 5 #ifndef V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ |
6 #define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | 6 #define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 op->opcode() == IrOpcode::kFinish || | 107 op->opcode() == IrOpcode::kFinish || |
108 op->opcode() == IrOpcode::kTerminate) { | 108 op->opcode() == IrOpcode::kTerminate) { |
109 return OpParameter<int>(op); | 109 return OpParameter<int>(op); |
110 } | 110 } |
111 if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite)) | 111 if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite)) |
112 return 0; // no effects. | 112 return 0; // no effects. |
113 return 1; | 113 return 1; |
114 } | 114 } |
115 | 115 |
116 inline int OperatorProperties::GetControlInputCount(const Operator* op) { | 116 inline int OperatorProperties::GetControlInputCount(const Operator* op) { |
| 117 // TODO(titzer): fix this mess; just make them a count on the operator. |
117 switch (op->opcode()) { | 118 switch (op->opcode()) { |
118 case IrOpcode::kPhi: | 119 case IrOpcode::kPhi: |
119 case IrOpcode::kEffectPhi: | 120 case IrOpcode::kEffectPhi: |
120 case IrOpcode::kLoad: | 121 case IrOpcode::kLoad: |
121 case IrOpcode::kLoadElement: | 122 case IrOpcode::kLoadElement: |
122 case IrOpcode::kLoadField: | 123 case IrOpcode::kLoadField: |
123 return 1; | 124 return 1; |
124 #define OPCODE_CASE(x) case IrOpcode::k##x: | 125 #define OPCODE_CASE(x) case IrOpcode::k##x: |
125 CONTROL_OP_LIST(OPCODE_CASE) | 126 CONTROL_OP_LIST(OPCODE_CASE) |
126 #undef OPCODE_CASE | 127 #undef OPCODE_CASE |
127 // Branch operator is special | |
128 if (op->opcode() == IrOpcode::kBranch) return 1; | 128 if (op->opcode() == IrOpcode::kBranch) return 1; |
| 129 if (op->opcode() == IrOpcode::kTerminate) return 1; |
129 // Control operators are Operator1<int>. | 130 // Control operators are Operator1<int>. |
130 return OpParameter<int>(op); | 131 return OpParameter<int>(op); |
131 default: | 132 default: |
132 // Operators that have write effects must have a control | 133 // Operators that have write effects must have a control |
133 // dependency. Effect dependencies only ensure the correct order of | 134 // dependency. Effect dependencies only ensure the correct order of |
134 // write/read operations without consideration of control flow. Without an | 135 // write/read operations without consideration of control flow. Without an |
135 // explicit control dependency writes can be float in the schedule too | 136 // explicit control dependency writes can be float in the schedule too |
136 // early along a path that shouldn't generate a side-effect. | 137 // early along a path that shouldn't generate a side-effect. |
137 return op->HasProperty(Operator::kNoWrite) ? 0 : 1; | 138 return op->HasProperty(Operator::kNoWrite) ? 0 : 1; |
138 } | 139 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | 186 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || |
186 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | 187 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || |
187 opcode == IrOpcode::kIfFalse; | 188 opcode == IrOpcode::kIfFalse; |
188 } | 189 } |
189 | 190 |
190 } // namespace compiler | 191 } // namespace compiler |
191 } // namespace internal | 192 } // namespace internal |
192 } // namespace v8 | 193 } // namespace v8 |
193 | 194 |
194 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | 195 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ |
OLD | NEW |