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

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

Issue 2624183002: [compiler] Allow for StackSlots of arbitrary size (Closed)
Patch Set: Address comments Created 3 years, 11 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
« no previous file with comments | « src/compiler/machine-operator.h ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode()); 63 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode());
64 return OpParameter<CheckedLoadRepresentation>(op); 64 return OpParameter<CheckedLoadRepresentation>(op);
65 } 65 }
66 66
67 67
68 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) { 68 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
69 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode()); 69 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode());
70 return OpParameter<CheckedStoreRepresentation>(op); 70 return OpParameter<CheckedStoreRepresentation>(op);
71 } 71 }
72 72
73 MachineRepresentation StackSlotRepresentationOf(Operator const* op) { 73 int StackSlotSizeOf(Operator const* op) {
74 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); 74 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode());
75 return OpParameter<MachineRepresentation>(op); 75 return OpParameter<int>(op);
76 } 76 }
77 77
78 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) { 78 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) {
79 DCHECK_EQ(IrOpcode::kAtomicStore, op->opcode()); 79 DCHECK_EQ(IrOpcode::kAtomicStore, op->opcode());
80 return OpParameter<MachineRepresentation>(op); 80 return OpParameter<MachineRepresentation>(op);
81 } 81 }
82 82
83 #define PURE_BINARY_OP_LIST_32(V) \ 83 #define PURE_BINARY_OP_LIST_32(V) \
84 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 84 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
85 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 85 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 V(Int16) \ 451 V(Int16) \
452 V(Uint16) \ 452 V(Uint16) \
453 V(Int32) \ 453 V(Int32) \
454 V(Uint32) 454 V(Uint32)
455 455
456 #define ATOMIC_REPRESENTATION_LIST(V) \ 456 #define ATOMIC_REPRESENTATION_LIST(V) \
457 V(kWord8) \ 457 V(kWord8) \
458 V(kWord16) \ 458 V(kWord16) \
459 V(kWord32) 459 V(kWord32)
460 460
461 #define STACK_SLOT_CACHED_SIZES_LIST(V) V(4) V(8) V(16)
462
463 struct StackSlotOperator : public Operator1<int> {
464 explicit StackSlotOperator(int size)
465 : Operator1<int>(IrOpcode::kStackSlot,
466 Operator::kNoDeopt | Operator::kNoThrow, "StackSlot", 0,
467 0, 0, 1, 0, 0, size) {}
468 };
469
461 struct MachineOperatorGlobalCache { 470 struct MachineOperatorGlobalCache {
462 #define PURE(Name, properties, value_input_count, control_input_count, \ 471 #define PURE(Name, properties, value_input_count, control_input_count, \
463 output_count) \ 472 output_count) \
464 struct Name##Operator final : public Operator { \ 473 struct Name##Operator final : public Operator { \
465 Name##Operator() \ 474 Name##Operator() \
466 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ 475 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
467 value_input_count, 0, control_input_count, output_count, 0, \ 476 value_input_count, 0, control_input_count, output_count, 0, \
468 0) {} \ 477 0) {} \
469 }; \ 478 }; \
470 Name##Operator k##Name; 479 Name##Operator k##Name;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 Operator::kNoDeopt | Operator::kNoThrow, "ProtectedLoad", 3, 1, \ 524 Operator::kNoDeopt | Operator::kNoThrow, "ProtectedLoad", 3, 1, \
516 1, 1, 1, 0, MachineType::Type()) {} \ 525 1, 1, 1, 0, MachineType::Type()) {} \
517 }; \ 526 }; \
518 Load##Type##Operator kLoad##Type; \ 527 Load##Type##Operator kLoad##Type; \
519 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \ 528 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \
520 CheckedLoad##Type##Operator kCheckedLoad##Type; \ 529 CheckedLoad##Type##Operator kCheckedLoad##Type; \
521 ProtectedLoad##Type##Operator kProtectedLoad##Type; 530 ProtectedLoad##Type##Operator kProtectedLoad##Type;
522 MACHINE_TYPE_LIST(LOAD) 531 MACHINE_TYPE_LIST(LOAD)
523 #undef LOAD 532 #undef LOAD
524 533
525 #define STACKSLOT(Type) \ 534 #define STACKSLOT(Size) \
526 struct StackSlot##Type##Operator final \ 535 struct StackSlotOfSize##Size##Operator final : public StackSlotOperator { \
527 : public Operator1<MachineRepresentation> { \ 536 StackSlotOfSize##Size##Operator() : StackSlotOperator(Size) {} \
528 StackSlot##Type##Operator() \ 537 }; \
529 : Operator1<MachineRepresentation>( \ 538 StackSlotOfSize##Size##Operator kStackSlotSize##Size;
530 IrOpcode::kStackSlot, Operator::kNoDeopt | Operator::kNoThrow, \ 539 STACK_SLOT_CACHED_SIZES_LIST(STACKSLOT)
531 "StackSlot", 0, 0, 0, 1, 0, 0, \
532 MachineType::Type().representation()) {} \
533 }; \
534 StackSlot##Type##Operator kStackSlot##Type;
535 MACHINE_TYPE_LIST(STACKSLOT)
536 #undef STACKSLOT 540 #undef STACKSLOT
537 541
538 #define STORE(Type) \ 542 #define STORE(Type) \
539 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ 543 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \
540 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ 544 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \
541 : Operator1<StoreRepresentation>( \ 545 : Operator1<StoreRepresentation>( \
542 IrOpcode::kStore, \ 546 IrOpcode::kStore, \
543 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ 547 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \
544 "Store", 3, 1, 1, 0, 1, 0, \ 548 "Store", 3, 1, 1, 0, 1, 0, \
545 StoreRepresentation(MachineRepresentation::Type, \ 549 StoreRepresentation(MachineRepresentation::Type, \
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 #define LOAD(Type) \ 732 #define LOAD(Type) \
729 if (rep == MachineType::Type()) { \ 733 if (rep == MachineType::Type()) { \
730 return &cache_.kProtectedLoad##Type; \ 734 return &cache_.kProtectedLoad##Type; \
731 } 735 }
732 MACHINE_TYPE_LIST(LOAD) 736 MACHINE_TYPE_LIST(LOAD)
733 #undef LOAD 737 #undef LOAD
734 UNREACHABLE(); 738 UNREACHABLE();
735 return nullptr; 739 return nullptr;
736 } 740 }
737 741
742 const Operator* MachineOperatorBuilder::StackSlot(int size) {
743 DCHECK_LE(0, size);
744 #define CASE_CACHED_SIZE(Size) \
745 case Size: \
746 return &cache_.kStackSlotSize##Size;
747 switch (size) {
748 STACK_SLOT_CACHED_SIZES_LIST(CASE_CACHED_SIZE);
749 default:
750 return new (zone_) StackSlotOperator(size);
751 }
752 #undef CASE_CACHED_SIZE
753 }
754
738 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) { 755 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) {
739 #define STACKSLOT(Type) \ 756 return StackSlot(1 << ElementSizeLog2Of(rep));
740 if (rep == MachineType::Type().representation()) { \
741 return &cache_.kStackSlot##Type; \
742 }
743 MACHINE_TYPE_LIST(STACKSLOT)
744 #undef STACKSLOT
745 UNREACHABLE();
746 return nullptr;
747 } 757 }
748 758
749 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) { 759 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
750 switch (store_rep.representation()) { 760 switch (store_rep.representation()) {
751 #define STORE(kRep) \ 761 #define STORE(kRep) \
752 case MachineRepresentation::kRep: \ 762 case MachineRepresentation::kRep: \
753 switch (store_rep.write_barrier_kind()) { \ 763 switch (store_rep.write_barrier_kind()) { \
754 case kNoWriteBarrier: \ 764 case kNoWriteBarrier: \
755 return &cache_.k##Store##kRep##NoWriteBarrier; \ 765 return &cache_.k##Store##kRep##NoWriteBarrier; \
756 case kMapWriteBarrier: \ 766 case kMapWriteBarrier: \
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 857 }
848 ATOMIC_REPRESENTATION_LIST(STORE) 858 ATOMIC_REPRESENTATION_LIST(STORE)
849 #undef STORE 859 #undef STORE
850 UNREACHABLE(); 860 UNREACHABLE();
851 return nullptr; 861 return nullptr;
852 } 862 }
853 863
854 } // namespace compiler 864 } // namespace compiler
855 } // namespace internal 865 } // namespace internal
856 } // namespace v8 866 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator.h ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698