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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_C(name) \ | 71 #define BINOP_C(name) \ |
72 SIMPLE(name, Operator::kCommutative | Operator::kPure, 2, 1) | 72 SIMPLE(name, Operator::kCommutative | Operator::kPure, 2, 1) |
73 #define BINOP_AC(name) \ | 73 #define BINOP_AC(name) \ |
74 SIMPLE(name, \ | 74 SIMPLE(name, \ |
75 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ | 75 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ |
76 1) | 76 1) |
| 77 #define BINOP_ACO(name) \ |
| 78 SIMPLE(name, \ |
| 79 Operator::kAssociative | Operator::kCommutative | Operator::kPure, 2, \ |
| 80 2) |
77 #define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1) | 81 #define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1) |
78 | 82 |
79 #define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x() | 83 #define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x() |
80 | 84 |
81 Operator* Load(MachineRepresentation rep) { // load [base + index] | 85 Operator* Load(MachineRepresentation rep) { // load [base + index] |
82 OP1(Load, MachineRepresentation, rep, Operator::kNoWrite, 2, 1); | 86 OP1(Load, MachineRepresentation, rep, Operator::kNoWrite, 2, 1); |
83 } | 87 } |
84 // store [base + index], value | 88 // store [base + index], value |
85 Operator* Store(MachineRepresentation rep, | 89 Operator* Store(MachineRepresentation rep, |
86 WriteBarrierKind kind = kNoWriteBarrier) { | 90 WriteBarrierKind kind = kNoWriteBarrier) { |
(...skipping 19 matching lines...) Expand all Loading... |
106 | 110 |
107 Operator* Word64And() { BINOP_AC(Word64And); } | 111 Operator* Word64And() { BINOP_AC(Word64And); } |
108 Operator* Word64Or() { BINOP_AC(Word64Or); } | 112 Operator* Word64Or() { BINOP_AC(Word64Or); } |
109 Operator* Word64Xor() { BINOP_AC(Word64Xor); } | 113 Operator* Word64Xor() { BINOP_AC(Word64Xor); } |
110 Operator* Word64Shl() { BINOP(Word64Shl); } | 114 Operator* Word64Shl() { BINOP(Word64Shl); } |
111 Operator* Word64Shr() { BINOP(Word64Shr); } | 115 Operator* Word64Shr() { BINOP(Word64Shr); } |
112 Operator* Word64Sar() { BINOP(Word64Sar); } | 116 Operator* Word64Sar() { BINOP(Word64Sar); } |
113 Operator* Word64Equal() { BINOP_C(Word64Equal); } | 117 Operator* Word64Equal() { BINOP_C(Word64Equal); } |
114 | 118 |
115 Operator* Int32Add() { BINOP_AC(Int32Add); } | 119 Operator* Int32Add() { BINOP_AC(Int32Add); } |
| 120 Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); } |
116 Operator* Int32Sub() { BINOP(Int32Sub); } | 121 Operator* Int32Sub() { BINOP(Int32Sub); } |
117 Operator* Int32Mul() { BINOP_AC(Int32Mul); } | 122 Operator* Int32Mul() { BINOP_AC(Int32Mul); } |
118 Operator* Int32Div() { BINOP(Int32Div); } | 123 Operator* Int32Div() { BINOP(Int32Div); } |
119 Operator* Int32UDiv() { BINOP(Int32UDiv); } | 124 Operator* Int32UDiv() { BINOP(Int32UDiv); } |
120 Operator* Int32Mod() { BINOP(Int32Mod); } | 125 Operator* Int32Mod() { BINOP(Int32Mod); } |
121 Operator* Int32UMod() { BINOP(Int32UMod); } | 126 Operator* Int32UMod() { BINOP(Int32UMod); } |
122 Operator* Int32LessThan() { BINOP(Int32LessThan); } | 127 Operator* Int32LessThan() { BINOP(Int32LessThan); } |
123 Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); } | 128 Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); } |
124 Operator* Uint32LessThan() { BINOP(Uint32LessThan); } | 129 Operator* Uint32LessThan() { BINOP(Uint32LessThan); } |
125 Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); } | 130 Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 180 |
176 private: | 181 private: |
177 Zone* zone_; | 182 Zone* zone_; |
178 MachineRepresentation word_; | 183 MachineRepresentation word_; |
179 }; | 184 }; |
180 } | 185 } |
181 } | 186 } |
182 } // namespace v8::internal::compiler | 187 } // namespace v8::internal::compiler |
183 | 188 |
184 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 189 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
OLD | NEW |