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 24 matching lines...) Expand all Loading... |
35 case IrOpcode::kJSStrictNotEqual: | 35 case IrOpcode::kJSStrictNotEqual: |
36 return 0; | 36 return 0; |
37 | 37 |
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 // Bitwise operations |
| 46 case IrOpcode::kJSBitwiseOr: |
| 47 case IrOpcode::kJSBitwiseXor: |
| 48 case IrOpcode::kJSBitwiseAnd: |
| 49 |
45 // Shift operations | 50 // Shift operations |
46 case IrOpcode::kJSShiftLeft: | 51 case IrOpcode::kJSShiftLeft: |
47 case IrOpcode::kJSShiftRight: | 52 case IrOpcode::kJSShiftRight: |
48 case IrOpcode::kJSShiftRightLogical: | 53 case IrOpcode::kJSShiftRightLogical: |
49 | 54 |
50 // Compare operations | 55 // Compare operations |
51 case IrOpcode::kJSEqual: | 56 case IrOpcode::kJSEqual: |
52 case IrOpcode::kJSNotEqual: | 57 case IrOpcode::kJSNotEqual: |
53 case IrOpcode::kJSGreaterThan: | 58 case IrOpcode::kJSGreaterThan: |
54 case IrOpcode::kJSGreaterThanOrEqual: | 59 case IrOpcode::kJSGreaterThanOrEqual: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 case IrOpcode::kJSCallConstruct: | 94 case IrOpcode::kJSCallConstruct: |
90 case IrOpcode::kJSCallFunction: | 95 case IrOpcode::kJSCallFunction: |
91 | 96 |
92 // Misc operations | 97 // Misc operations |
93 case IrOpcode::kJSConvertReceiver: | 98 case IrOpcode::kJSConvertReceiver: |
94 case IrOpcode::kJSForInNext: | 99 case IrOpcode::kJSForInNext: |
95 case IrOpcode::kJSForInPrepare: | 100 case IrOpcode::kJSForInPrepare: |
96 case IrOpcode::kJSStackCheck: | 101 case IrOpcode::kJSStackCheck: |
97 return 1; | 102 return 1; |
98 | 103 |
99 // Binary operators that can deopt in the middle the operation (e.g., | |
100 // as a result of lazy deopt in ToNumber conversion) need a second frame | |
101 // state so that we can resume before the operation. | |
102 case IrOpcode::kJSBitwiseAnd: | |
103 case IrOpcode::kJSBitwiseOr: | |
104 case IrOpcode::kJSBitwiseXor: | |
105 return 2; | |
106 | |
107 default: | 104 default: |
108 return 0; | 105 return 0; |
109 } | 106 } |
110 } | 107 } |
111 | 108 |
112 | 109 |
113 // static | 110 // static |
114 int OperatorProperties::GetTotalInputCount(const Operator* op) { | 111 int OperatorProperties::GetTotalInputCount(const Operator* op) { |
115 return op->ValueInputCount() + GetContextInputCount(op) + | 112 return op->ValueInputCount() + GetContextInputCount(op) + |
116 GetFrameStateInputCount(op) + op->EffectInputCount() + | 113 GetFrameStateInputCount(op) + op->EffectInputCount() + |
117 op->ControlInputCount(); | 114 op->ControlInputCount(); |
118 } | 115 } |
119 | 116 |
120 | 117 |
121 // static | 118 // static |
122 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { | 119 bool OperatorProperties::IsBasicBlockBegin(const Operator* op) { |
123 Operator::Opcode const opcode = op->opcode(); | 120 Operator::Opcode const opcode = op->opcode(); |
124 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || | 121 return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd || |
125 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || | 122 opcode == IrOpcode::kDead || opcode == IrOpcode::kLoop || |
126 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || | 123 opcode == IrOpcode::kMerge || opcode == IrOpcode::kIfTrue || |
127 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || | 124 opcode == IrOpcode::kIfFalse || opcode == IrOpcode::kIfSuccess || |
128 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || | 125 opcode == IrOpcode::kIfException || opcode == IrOpcode::kIfValue || |
129 opcode == IrOpcode::kIfDefault; | 126 opcode == IrOpcode::kIfDefault; |
130 } | 127 } |
131 | 128 |
132 } // namespace compiler | 129 } // namespace compiler |
133 } // namespace internal | 130 } // namespace internal |
134 } // namespace v8 | 131 } // namespace v8 |
OLD | NEW |