| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite)) | 110 if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite)) |
| 111 return 0; // no effects. | 111 return 0; // no effects. |
| 112 return 1; | 112 return 1; |
| 113 } | 113 } |
| 114 | 114 |
| 115 inline int OperatorProperties::GetControlInputCount(const Operator* op) { | 115 inline int OperatorProperties::GetControlInputCount(const Operator* op) { |
| 116 switch (op->opcode()) { | 116 switch (op->opcode()) { |
| 117 case IrOpcode::kPhi: | 117 case IrOpcode::kPhi: |
| 118 case IrOpcode::kEffectPhi: | 118 case IrOpcode::kEffectPhi: |
| 119 case IrOpcode::kControlEffect: | 119 case IrOpcode::kLoad: |
| 120 case IrOpcode::kLoadElement: |
| 120 return 1; | 121 return 1; |
| 121 #define OPCODE_CASE(x) case IrOpcode::k##x: | 122 #define OPCODE_CASE(x) case IrOpcode::k##x: |
| 122 CONTROL_OP_LIST(OPCODE_CASE) | 123 CONTROL_OP_LIST(OPCODE_CASE) |
| 123 #undef OPCODE_CASE | 124 #undef OPCODE_CASE |
| 124 // Control operators are Operator1<int>. | 125 // Control operators are Operator1<int>. |
| 125 return OpParameter<int>(op); | 126 return OpParameter<int>(op); |
| 126 default: | 127 default: |
| 127 // Operators that have write effects must have a control | 128 // Operators that have write effects must have a control |
| 128 // dependency. Effect dependencies only ensure the correct order of | 129 // dependency. Effect dependencies only ensure the correct order of |
| 129 // write/read operations without consideration of control flow. Without an | 130 // write/read operations without consideration of control flow. Without an |
| (...skipping 12 matching lines...) Expand all Loading... |
| 142 | 143 |
| 143 // ----------------------------------------------------------------------------- | 144 // ----------------------------------------------------------------------------- |
| 144 // Output properties. | 145 // Output properties. |
| 145 | 146 |
| 146 inline bool OperatorProperties::HasValueOutput(const Operator* op) { | 147 inline bool OperatorProperties::HasValueOutput(const Operator* op) { |
| 147 return GetValueOutputCount(op) > 0; | 148 return GetValueOutputCount(op) > 0; |
| 148 } | 149 } |
| 149 | 150 |
| 150 inline bool OperatorProperties::HasEffectOutput(const Operator* op) { | 151 inline bool OperatorProperties::HasEffectOutput(const Operator* op) { |
| 151 return op->opcode() == IrOpcode::kStart || | 152 return op->opcode() == IrOpcode::kStart || |
| 152 op->opcode() == IrOpcode::kControlEffect || | |
| 153 op->opcode() == IrOpcode::kValueEffect || | 153 op->opcode() == IrOpcode::kValueEffect || |
| 154 (op->opcode() != IrOpcode::kFinish && GetEffectInputCount(op) > 0); | 154 (op->opcode() != IrOpcode::kFinish && GetEffectInputCount(op) > 0); |
| 155 } | 155 } |
| 156 | 156 |
| 157 inline bool OperatorProperties::HasControlOutput(const Operator* op) { | 157 inline bool OperatorProperties::HasControlOutput(const Operator* op) { |
| 158 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); | 158 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); |
| 159 return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode)); | 159 return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 | 162 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 180 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | 180 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || |
| 181 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | 181 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || |
| 182 opcode == IrOpcode::kIfFalse; | 182 opcode == IrOpcode::kIfFalse; |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace compiler | 185 } // namespace compiler |
| 186 } // namespace internal | 186 } // namespace internal |
| 187 } // namespace v8 | 187 } // namespace v8 |
| 188 | 188 |
| 189 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | 189 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ |
| OLD | NEW |