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 27 matching lines...) Expand all Loading... |
38 // Binary operations | 38 // Binary operations |
39 case IrOpcode::kJSAdd: | 39 case IrOpcode::kJSAdd: |
40 case IrOpcode::kJSSubtract: | 40 case IrOpcode::kJSSubtract: |
41 case IrOpcode::kJSMultiply: | 41 case IrOpcode::kJSMultiply: |
42 case IrOpcode::kJSDivide: | 42 case IrOpcode::kJSDivide: |
43 case IrOpcode::kJSModulus: | 43 case IrOpcode::kJSModulus: |
44 | 44 |
45 // Compare operations | 45 // Compare operations |
46 case IrOpcode::kJSEqual: | 46 case IrOpcode::kJSEqual: |
47 case IrOpcode::kJSNotEqual: | 47 case IrOpcode::kJSNotEqual: |
| 48 case IrOpcode::kJSGreaterThan: |
| 49 case IrOpcode::kJSGreaterThanOrEqual: |
| 50 case IrOpcode::kJSLessThan: |
| 51 case IrOpcode::kJSLessThanOrEqual: |
48 case IrOpcode::kJSHasProperty: | 52 case IrOpcode::kJSHasProperty: |
49 case IrOpcode::kJSInstanceOf: | 53 case IrOpcode::kJSInstanceOf: |
50 | 54 |
51 // Object operations | 55 // Object operations |
52 case IrOpcode::kJSCreate: | 56 case IrOpcode::kJSCreate: |
53 case IrOpcode::kJSCreateArguments: | 57 case IrOpcode::kJSCreateArguments: |
54 case IrOpcode::kJSCreateArray: | 58 case IrOpcode::kJSCreateArray: |
55 case IrOpcode::kJSCreateLiteralArray: | 59 case IrOpcode::kJSCreateLiteralArray: |
56 case IrOpcode::kJSCreateLiteralObject: | 60 case IrOpcode::kJSCreateLiteralObject: |
57 case IrOpcode::kJSCreateLiteralRegExp: | 61 case IrOpcode::kJSCreateLiteralRegExp: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // as a result of lazy deopt in ToNumber conversion) need a second frame | 95 // as a result of lazy deopt in ToNumber conversion) need a second frame |
92 // state so that we can resume before the operation. | 96 // state so that we can resume before the operation. |
93 case IrOpcode::kJSBitwiseAnd: | 97 case IrOpcode::kJSBitwiseAnd: |
94 case IrOpcode::kJSBitwiseOr: | 98 case IrOpcode::kJSBitwiseOr: |
95 case IrOpcode::kJSBitwiseXor: | 99 case IrOpcode::kJSBitwiseXor: |
96 case IrOpcode::kJSShiftLeft: | 100 case IrOpcode::kJSShiftLeft: |
97 case IrOpcode::kJSShiftRight: | 101 case IrOpcode::kJSShiftRight: |
98 case IrOpcode::kJSShiftRightLogical: | 102 case IrOpcode::kJSShiftRightLogical: |
99 return 2; | 103 return 2; |
100 | 104 |
101 // Compare operators that can deopt in the middle the operation (e.g., | |
102 // as a result of lazy deopt in ToNumber conversion) need a second frame | |
103 // state so that we can resume before the operation. | |
104 case IrOpcode::kJSGreaterThan: | |
105 case IrOpcode::kJSGreaterThanOrEqual: | |
106 case IrOpcode::kJSLessThan: | |
107 case IrOpcode::kJSLessThanOrEqual: | |
108 return 2; | |
109 | |
110 default: | 105 default: |
111 return 0; | 106 return 0; |
112 } | 107 } |
113 } | 108 } |
114 | 109 |
115 | 110 |
116 // static | 111 // static |
117 int OperatorProperties::GetTotalInputCount(const Operator* op) { | 112 int OperatorProperties::GetTotalInputCount(const Operator* op) { |
118 return op->ValueInputCount() + GetContextInputCount(op) + | 113 return op->ValueInputCount() + GetContextInputCount(op) + |
119 GetFrameStateInputCount(op) + op->EffectInputCount() + | 114 GetFrameStateInputCount(op) + op->EffectInputCount() + |
120 op->ControlInputCount(); | 115 op->ControlInputCount(); |
121 } | 116 } |
122 | 117 |
123 | 118 |
124 // static | 119 // static |
125 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { | 120 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { |
126 Operator::Opcode const opcode = op->opcode(); | 121 Operator::Opcode const opcode = op->opcode(); |
127 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || | 122 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || |
128 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | 123 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || |
129 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | 124 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || |
130 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || | 125 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || |
131 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || | 126 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || |
132 opcode == IrOpcode::kIfDefault; | 127 opcode == IrOpcode::kIfDefault; |
133 } | 128 } |
134 | 129 |
135 } // namespace compiler | 130 } // namespace compiler |
136 } // namespace internal | 131 } // namespace internal |
137 } // namespace v8 | 132 } // namespace v8 |
OLD | NEW |