Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: src/compiler/machine-operator.cc

Issue 1128133003: [turbofan] Make an OptionalOperator for MachineOperatorBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/machine-operator.h" 5 #include "src/compiler/machine-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
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 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1) \ 115 V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1) \
116 V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1) \ 116 V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
117 V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1) \ 117 V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1) \
118 V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 0, 1) \ 118 V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 0, 1) \
119 V(TruncateFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \ 119 V(TruncateFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \
120 V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 0, 1) \ 120 V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 0, 1) \
121 V(Float32Add, Operator::kCommutative, 2, 0, 1) \ 121 V(Float32Add, Operator::kCommutative, 2, 0, 1) \
122 V(Float32Sub, Operator::kNoProperties, 2, 0, 1) \ 122 V(Float32Sub, Operator::kNoProperties, 2, 0, 1) \
123 V(Float32Mul, Operator::kCommutative, 2, 0, 1) \ 123 V(Float32Mul, Operator::kCommutative, 2, 0, 1) \
124 V(Float32Div, Operator::kNoProperties, 2, 0, 1) \ 124 V(Float32Div, Operator::kNoProperties, 2, 0, 1) \
125 V(Float32Abs, Operator::kNoProperties, 1, 0, 1) \
126 V(Float32Sqrt, Operator::kNoProperties, 1, 0, 1) \ 125 V(Float32Sqrt, Operator::kNoProperties, 1, 0, 1) \
127 V(Float64Add, Operator::kCommutative, 2, 0, 1) \ 126 V(Float64Add, Operator::kCommutative, 2, 0, 1) \
128 V(Float64Sub, Operator::kNoProperties, 2, 0, 1) \ 127 V(Float64Sub, Operator::kNoProperties, 2, 0, 1) \
129 V(Float64Mul, Operator::kCommutative, 2, 0, 1) \ 128 V(Float64Mul, Operator::kCommutative, 2, 0, 1) \
130 V(Float64Div, Operator::kNoProperties, 2, 0, 1) \ 129 V(Float64Div, Operator::kNoProperties, 2, 0, 1) \
131 V(Float64Mod, Operator::kNoProperties, 2, 0, 1) \ 130 V(Float64Mod, Operator::kNoProperties, 2, 0, 1) \
132 V(Float64Abs, Operator::kNoProperties, 1, 0, 1) \
133 V(Float64Sqrt, Operator::kNoProperties, 1, 0, 1) \ 131 V(Float64Sqrt, Operator::kNoProperties, 1, 0, 1) \
134 V(Float64RoundDown, Operator::kNoProperties, 1, 0, 1) \
135 V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
136 V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \
137 V(Float32Equal, Operator::kCommutative, 2, 0, 1) \ 132 V(Float32Equal, Operator::kCommutative, 2, 0, 1) \
138 V(Float32LessThan, Operator::kNoProperties, 2, 0, 1) \ 133 V(Float32LessThan, Operator::kNoProperties, 2, 0, 1) \
139 V(Float32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 134 V(Float32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
140 V(Float64Equal, Operator::kCommutative, 2, 0, 1) \ 135 V(Float64Equal, Operator::kCommutative, 2, 0, 1) \
141 V(Float64LessThan, Operator::kNoProperties, 2, 0, 1) \ 136 V(Float64LessThan, Operator::kNoProperties, 2, 0, 1) \
142 V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 137 V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
143 V(Float64ExtractLowWord32, Operator::kNoProperties, 1, 0, 1) \ 138 V(Float64ExtractLowWord32, Operator::kNoProperties, 1, 0, 1) \
144 V(Float64ExtractHighWord32, Operator::kNoProperties, 1, 0, 1) \ 139 V(Float64ExtractHighWord32, Operator::kNoProperties, 1, 0, 1) \
145 V(Float64InsertLowWord32, Operator::kNoProperties, 2, 0, 1) \ 140 V(Float64InsertLowWord32, Operator::kNoProperties, 2, 0, 1) \
146 V(Float64InsertHighWord32, Operator::kNoProperties, 2, 0, 1) \ 141 V(Float64InsertHighWord32, Operator::kNoProperties, 2, 0, 1) \
147 V(Float32Max, Operator::kNoProperties, 2, 0, 1) \
148 V(Float32Min, Operator::kNoProperties, 2, 0, 1) \
149 V(Float64Max, Operator::kNoProperties, 2, 0, 1) \
150 V(Float64Min, Operator::kNoProperties, 2, 0, 1) \
151 V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1) 142 V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1)
152 143
144 #define PURE_OPTIONAL_OP_LIST(V) \
145 V(Float32Max, Operator::kNoProperties, 2, 0, 1) \
146 V(Float32Min, Operator::kNoProperties, 2, 0, 1) \
147 V(Float64Max, Operator::kNoProperties, 2, 0, 1) \
148 V(Float64Min, Operator::kNoProperties, 2, 0, 1) \
149 V(Float32Abs, Operator::kNoProperties, 1, 0, 1) \
150 V(Float64Abs, Operator::kNoProperties, 1, 0, 1) \
151 V(Float64RoundDown, Operator::kNoProperties, 1, 0, 1) \
152 V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
153 V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1)
154
153 155
154 #define MACHINE_TYPE_LIST(V) \ 156 #define MACHINE_TYPE_LIST(V) \
155 V(MachFloat32) \ 157 V(MachFloat32) \
156 V(MachFloat64) \ 158 V(MachFloat64) \
157 V(MachInt8) \ 159 V(MachInt8) \
158 V(MachUint8) \ 160 V(MachUint8) \
159 V(MachInt16) \ 161 V(MachInt16) \
160 V(MachUint16) \ 162 V(MachUint16) \
161 V(MachInt32) \ 163 V(MachInt32) \
162 V(MachUint32) \ 164 V(MachUint32) \
(...skipping 14 matching lines...) Expand all
177 #define PURE(Name, properties, value_input_count, control_input_count, \ 179 #define PURE(Name, properties, value_input_count, control_input_count, \
178 output_count) \ 180 output_count) \
179 struct Name##Operator final : public Operator { \ 181 struct Name##Operator final : public Operator { \
180 Name##Operator() \ 182 Name##Operator() \
181 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ 183 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
182 value_input_count, 0, control_input_count, output_count, 0, \ 184 value_input_count, 0, control_input_count, output_count, 0, \
183 0) {} \ 185 0) {} \
184 }; \ 186 }; \
185 Name##Operator k##Name; 187 Name##Operator k##Name;
186 PURE_OP_LIST(PURE) 188 PURE_OP_LIST(PURE)
189 PURE_OPTIONAL_OP_LIST(PURE)
187 #undef PURE 190 #undef PURE
188 191
189 #define LOAD(Type) \ 192 #define LOAD(Type) \
190 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \ 193 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \
191 Load##Type##Operator() \ 194 Load##Type##Operator() \
192 : Operator1<LoadRepresentation>( \ 195 : Operator1<LoadRepresentation>( \
193 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \ 196 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
194 "Load", 2, 1, 1, 1, 1, 0, k##Type) {} \ 197 "Load", 2, 1, 1, 1, 1, 0, k##Type) {} \
195 }; \ 198 }; \
196 struct CheckedLoad##Type##Operator final \ 199 struct CheckedLoad##Type##Operator final \
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 DCHECK(word == kRepWord32 || word == kRepWord64); 251 DCHECK(word == kRepWord32 || word == kRepWord64);
249 } 252 }
250 253
251 254
252 #define PURE(Name, properties, value_input_count, control_input_count, \ 255 #define PURE(Name, properties, value_input_count, control_input_count, \
253 output_count) \ 256 output_count) \
254 const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; } 257 const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; }
255 PURE_OP_LIST(PURE) 258 PURE_OP_LIST(PURE)
256 #undef PURE 259 #undef PURE
257 260
261 #define PURE(Name, properties, value_input_count, control_input_count, \
262 output_count) \
263 const OptionalOperator MachineOperatorBuilder::Name() { \
264 return OptionalOperator(flags_ & k##Name ? &cache_.k##Name : nullptr); \
265 }
266 PURE_OPTIONAL_OP_LIST(PURE)
267 #undef PURE
258 268
259 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) { 269 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
260 switch (rep) { 270 switch (rep) {
261 #define LOAD(Type) \ 271 #define LOAD(Type) \
262 case k##Type: \ 272 case k##Type: \
263 return &cache_.kLoad##Type; 273 return &cache_.kLoad##Type;
264 MACHINE_TYPE_LIST(LOAD) 274 MACHINE_TYPE_LIST(LOAD)
265 #undef LOAD 275 #undef LOAD
266 default: 276 default:
267 break; 277 break;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 338 }
329 // Uncached. 339 // Uncached.
330 return new (zone_) Operator1<CheckedStoreRepresentation>( 340 return new (zone_) Operator1<CheckedStoreRepresentation>(
331 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, 341 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow,
332 "CheckedStore", 4, 1, 1, 0, 1, 0, rep); 342 "CheckedStore", 4, 1, 1, 0, 1, 0, rep);
333 } 343 }
334 344
335 } // namespace compiler 345 } // namespace compiler
336 } // namespace internal 346 } // namespace internal
337 } // namespace v8 347 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698