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

Unified Diff: src/compiler/machine-operator.cc

Issue 680313003: Move input/output counts directly into Operators, simplying OperatorProperties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yes Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/machine-operator.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator.cc
diff --git a/src/compiler/machine-operator.cc b/src/compiler/machine-operator.cc
index 6e1180f9f5d6e9b5779d7a527a9c945cd43a14a2..a4aaa66cfdd242713d7acfeab4888aa6263d8677 100644
--- a/src/compiler/machine-operator.cc
+++ b/src/compiler/machine-operator.cc
@@ -53,71 +53,71 @@ StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
#define PURE_OP_LIST(V) \
- V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Word32Shl, Operator::kNoProperties, 2, 1) \
- V(Word32Shr, Operator::kNoProperties, 2, 1) \
- V(Word32Sar, Operator::kNoProperties, 2, 1) \
- V(Word32Ror, Operator::kNoProperties, 2, 1) \
- V(Word32Equal, Operator::kCommutative, 2, 1) \
- V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Word64Shl, Operator::kNoProperties, 2, 1) \
- V(Word64Shr, Operator::kNoProperties, 2, 1) \
- V(Word64Sar, Operator::kNoProperties, 2, 1) \
- V(Word64Ror, Operator::kNoProperties, 2, 1) \
- V(Word64Equal, Operator::kCommutative, 2, 1) \
- V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 1) \
+ V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \
+ V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \
+ V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \
+ V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \
+ V(Word32Equal, Operator::kCommutative, 2, 0, 1) \
+ V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Word64Shl, Operator::kNoProperties, 2, 0, 1) \
+ V(Word64Shr, Operator::kNoProperties, 2, 0, 1) \
+ V(Word64Sar, Operator::kNoProperties, 2, 0, 1) \
+ V(Word64Ror, Operator::kNoProperties, 2, 0, 1) \
+ V(Word64Equal, Operator::kCommutative, 2, 0, 1) \
+ V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
V(Int32AddWithOverflow, Operator::kAssociative | Operator::kCommutative, 2, \
- 2) \
- V(Int32Sub, Operator::kNoProperties, 2, 1) \
- V(Int32SubWithOverflow, Operator::kNoProperties, 2, 2) \
- V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Int32Div, Operator::kNoProperties, 2, 1) \
- V(Int32Mod, Operator::kNoProperties, 2, 1) \
- V(Int32LessThan, Operator::kNoProperties, 2, 1) \
- V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 1) \
- V(Uint32Div, Operator::kNoProperties, 2, 1) \
- V(Uint32LessThan, Operator::kNoProperties, 2, 1) \
- V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 1) \
- V(Uint32Mod, Operator::kNoProperties, 2, 1) \
- V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Int64Sub, Operator::kNoProperties, 2, 1) \
- V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 1) \
- V(Int64Div, Operator::kNoProperties, 2, 1) \
- V(Int64Mod, Operator::kNoProperties, 2, 1) \
- V(Int64LessThan, Operator::kNoProperties, 2, 1) \
- V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 1) \
- V(Uint64Div, Operator::kNoProperties, 2, 1) \
- V(Uint64LessThan, Operator::kNoProperties, 2, 1) \
- V(Uint64Mod, Operator::kNoProperties, 2, 1) \
- V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 1) \
- V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 1) \
- V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 1) \
- V(ChangeInt32ToFloat64, Operator::kNoProperties, 1, 1) \
- V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 1) \
- V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 1) \
- V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 1) \
- V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 1) \
- V(TruncateFloat64ToInt32, Operator::kNoProperties, 1, 1) \
- V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 1) \
- V(Float64Add, Operator::kCommutative, 2, 1) \
- V(Float64Sub, Operator::kNoProperties, 2, 1) \
- V(Float64Mul, Operator::kCommutative, 2, 1) \
- V(Float64Div, Operator::kNoProperties, 2, 1) \
- V(Float64Mod, Operator::kNoProperties, 2, 1) \
- V(Float64Sqrt, Operator::kNoProperties, 1, 1) \
- V(Float64Ceil, Operator::kNoProperties, 1, 1) \
- V(Float64Floor, Operator::kNoProperties, 1, 1) \
- V(Float64RoundTruncate, Operator::kNoProperties, 1, 1) \
- V(Float64RoundTiesAway, Operator::kNoProperties, 1, 1) \
- V(Float64Equal, Operator::kCommutative, 2, 1) \
- V(Float64LessThan, Operator::kNoProperties, 2, 1) \
- V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 1) \
- V(LoadStackPointer, Operator::kNoProperties, 0, 1)
+ 0, 2) \
+ V(Int32Sub, Operator::kNoProperties, 2, 0, 1) \
+ V(Int32SubWithOverflow, Operator::kNoProperties, 2, 0, 2) \
+ V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Int32Div, Operator::kNoProperties, 2, 1, 1) \
+ V(Int32Mod, Operator::kNoProperties, 2, 1, 1) \
+ V(Int32LessThan, Operator::kNoProperties, 2, 0, 1) \
+ V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
+ V(Uint32Div, Operator::kNoProperties, 2, 1, 1) \
+ V(Uint32LessThan, Operator::kNoProperties, 2, 0, 1) \
+ V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
+ V(Uint32Mod, Operator::kNoProperties, 2, 1, 1) \
+ V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Int64Sub, Operator::kNoProperties, 2, 0, 1) \
+ V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
+ V(Int64Div, Operator::kNoProperties, 2, 0, 1) \
+ V(Int64Mod, Operator::kNoProperties, 2, 0, 1) \
+ V(Int64LessThan, Operator::kNoProperties, 2, 0, 1) \
+ V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
+ V(Uint64Div, Operator::kNoProperties, 2, 0, 1) \
+ V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \
+ V(Uint64Mod, Operator::kNoProperties, 2, 0, 1) \
+ V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
+ V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \
+ V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 0, 1) \
+ V(ChangeInt32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
+ V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1) \
+ V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1) \
+ V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1) \
+ V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 0, 1) \
+ V(TruncateFloat64ToInt32, Operator::kNoProperties, 1, 0, 1) \
+ V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64Add, Operator::kCommutative, 2, 0, 1) \
+ V(Float64Sub, Operator::kNoProperties, 2, 0, 1) \
+ V(Float64Mul, Operator::kCommutative, 2, 0, 1) \
+ V(Float64Div, Operator::kNoProperties, 2, 0, 1) \
+ V(Float64Mod, Operator::kNoProperties, 2, 0, 1) \
+ V(Float64Sqrt, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64Ceil, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64Floor, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \
+ V(Float64Equal, Operator::kCommutative, 2, 0, 1) \
+ V(Float64LessThan, Operator::kNoProperties, 2, 0, 1) \
+ V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
+ V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1)
#define MACHINE_TYPE_LIST(V) \
@@ -142,64 +142,68 @@ StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
V(RepTagged)
-struct MachineOperatorBuilderImpl {
-#define PURE(Name, properties, input_count, output_count) \
- struct Name##Operator FINAL : public SimpleOperator { \
- Name##Operator() \
- : SimpleOperator(IrOpcode::k##Name, Operator::kPure | properties, \
- input_count, output_count, #Name) {} \
- }; \
+struct MachineOperatorGlobalCache {
+#define PURE(Name, properties, value_input_count, control_input_count, \
+ output_count) \
+ struct Name##Operator FINAL : public Operator { \
+ Name##Operator() \
+ : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
+ value_input_count, 0, control_input_count, output_count, 0, \
+ 0) {} \
+ }; \
Name##Operator k##Name;
PURE_OP_LIST(PURE)
#undef PURE
-#define LOAD(Type) \
- struct Load##Type##Operator FINAL : public Operator1<LoadRepresentation> { \
- Load##Type##Operator() \
- : Operator1<LoadRepresentation>( \
- IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, 2, 1, \
- "Load", k##Type) {} \
- }; \
+#define LOAD(Type) \
+ struct Load##Type##Operator FINAL : public Operator1<LoadRepresentation> { \
+ Load##Type##Operator() \
+ : Operator1<LoadRepresentation>( \
+ IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
+ "Load", 2, 1, 1, 1, 1, 0, k##Type) {} \
+ }; \
Load##Type##Operator k##Load##Type;
MACHINE_TYPE_LIST(LOAD)
#undef LOAD
-#define STORE(Type) \
- struct Store##Type##Operator : public Operator1<StoreRepresentation> { \
- explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \
- : Operator1<StoreRepresentation>( \
- IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, 3, 0, \
- "Store", StoreRepresentation(k##Type, write_barrier_kind)) {} \
- }; \
- struct Store##Type##NoWriteBarrier##Operator FINAL \
- : public Store##Type##Operator { \
- Store##Type##NoWriteBarrier##Operator() \
- : Store##Type##Operator(kNoWriteBarrier) {} \
- }; \
- struct Store##Type##FullWriteBarrier##Operator FINAL \
- : public Store##Type##Operator { \
- Store##Type##FullWriteBarrier##Operator() \
- : Store##Type##Operator(kFullWriteBarrier) {} \
- }; \
- Store##Type##NoWriteBarrier##Operator k##Store##Type##NoWriteBarrier; \
+#define STORE(Type) \
+ struct Store##Type##Operator : public Operator1<StoreRepresentation> { \
+ explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \
+ : Operator1<StoreRepresentation>( \
+ IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \
+ "Store", 3, 1, 1, 0, 1, 0, \
+ StoreRepresentation(k##Type, write_barrier_kind)) {} \
+ }; \
+ struct Store##Type##NoWriteBarrier##Operator FINAL \
+ : public Store##Type##Operator { \
+ Store##Type##NoWriteBarrier##Operator() \
+ : Store##Type##Operator(kNoWriteBarrier) {} \
+ }; \
+ struct Store##Type##FullWriteBarrier##Operator FINAL \
+ : public Store##Type##Operator { \
+ Store##Type##FullWriteBarrier##Operator() \
+ : Store##Type##Operator(kFullWriteBarrier) {} \
+ }; \
+ Store##Type##NoWriteBarrier##Operator k##Store##Type##NoWriteBarrier; \
Store##Type##FullWriteBarrier##Operator k##Store##Type##FullWriteBarrier;
MACHINE_TYPE_LIST(STORE)
#undef STORE
};
-static base::LazyInstance<MachineOperatorBuilderImpl>::type kImpl =
+static base::LazyInstance<MachineOperatorGlobalCache>::type kCache =
LAZY_INSTANCE_INITIALIZER;
MachineOperatorBuilder::MachineOperatorBuilder(MachineType word, Flags flags)
- : impl_(kImpl.Get()), word_(word), flags_(flags) {
+ : cache_(kCache.Get()), word_(word), flags_(flags) {
DCHECK(word == kRepWord32 || word == kRepWord64);
}
-#define PURE(Name, properties, input_count, output_count) \
- const Operator* MachineOperatorBuilder::Name() { return &impl_.k##Name; }
+#define PURE(Name, properties, value_input_count, control_input_count, \
+ output_count) \
+ const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; }
PURE_OP_LIST(PURE)
#undef PURE
@@ -208,7 +212,7 @@ const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
switch (rep) {
#define LOAD(Type) \
case k##Type: \
- return &impl_.k##Load##Type;
+ return &cache_.k##Load##Type;
MACHINE_TYPE_LIST(LOAD)
#undef LOAD
@@ -222,14 +226,14 @@ const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) {
switch (rep.machine_type()) {
-#define STORE(Type) \
- case k##Type: \
- switch (rep.write_barrier_kind()) { \
- case kNoWriteBarrier: \
- return &impl_.k##Store##Type##NoWriteBarrier; \
- case kFullWriteBarrier: \
- return &impl_.k##Store##Type##FullWriteBarrier; \
- } \
+#define STORE(Type) \
+ case k##Type: \
+ switch (rep.write_barrier_kind()) { \
+ case kNoWriteBarrier: \
+ return &cache_.k##Store##Type##NoWriteBarrier; \
+ case kFullWriteBarrier: \
+ return &cache_.k##Store##Type##FullWriteBarrier; \
+ } \
break;
MACHINE_TYPE_LIST(STORE)
#undef STORE
« no previous file with comments | « src/compiler/machine-operator.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698