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/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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \ | 193 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \ |
194 "Load", 2, 1, 1, 1, 1, 0, k##Type) {} \ | 194 "Load", 2, 1, 1, 1, 1, 0, k##Type) {} \ |
195 }; \ | 195 }; \ |
196 struct CheckedLoad##Type##Operator final \ | 196 struct CheckedLoad##Type##Operator final \ |
197 : public Operator1<CheckedLoadRepresentation> { \ | 197 : public Operator1<CheckedLoadRepresentation> { \ |
198 CheckedLoad##Type##Operator() \ | 198 CheckedLoad##Type##Operator() \ |
199 : Operator1<CheckedLoadRepresentation>( \ | 199 : Operator1<CheckedLoadRepresentation>( \ |
200 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ | 200 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ |
201 "CheckedLoad", 3, 1, 1, 1, 1, 0, k##Type) {} \ | 201 "CheckedLoad", 3, 1, 1, 1, 1, 0, k##Type) {} \ |
202 }; \ | 202 }; \ |
| 203 struct LoadAtomic##Type##Operator final \ |
| 204 : public Operator1<LoadRepresentation> { \ |
| 205 LoadAtomic##Type##Operator() \ |
| 206 : Operator1<LoadRepresentation>( \ |
| 207 IrOpcode::kLoadAtomic, Operator::kNoThrow | Operator::kNoWrite, \ |
| 208 "LoadAtomic", 2, 1, 1, 1, 1, 0, k##Type) {} \ |
| 209 }; \ |
203 Load##Type##Operator kLoad##Type; \ | 210 Load##Type##Operator kLoad##Type; \ |
204 CheckedLoad##Type##Operator kCheckedLoad##Type; | 211 CheckedLoad##Type##Operator kCheckedLoad##Type; \ |
| 212 LoadAtomic##Type##Operator kLoadAtomic##Type; |
205 MACHINE_TYPE_LIST(LOAD) | 213 MACHINE_TYPE_LIST(LOAD) |
206 #undef LOAD | 214 #undef LOAD |
207 | 215 |
208 #define STORE(Type) \ | 216 #define STORE(Type) \ |
209 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ | 217 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ |
210 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ | 218 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ |
211 : Operator1<StoreRepresentation>( \ | 219 : Operator1<StoreRepresentation>( \ |
212 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ | 220 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ |
213 "Store", 3, 1, 1, 0, 1, 0, \ | 221 "Store", 3, 1, 1, 0, 1, 0, \ |
214 StoreRepresentation(k##Type, write_barrier_kind)) {} \ | 222 StoreRepresentation(k##Type, write_barrier_kind)) {} \ |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 default: | 274 default: |
267 break; | 275 break; |
268 } | 276 } |
269 // Uncached. | 277 // Uncached. |
270 return new (zone_) Operator1<LoadRepresentation>( // -- | 278 return new (zone_) Operator1<LoadRepresentation>( // -- |
271 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, "Load", 2, 1, 1, | 279 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, "Load", 2, 1, 1, |
272 1, 1, 0, rep); | 280 1, 1, 0, rep); |
273 } | 281 } |
274 | 282 |
275 | 283 |
| 284 const Operator* MachineOperatorBuilder::LoadAtomic(LoadRepresentation rep) { |
| 285 switch (rep) { |
| 286 #define LOAD(Type) \ |
| 287 case k##Type: \ |
| 288 return &cache_.kLoadAtomic##Type; |
| 289 MACHINE_TYPE_LIST(LOAD) |
| 290 #undef LOAD |
| 291 default: |
| 292 break; |
| 293 } |
| 294 // Uncached. |
| 295 return new (zone_) Operator1<LoadRepresentation>( // -- |
| 296 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, "LoadAtomic", 2, |
| 297 1, 1, 1, 1, 0, rep); |
| 298 } |
| 299 |
| 300 |
276 const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) { | 301 const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) { |
277 switch (rep.machine_type()) { | 302 switch (rep.machine_type()) { |
278 #define STORE(Type) \ | 303 #define STORE(Type) \ |
279 case k##Type: \ | 304 case k##Type: \ |
280 switch (rep.write_barrier_kind()) { \ | 305 switch (rep.write_barrier_kind()) { \ |
281 case kNoWriteBarrier: \ | 306 case kNoWriteBarrier: \ |
282 return &cache_.k##Store##Type##NoWriteBarrier; \ | 307 return &cache_.k##Store##Type##NoWriteBarrier; \ |
283 case kFullWriteBarrier: \ | 308 case kFullWriteBarrier: \ |
284 return &cache_.k##Store##Type##FullWriteBarrier; \ | 309 return &cache_.k##Store##Type##FullWriteBarrier; \ |
285 } \ | 310 } \ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 353 } |
329 // Uncached. | 354 // Uncached. |
330 return new (zone_) Operator1<CheckedStoreRepresentation>( | 355 return new (zone_) Operator1<CheckedStoreRepresentation>( |
331 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, | 356 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, |
332 "CheckedStore", 4, 1, 1, 0, 1, 0, rep); | 357 "CheckedStore", 4, 1, 1, 0, 1, 0, rep); |
333 } | 358 } |
334 | 359 |
335 } // namespace compiler | 360 } // namespace compiler |
336 } // namespace internal | 361 } // namespace internal |
337 } // namespace v8 | 362 } // namespace v8 |
OLD | NEW |