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_MACHINE_OPERATOR_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ |
7 | 7 |
8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #define SIMPLE(name, properties, inputs, outputs) \ | 61 #define SIMPLE(name, properties, inputs, outputs) \ |
62 return new (zone_) \ | 62 return new (zone_) \ |
63 SimpleOperator(IrOpcode::k##name, properties, inputs, outputs, #name); | 63 SimpleOperator(IrOpcode::k##name, properties, inputs, outputs, #name); |
64 | 64 |
65 #define OP1(name, ptype, pname, properties, inputs, outputs) \ | 65 #define OP1(name, ptype, pname, properties, inputs, outputs) \ |
66 return new (zone_) \ | 66 return new (zone_) \ |
67 Operator1<ptype>(IrOpcode::k##name, properties | Operator::kNoThrow, \ | 67 Operator1<ptype>(IrOpcode::k##name, properties | Operator::kNoThrow, \ |
68 inputs, outputs, #name, pname) | 68 inputs, outputs, #name, pname) |
69 | 69 |
70 #define BINOP(name) SIMPLE(name, Operator::kPure, 2, 1) | 70 #define BINOP(name) SIMPLE(name, Operator::kPure, 2, 1) |
| 71 #define BINOP_O(name) SIMPLE(name, Operator::kPure, 2, 2) |
71 #define BINOP_C(name) \ | 72 #define BINOP_C(name) \ |
72 SIMPLE(name, Operator::kCommutative | Operator::kPure, 2, 1) | 73 SIMPLE(name, Operator::kCommutative | Operator::kPure, 2, 1) |
73 #define BINOP_AC(name) \ | 74 #define BINOP_AC(name) \ |
74 SIMPLE(name, \ | 75 SIMPLE(name, \ |
75 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ | 76 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ |
76 1) | 77 1) |
77 #define BINOP_ACO(name) \ | 78 #define BINOP_ACO(name) \ |
78 SIMPLE(name, \ | 79 SIMPLE(name, \ |
79 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ | 80 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ |
80 2) | 81 2) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Operator* Word64Or() { BINOP_AC(Word64Or); } | 113 Operator* Word64Or() { BINOP_AC(Word64Or); } |
113 Operator* Word64Xor() { BINOP_AC(Word64Xor); } | 114 Operator* Word64Xor() { BINOP_AC(Word64Xor); } |
114 Operator* Word64Shl() { BINOP(Word64Shl); } | 115 Operator* Word64Shl() { BINOP(Word64Shl); } |
115 Operator* Word64Shr() { BINOP(Word64Shr); } | 116 Operator* Word64Shr() { BINOP(Word64Shr); } |
116 Operator* Word64Sar() { BINOP(Word64Sar); } | 117 Operator* Word64Sar() { BINOP(Word64Sar); } |
117 Operator* Word64Equal() { BINOP_C(Word64Equal); } | 118 Operator* Word64Equal() { BINOP_C(Word64Equal); } |
118 | 119 |
119 Operator* Int32Add() { BINOP_AC(Int32Add); } | 120 Operator* Int32Add() { BINOP_AC(Int32Add); } |
120 Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); } | 121 Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); } |
121 Operator* Int32Sub() { BINOP(Int32Sub); } | 122 Operator* Int32Sub() { BINOP(Int32Sub); } |
| 123 Operator* Int32SubWithOverflow() { BINOP_O(Int32SubWithOverflow); } |
122 Operator* Int32Mul() { BINOP_AC(Int32Mul); } | 124 Operator* Int32Mul() { BINOP_AC(Int32Mul); } |
123 Operator* Int32Div() { BINOP(Int32Div); } | 125 Operator* Int32Div() { BINOP(Int32Div); } |
124 Operator* Int32UDiv() { BINOP(Int32UDiv); } | 126 Operator* Int32UDiv() { BINOP(Int32UDiv); } |
125 Operator* Int32Mod() { BINOP(Int32Mod); } | 127 Operator* Int32Mod() { BINOP(Int32Mod); } |
126 Operator* Int32UMod() { BINOP(Int32UMod); } | 128 Operator* Int32UMod() { BINOP(Int32UMod); } |
127 Operator* Int32LessThan() { BINOP(Int32LessThan); } | 129 Operator* Int32LessThan() { BINOP(Int32LessThan); } |
128 Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); } | 130 Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); } |
129 Operator* Uint32LessThan() { BINOP(Uint32LessThan); } | 131 Operator* Uint32LessThan() { BINOP(Uint32LessThan); } |
130 Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); } | 132 Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); } |
131 | 133 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 182 |
181 private: | 183 private: |
182 Zone* zone_; | 184 Zone* zone_; |
183 MachineRepresentation word_; | 185 MachineRepresentation word_; |
184 }; | 186 }; |
185 } | 187 } |
186 } | 188 } |
187 } // namespace v8::internal::compiler | 189 } // namespace v8::internal::compiler |
188 | 190 |
189 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 191 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |