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

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

Issue 2649703002: [Atomics] Make Atomics.compareExchange a builtin using TF (Closed)
Patch Set: rebase and move cmpxchg to builtins-sharedarraybuffer-gen.cc Created 3 years, 9 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 MachineType AtomicExchangeRepresentationOf(Operator const* op) { 83 MachineType AtomicExchangeRepresentationOf(Operator const* op) {
84 DCHECK_EQ(IrOpcode::kAtomicExchange, op->opcode()); 84 DCHECK_EQ(IrOpcode::kAtomicExchange, op->opcode());
85 return OpParameter<MachineType>(op); 85 return OpParameter<MachineType>(op);
86 } 86 }
87 87
88 MachineType AtomicCompareExchangeRepresentationOf(Operator const* op) {
89 DCHECK_EQ(IrOpcode::kAtomicCompareExchange, op->opcode());
90 return OpParameter<MachineType>(op);
91 }
92
88 #define PURE_BINARY_OP_LIST_32(V) \ 93 #define PURE_BINARY_OP_LIST_32(V) \
89 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 94 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
90 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 95 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
91 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 96 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
92 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ 97 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \
93 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ 98 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \
94 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ 99 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \
95 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ 100 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \
96 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ 101 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \
97 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 102 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 AtomicExchange##Type##Operator() \ 605 AtomicExchange##Type##Operator() \
601 : Operator1<MachineType>(IrOpcode::kAtomicExchange, \ 606 : Operator1<MachineType>(IrOpcode::kAtomicExchange, \
602 Operator::kNoDeopt | Operator::kNoThrow, \ 607 Operator::kNoDeopt | Operator::kNoThrow, \
603 "AtomicExchange", 3, 1, 1, 1, 1, 0, \ 608 "AtomicExchange", 3, 1, 1, 1, 1, 0, \
604 MachineType::Type()) {} \ 609 MachineType::Type()) {} \
605 }; \ 610 }; \
606 AtomicExchange##Type##Operator kAtomicExchange##Type; 611 AtomicExchange##Type##Operator kAtomicExchange##Type;
607 ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) 612 ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE)
608 #undef ATOMIC_EXCHANGE 613 #undef ATOMIC_EXCHANGE
609 614
615 #define ATOMIC_COMPARE_EXCHANGE(Type) \
616 struct AtomicCompareExchange##Type##Operator \
617 : public Operator1<MachineType> { \
618 AtomicCompareExchange##Type##Operator() \
619 : Operator1<MachineType>(IrOpcode::kAtomicCompareExchange, \
620 Operator::kNoDeopt | Operator::kNoThrow, \
621 "AtomicCompareExchange", 4, 1, 1, 1, 1, 0, \
622 MachineType::Type()) {} \
623 }; \
624 AtomicCompareExchange##Type##Operator kAtomicCompareExchange##Type;
625 ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
626 #undef ATOMIC_COMPARE_EXCHANGE
627
610 // The {BitcastWordToTagged} operator must not be marked as pure (especially 628 // The {BitcastWordToTagged} operator must not be marked as pure (especially
611 // not idempotent), because otherwise the splitting logic in the Scheduler 629 // not idempotent), because otherwise the splitting logic in the Scheduler
612 // might decide to split these operators, thus potentially creating live 630 // might decide to split these operators, thus potentially creating live
613 // ranges of allocation top across calls or other things that might allocate. 631 // ranges of allocation top across calls or other things that might allocate.
614 // See https://bugs.chromium.org/p/v8/issues/detail?id=6059 for more details. 632 // See https://bugs.chromium.org/p/v8/issues/detail?id=6059 for more details.
615 struct BitcastWordToTaggedOperator : public Operator { 633 struct BitcastWordToTaggedOperator : public Operator {
616 BitcastWordToTaggedOperator() 634 BitcastWordToTaggedOperator()
617 : Operator(IrOpcode::kBitcastWordToTagged, 635 : Operator(IrOpcode::kBitcastWordToTagged,
618 Operator::kEliminatable | Operator::kNoWrite, 636 Operator::kEliminatable | Operator::kNoWrite,
619 "BitcastWordToTagged", 1, 0, 0, 1, 0, 0) {} 637 "BitcastWordToTagged", 1, 0, 0, 1, 0, 0) {}
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 #define EXCHANGE(kRep) \ 885 #define EXCHANGE(kRep) \
868 if (rep == MachineType::kRep()) { \ 886 if (rep == MachineType::kRep()) { \
869 return &cache_.kAtomicExchange##kRep; \ 887 return &cache_.kAtomicExchange##kRep; \
870 } 888 }
871 ATOMIC_TYPE_LIST(EXCHANGE) 889 ATOMIC_TYPE_LIST(EXCHANGE)
872 #undef EXCHANGE 890 #undef EXCHANGE
873 UNREACHABLE(); 891 UNREACHABLE();
874 return nullptr; 892 return nullptr;
875 } 893 }
876 894
895 const Operator* MachineOperatorBuilder::AtomicCompareExchange(MachineType rep) {
896 #define COMPARE_EXCHANGE(kRep) \
897 if (rep == MachineType::kRep()) { \
898 return &cache_.kAtomicCompareExchange##kRep; \
899 }
900 ATOMIC_TYPE_LIST(COMPARE_EXCHANGE)
901 #undef COMPARE_EXCHANGE
902 UNREACHABLE();
903 return nullptr;
904 }
905
877 #define SIMD_LANE_OPS(Type, lane_count) \ 906 #define SIMD_LANE_OPS(Type, lane_count) \
878 const Operator* MachineOperatorBuilder::Type##ExtractLane( \ 907 const Operator* MachineOperatorBuilder::Type##ExtractLane( \
879 int32_t lane_index) { \ 908 int32_t lane_index) { \
880 DCHECK(0 <= lane_index && lane_index < lane_count); \ 909 DCHECK(0 <= lane_index && lane_index < lane_count); \
881 return new (zone_) \ 910 return new (zone_) \
882 Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \ 911 Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \
883 "Extract lane", 1, 0, 0, 1, 0, 0, lane_index); \ 912 "Extract lane", 1, 0, 0, 1, 0, 0, lane_index); \
884 } \ 913 } \
885 const Operator* MachineOperatorBuilder::Type##ReplaceLane( \ 914 const Operator* MachineOperatorBuilder::Type##ReplaceLane( \
886 int32_t lane_index) { \ 915 int32_t lane_index) { \
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 return new (zone_) \ 953 return new (zone_) \
925 Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \ 954 Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \
926 "Swizzle", 2, 0, 0, 1, 0, 0, swizzle); \ 955 "Swizzle", 2, 0, 0, 1, 0, 0, swizzle); \
927 } 956 }
928 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS) 957 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS)
929 #undef SIMD_PERMUTE_OPS 958 #undef SIMD_PERMUTE_OPS
930 959
931 } // namespace compiler 960 } // namespace compiler
932 } // namespace internal 961 } // namespace internal
933 } // namespace v8 962 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698