| OLD | NEW |
| 1 // Copyright 2014 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 #include "src/compiler/operator-properties.h" | 5 #include "src/compiler/operator-properties.h" |
| 6 | 6 |
| 7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 case IrOpcode::kJSStrictEqual: | 33 case IrOpcode::kJSStrictEqual: |
| 34 case IrOpcode::kJSStrictNotEqual: | 34 case IrOpcode::kJSStrictNotEqual: |
| 35 return 0; | 35 return 0; |
| 36 | 36 |
| 37 // Calls | 37 // Calls |
| 38 case IrOpcode::kJSCallFunction: | 38 case IrOpcode::kJSCallFunction: |
| 39 case IrOpcode::kJSCallConstruct: | 39 case IrOpcode::kJSCallConstruct: |
| 40 | 40 |
| 41 // Compare operations | 41 // Compare operations |
| 42 case IrOpcode::kJSEqual: | 42 case IrOpcode::kJSEqual: |
| 43 case IrOpcode::kJSGreaterThan: | 43 case IrOpcode::kJSNotEqual: |
| 44 case IrOpcode::kJSGreaterThanOrEqual: | |
| 45 case IrOpcode::kJSHasProperty: | 44 case IrOpcode::kJSHasProperty: |
| 46 case IrOpcode::kJSInstanceOf: | 45 case IrOpcode::kJSInstanceOf: |
| 47 case IrOpcode::kJSLessThan: | |
| 48 case IrOpcode::kJSLessThanOrEqual: | |
| 49 case IrOpcode::kJSNotEqual: | |
| 50 | 46 |
| 51 // Object operations | 47 // Object operations |
| 52 case IrOpcode::kJSCreateLiteralArray: | 48 case IrOpcode::kJSCreateLiteralArray: |
| 53 case IrOpcode::kJSCreateLiteralObject: | 49 case IrOpcode::kJSCreateLiteralObject: |
| 54 | 50 |
| 55 // Context operations | 51 // Context operations |
| 56 case IrOpcode::kJSCreateScriptContext: | 52 case IrOpcode::kJSCreateScriptContext: |
| 57 case IrOpcode::kJSCreateWithContext: | 53 case IrOpcode::kJSCreateWithContext: |
| 58 | 54 |
| 59 // Conversions | 55 // Conversions |
| (...skipping 26 matching lines...) Expand all Loading... |
| 86 case IrOpcode::kJSBitwiseOr: | 82 case IrOpcode::kJSBitwiseOr: |
| 87 case IrOpcode::kJSBitwiseXor: | 83 case IrOpcode::kJSBitwiseXor: |
| 88 case IrOpcode::kJSDivide: | 84 case IrOpcode::kJSDivide: |
| 89 case IrOpcode::kJSModulus: | 85 case IrOpcode::kJSModulus: |
| 90 case IrOpcode::kJSShiftLeft: | 86 case IrOpcode::kJSShiftLeft: |
| 91 case IrOpcode::kJSShiftRight: | 87 case IrOpcode::kJSShiftRight: |
| 92 case IrOpcode::kJSShiftRightLogical: | 88 case IrOpcode::kJSShiftRightLogical: |
| 93 case IrOpcode::kJSSubtract: | 89 case IrOpcode::kJSSubtract: |
| 94 return 2; | 90 return 2; |
| 95 | 91 |
| 92 // Compare operators that can deopt in the middle the operation (e.g., |
| 93 // as a result of lazy deopt in ToNumber conversion) need a second frame |
| 94 // state so that we can resume before the operation. |
| 95 case IrOpcode::kJSGreaterThan: |
| 96 case IrOpcode::kJSGreaterThanOrEqual: |
| 97 case IrOpcode::kJSLessThan: |
| 98 case IrOpcode::kJSLessThanOrEqual: |
| 99 return 2; |
| 100 |
| 96 default: | 101 default: |
| 97 return 0; | 102 return 0; |
| 98 } | 103 } |
| 99 } | 104 } |
| 100 | 105 |
| 101 | 106 |
| 102 // static | 107 // static |
| 103 int OperatorProperties::GetTotalInputCount(const Operator* op) { | 108 int OperatorProperties::GetTotalInputCount(const Operator* op) { |
| 104 return op->ValueInputCount() + GetContextInputCount(op) + | 109 return op->ValueInputCount() + GetContextInputCount(op) + |
| 105 GetFrameStateInputCount(op) + op->EffectInputCount() + | 110 GetFrameStateInputCount(op) + op->EffectInputCount() + |
| 106 op->ControlInputCount(); | 111 op->ControlInputCount(); |
| 107 } | 112 } |
| 108 | 113 |
| 109 | 114 |
| 110 // static | 115 // static |
| 111 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { | 116 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { |
| 112 Operator::Opcode const opcode = op->opcode(); | 117 Operator::Opcode const opcode = op->opcode(); |
| 113 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || | 118 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || |
| 114 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | 119 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || |
| 115 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | 120 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || |
| 116 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || | 121 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || |
| 117 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || | 122 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || |
| 118 opcode == IrOpcode::kIfDefault; | 123 opcode == IrOpcode::kIfDefault; |
| 119 } | 124 } |
| 120 | 125 |
| 121 } // namespace compiler | 126 } // namespace compiler |
| 122 } // namespace internal | 127 } // namespace internal |
| 123 } // namespace v8 | 128 } // namespace v8 |
| OLD | NEW |