| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode()); | 84 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode()); |
| 85 return OpParameter<CheckedLoadRepresentation>(op); | 85 return OpParameter<CheckedLoadRepresentation>(op); |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) { | 89 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) { |
| 90 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode()); | 90 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode()); |
| 91 return OpParameter<CheckedStoreRepresentation>(op); | 91 return OpParameter<CheckedStoreRepresentation>(op); |
| 92 } | 92 } |
| 93 | 93 |
| 94 MachineRepresentation StackSlotRepresentationOf(Operator const* op) { | |
| 95 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); | |
| 96 return OpParameter<MachineRepresentation>(op); | |
| 97 } | |
| 98 | 94 |
| 99 #define PURE_OP_LIST(V) \ | 95 #define PURE_OP_LIST(V) \ |
| 100 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 96 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 101 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 97 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 102 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 98 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 103 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ | 99 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ |
| 104 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ | 100 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ |
| 105 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ | 101 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ |
| 106 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ | 102 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ |
| 107 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ | 103 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 CheckedLoad##Type##Operator() \ | 274 CheckedLoad##Type##Operator() \ |
| 279 : Operator1<CheckedLoadRepresentation>( \ | 275 : Operator1<CheckedLoadRepresentation>( \ |
| 280 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ | 276 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ |
| 281 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ | 277 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
| 282 }; \ | 278 }; \ |
| 283 Load##Type##Operator kLoad##Type; \ | 279 Load##Type##Operator kLoad##Type; \ |
| 284 CheckedLoad##Type##Operator kCheckedLoad##Type; | 280 CheckedLoad##Type##Operator kCheckedLoad##Type; |
| 285 MACHINE_TYPE_LIST(LOAD) | 281 MACHINE_TYPE_LIST(LOAD) |
| 286 #undef LOAD | 282 #undef LOAD |
| 287 | 283 |
| 288 #define STACKSLOT(Type) \ | |
| 289 struct StackSlot##Type##Operator final \ | |
| 290 : public Operator1<MachineRepresentation> { \ | |
| 291 StackSlot##Type##Operator() \ | |
| 292 : Operator1<MachineRepresentation>( \ | |
| 293 IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \ | |
| 294 1, 0, 0, MachineType::Type().representation()) {} \ | |
| 295 }; \ | |
| 296 StackSlot##Type##Operator kStackSlot##Type; | |
| 297 MACHINE_TYPE_LIST(STACKSLOT) | |
| 298 #undef STACKSLOT | |
| 299 | |
| 300 #define STORE(Type) \ | 284 #define STORE(Type) \ |
| 301 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ | 285 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ |
| 302 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ | 286 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ |
| 303 : Operator1<StoreRepresentation>( \ | 287 : Operator1<StoreRepresentation>( \ |
| 304 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ | 288 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ |
| 305 "Store", 3, 1, 1, 0, 1, 0, \ | 289 "Store", 3, 1, 1, 0, 1, 0, \ |
| 306 StoreRepresentation(MachineRepresentation::Type, \ | 290 StoreRepresentation(MachineRepresentation::Type, \ |
| 307 write_barrier_kind)) {} \ | 291 write_barrier_kind)) {} \ |
| 308 }; \ | 292 }; \ |
| 309 struct Store##Type##NoWriteBarrier##Operator final \ | 293 struct Store##Type##NoWriteBarrier##Operator final \ |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 #define LOAD(Type) \ | 374 #define LOAD(Type) \ |
| 391 if (rep == MachineType::Type()) { \ | 375 if (rep == MachineType::Type()) { \ |
| 392 return &cache_.kLoad##Type; \ | 376 return &cache_.kLoad##Type; \ |
| 393 } | 377 } |
| 394 MACHINE_TYPE_LIST(LOAD) | 378 MACHINE_TYPE_LIST(LOAD) |
| 395 #undef LOAD | 379 #undef LOAD |
| 396 UNREACHABLE(); | 380 UNREACHABLE(); |
| 397 return nullptr; | 381 return nullptr; |
| 398 } | 382 } |
| 399 | 383 |
| 400 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) { | |
| 401 #define STACKSLOT(Type) \ | |
| 402 if (rep == MachineType::Type().representation()) { \ | |
| 403 return &cache_.kStackSlot##Type; \ | |
| 404 } | |
| 405 MACHINE_TYPE_LIST(STACKSLOT) | |
| 406 #undef STACKSLOT | |
| 407 UNREACHABLE(); | |
| 408 return nullptr; | |
| 409 } | |
| 410 | 384 |
| 411 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) { | 385 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) { |
| 412 switch (store_rep.representation()) { | 386 switch (store_rep.representation()) { |
| 413 #define STORE(kRep) \ | 387 #define STORE(kRep) \ |
| 414 case MachineRepresentation::kRep: \ | 388 case MachineRepresentation::kRep: \ |
| 415 switch (store_rep.write_barrier_kind()) { \ | 389 switch (store_rep.write_barrier_kind()) { \ |
| 416 case kNoWriteBarrier: \ | 390 case kNoWriteBarrier: \ |
| 417 return &cache_.k##Store##kRep##NoWriteBarrier; \ | 391 return &cache_.k##Store##kRep##NoWriteBarrier; \ |
| 418 case kMapWriteBarrier: \ | 392 case kMapWriteBarrier: \ |
| 419 return &cache_.k##Store##kRep##MapWriteBarrier; \ | 393 return &cache_.k##Store##kRep##MapWriteBarrier; \ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 case MachineRepresentation::kNone: | 433 case MachineRepresentation::kNone: |
| 460 break; | 434 break; |
| 461 } | 435 } |
| 462 UNREACHABLE(); | 436 UNREACHABLE(); |
| 463 return nullptr; | 437 return nullptr; |
| 464 } | 438 } |
| 465 | 439 |
| 466 } // namespace compiler | 440 } // namespace compiler |
| 467 } // namespace internal | 441 } // namespace internal |
| 468 } // namespace v8 | 442 } // namespace v8 |
| OLD | NEW |