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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 LAZY_INSTANCE_INITIALIZER; | 187 LAZY_INSTANCE_INITIALIZER; |
188 | 188 |
189 | 189 |
190 MachineOperatorBuilder::MachineOperatorBuilder(MachineType word) | 190 MachineOperatorBuilder::MachineOperatorBuilder(MachineType word) |
191 : impl_(kImpl.Get()), word_(word) { | 191 : impl_(kImpl.Get()), word_(word) { |
192 DCHECK(word == kRepWord32 || word == kRepWord64); | 192 DCHECK(word == kRepWord32 || word == kRepWord64); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 #define PURE(Name, properties, input_count, output_count) \ | 196 #define PURE(Name, properties, input_count, output_count) \ |
197 const Operator* MachineOperatorBuilder::Name() { return &impl_.k##Name; } | 197 const Operator* MachineOperatorBuilder::Name() const { \ |
| 198 return &impl_.k##Name; \ |
| 199 } |
198 PURE_OP_LIST(PURE) | 200 PURE_OP_LIST(PURE) |
199 #undef PURE | 201 #undef PURE |
200 | 202 |
201 | 203 |
202 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) { | 204 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) const { |
203 switch (rep) { | 205 switch (rep) { |
204 #define LOAD(Type) \ | 206 #define LOAD(Type) \ |
205 case k##Type: \ | 207 case k##Type: \ |
206 return &impl_.k##Load##Type; | 208 return &impl_.k##Load##Type; |
207 MACHINE_TYPE_LIST(LOAD) | 209 MACHINE_TYPE_LIST(LOAD) |
208 #undef LOAD | 210 #undef LOAD |
209 | 211 |
210 default: | 212 default: |
211 break; | 213 break; |
212 } | 214 } |
213 UNREACHABLE(); | 215 UNREACHABLE(); |
214 return NULL; | 216 return NULL; |
215 } | 217 } |
216 | 218 |
217 | 219 |
218 const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) { | 220 const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) const { |
219 switch (rep.machine_type()) { | 221 switch (rep.machine_type()) { |
220 #define STORE(Type) \ | 222 #define STORE(Type) \ |
221 case k##Type: \ | 223 case k##Type: \ |
222 switch (rep.write_barrier_kind()) { \ | 224 switch (rep.write_barrier_kind()) { \ |
223 case kNoWriteBarrier: \ | 225 case kNoWriteBarrier: \ |
224 return &impl_.k##Store##Type##NoWriteBarrier; \ | 226 return &impl_.k##Store##Type##NoWriteBarrier; \ |
225 case kFullWriteBarrier: \ | 227 case kFullWriteBarrier: \ |
226 return &impl_.k##Store##Type##FullWriteBarrier; \ | 228 return &impl_.k##Store##Type##FullWriteBarrier; \ |
227 } \ | 229 } \ |
228 break; | 230 break; |
229 MACHINE_TYPE_LIST(STORE) | 231 MACHINE_TYPE_LIST(STORE) |
230 #undef STORE | 232 #undef STORE |
231 | 233 |
232 default: | 234 default: |
233 break; | 235 break; |
234 } | 236 } |
235 UNREACHABLE(); | 237 UNREACHABLE(); |
236 return NULL; | 238 return NULL; |
237 } | 239 } |
238 | 240 |
239 } // namespace compiler | 241 } // namespace compiler |
240 } // namespace internal | 242 } // namespace internal |
241 } // namespace v8 | 243 } // namespace v8 |
OLD | NEW |