OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/simplified-operator.h" | 5 #include "src/compiler/simplified-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 #include "src/types-inl.h" | 10 #include "src/types-inl.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 | 111 |
112 static base::LazyInstance<SimplifiedOperatorBuilderImpl>::type kImpl = | 112 static base::LazyInstance<SimplifiedOperatorBuilderImpl>::type kImpl = |
113 LAZY_INSTANCE_INITIALIZER; | 113 LAZY_INSTANCE_INITIALIZER; |
114 | 114 |
115 | 115 |
116 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) | 116 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) |
117 : impl_(kImpl.Get()), zone_(zone) {} | 117 : impl_(kImpl.Get()), zone_(zone) {} |
118 | 118 |
119 | 119 |
120 #define PURE(Name, properties, input_count) \ | 120 #define PURE(Name, properties, input_count) \ |
121 const Operator* SimplifiedOperatorBuilder::Name() const { \ | 121 const Operator* SimplifiedOperatorBuilder::Name() { return &impl_.k##Name; } |
122 return &impl_.k##Name; \ | |
123 } | |
124 PURE_OP_LIST(PURE) | 122 PURE_OP_LIST(PURE) |
125 #undef PURE | 123 #undef PURE |
126 | 124 |
127 | 125 |
128 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) const { | 126 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
129 // TODO(titzer): What about the type parameter? | 127 // TODO(titzer): What about the type parameter? |
130 return new (zone()) SimpleOperator(IrOpcode::kReferenceEqual, | 128 return new (zone()) SimpleOperator(IrOpcode::kReferenceEqual, |
131 Operator::kCommutative | Operator::kPure, | 129 Operator::kCommutative | Operator::kPure, |
132 2, 1, "ReferenceEqual"); | 130 2, 1, "ReferenceEqual"); |
133 } | 131 } |
134 | 132 |
135 | 133 |
136 #define ACCESS(Name, Type, properties, input_count, output_count) \ | 134 #define ACCESS(Name, Type, properties, input_count, output_count) \ |
137 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) const { \ | 135 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ |
138 return new (zone()) \ | 136 return new (zone()) \ |
139 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ | 137 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ |
140 input_count, output_count, #Name, access); \ | 138 input_count, output_count, #Name, access); \ |
141 } | 139 } |
142 ACCESS_OP_LIST(ACCESS) | 140 ACCESS_OP_LIST(ACCESS) |
143 #undef ACCESS | 141 #undef ACCESS |
144 | 142 |
145 } // namespace compiler | 143 } // namespace compiler |
146 } // namespace internal | 144 } // namespace internal |
147 } // namespace v8 | 145 } // namespace v8 |
OLD | NEW |