| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/compiler/operator-properties.h" |
| 6 #define V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | |
| 7 | 6 |
| 8 #include "src/compiler/common-operator.h" | |
| 9 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 10 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 11 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
| 12 #include "src/compiler/operator-properties.h" | |
| 13 | 10 |
| 14 namespace v8 { | 11 namespace v8 { |
| 15 namespace internal { | 12 namespace internal { |
| 16 namespace compiler { | 13 namespace compiler { |
| 17 | 14 |
| 18 inline bool OperatorProperties::HasContextInput(const Operator* op) { | 15 // static |
| 16 bool OperatorProperties::HasContextInput(const Operator* op) { |
| 19 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); | 17 IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode()); |
| 20 return IrOpcode::IsJsOpcode(opcode); | 18 return IrOpcode::IsJsOpcode(opcode); |
| 21 } | 19 } |
| 22 | 20 |
| 23 inline bool OperatorProperties::HasFrameStateInput(const Operator* op) { | 21 |
| 22 // static |
| 23 bool OperatorProperties::HasFrameStateInput(const Operator* op) { |
| 24 if (!FLAG_turbo_deoptimization) { | 24 if (!FLAG_turbo_deoptimization) { |
| 25 return false; | 25 return false; |
| 26 } | 26 } |
| 27 | |
| 28 switch (op->opcode()) { | 27 switch (op->opcode()) { |
| 29 case IrOpcode::kFrameState: | 28 case IrOpcode::kFrameState: |
| 30 return true; | 29 return true; |
| 31 case IrOpcode::kJSCallRuntime: { | 30 case IrOpcode::kJSCallRuntime: { |
| 32 const CallRuntimeParameters& p = CallRuntimeParametersOf(op); | 31 const CallRuntimeParameters& p = CallRuntimeParametersOf(op); |
| 33 return Linkage::NeedsFrameState(p.id()); | 32 return Linkage::NeedsFrameState(p.id()); |
| 34 } | 33 } |
| 35 | 34 |
| 36 // Strict equality cannot lazily deoptimize. | 35 // Strict equality cannot lazily deoptimize. |
| 37 case IrOpcode::kJSStrictEqual: | 36 case IrOpcode::kJSStrictEqual: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 73 |
| 75 // Other | 74 // Other |
| 76 case IrOpcode::kJSDeleteProperty: | 75 case IrOpcode::kJSDeleteProperty: |
| 77 return true; | 76 return true; |
| 78 | 77 |
| 79 default: | 78 default: |
| 80 return false; | 79 return false; |
| 81 } | 80 } |
| 82 } | 81 } |
| 83 | 82 |
| 84 inline int OperatorProperties::GetContextInputCount(const Operator* op) { | |
| 85 return OperatorProperties::HasContextInput(op) ? 1 : 0; | |
| 86 } | |
| 87 | 83 |
| 88 inline int OperatorProperties::GetFrameStateInputCount(const Operator* op) { | 84 // static |
| 89 return OperatorProperties::HasFrameStateInput(op) ? 1 : 0; | 85 int OperatorProperties::GetTotalInputCount(const Operator* op) { |
| 90 } | |
| 91 | |
| 92 inline int OperatorProperties::GetTotalInputCount(const Operator* op) { | |
| 93 return op->ValueInputCount() + GetContextInputCount(op) + | 86 return op->ValueInputCount() + GetContextInputCount(op) + |
| 94 GetFrameStateInputCount(op) + op->EffectInputCount() + | 87 GetFrameStateInputCount(op) + op->EffectInputCount() + |
| 95 op->ControlInputCount(); | 88 op->ControlInputCount(); |
| 96 } | 89 } |
| 97 | 90 |
| 98 // ----------------------------------------------------------------------------- | |
| 99 // Output properties. | |
| 100 | 91 |
| 101 inline bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { | 92 // static |
| 102 uint8_t opcode = op->opcode(); | 93 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { |
| 94 Operator::Opcode const opcode = op->opcode(); |
| 103 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || | 95 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || |
| 104 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | 96 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || |
| 105 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | 97 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || |
| 106 opcode == IrOpcode::kIfFalse; | 98 opcode == IrOpcode::kIfFalse; |
| 107 } | 99 } |
| 108 | 100 |
| 109 } // namespace compiler | 101 } // namespace compiler |
| 110 } // namespace internal | 102 } // namespace internal |
| 111 } // namespace v8 | 103 } // namespace v8 |
| 112 | |
| 113 #endif // V8_COMPILER_OPERATOR_PROPERTIES_INL_H_ | |
| OLD | NEW |