| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 }; \ | 174 }; \ |
| 175 struct Store##Type##FullWriteBarrier##Operator FINAL \ | 175 struct Store##Type##FullWriteBarrier##Operator FINAL \ |
| 176 : public Store##Type##Operator { \ | 176 : public Store##Type##Operator { \ |
| 177 Store##Type##FullWriteBarrier##Operator() \ | 177 Store##Type##FullWriteBarrier##Operator() \ |
| 178 : Store##Type##Operator(kFullWriteBarrier) {} \ | 178 : Store##Type##Operator(kFullWriteBarrier) {} \ |
| 179 }; \ | 179 }; \ |
| 180 Store##Type##NoWriteBarrier##Operator k##Store##Type##NoWriteBarrier; \ | 180 Store##Type##NoWriteBarrier##Operator k##Store##Type##NoWriteBarrier; \ |
| 181 Store##Type##FullWriteBarrier##Operator k##Store##Type##FullWriteBarrier; | 181 Store##Type##FullWriteBarrier##Operator k##Store##Type##FullWriteBarrier; |
| 182 MACHINE_TYPE_LIST(STORE) | 182 MACHINE_TYPE_LIST(STORE) |
| 183 #undef STORE | 183 #undef STORE |
| 184 |
| 185 struct Float64RoundOperator FINAL : public Operator1<Float64RoundMode> { |
| 186 explicit Float64RoundOperator(Float64RoundMode mode) |
| 187 : Operator1(IrOpcode::kFloat64Round, Operator::kPure, 1, 1, |
| 188 "Float64Round", mode) {} |
| 189 }; |
| 190 Float64RoundOperator kFloat64RoundDown; |
| 191 Float64RoundOperator kFloat64RoundUp; |
| 192 Float64RoundOperator kFloat64RoundAway; |
| 193 Float64RoundOperator kFloat64RoundTowards; |
| 194 |
| 195 MachineOperatorBuilderImpl() |
| 196 : kFloat64RoundDown(kRoundDown), |
| 197 kFloat64RoundUp(kRoundUp), |
| 198 kFloat64RoundAway(kRoundAway), |
| 199 kFloat64RoundTowards(kRoundTowards) {} |
| 184 }; | 200 }; |
| 185 | 201 |
| 186 | 202 |
| 187 static base::LazyInstance<MachineOperatorBuilderImpl>::type kImpl = | 203 static base::LazyInstance<MachineOperatorBuilderImpl>::type kImpl = |
| 188 LAZY_INSTANCE_INITIALIZER; | 204 LAZY_INSTANCE_INITIALIZER; |
| 189 | 205 |
| 190 | 206 |
| 191 MachineOperatorBuilder::MachineOperatorBuilder(MachineType word) | 207 MachineOperatorBuilder::MachineOperatorBuilder( |
| 192 : impl_(kImpl.Get()), word_(word) { | 208 MachineType word, SupportedOperators supportedOperators) |
| 209 : impl_(kImpl.Get()), word_(word), supportedOperators_(supportedOperators) { |
| 193 DCHECK(word == kRepWord32 || word == kRepWord64); | 210 DCHECK(word == kRepWord32 || word == kRepWord64); |
| 194 } | 211 } |
| 195 | 212 |
| 196 | 213 |
| 197 #define PURE(Name, properties, input_count, output_count) \ | 214 #define PURE(Name, properties, input_count, output_count) \ |
| 198 const Operator* MachineOperatorBuilder::Name() { return &impl_.k##Name; } | 215 const Operator* MachineOperatorBuilder::Name() { return &impl_.k##Name; } |
| 199 PURE_OP_LIST(PURE) | 216 PURE_OP_LIST(PURE) |
| 200 #undef PURE | 217 #undef PURE |
| 201 | 218 |
| 202 | 219 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 230 MACHINE_TYPE_LIST(STORE) | 247 MACHINE_TYPE_LIST(STORE) |
| 231 #undef STORE | 248 #undef STORE |
| 232 | 249 |
| 233 default: | 250 default: |
| 234 break; | 251 break; |
| 235 } | 252 } |
| 236 UNREACHABLE(); | 253 UNREACHABLE(); |
| 237 return NULL; | 254 return NULL; |
| 238 } | 255 } |
| 239 | 256 |
| 257 |
| 258 const Operator* MachineOperatorBuilder::Float64Round(Float64RoundMode mode) { |
| 259 switch (mode) { |
| 260 case kRoundDown: |
| 261 DCHECK(HasFloat64Floor()); |
| 262 return &impl_.kFloat64RoundDown; |
| 263 case kRoundUp: |
| 264 DCHECK(HasFloat64Ceil()); |
| 265 return &impl_.kFloat64RoundUp; |
| 266 case kRoundAway: |
| 267 DCHECK(HasFloat64RoundTiesAway()); |
| 268 return &impl_.kFloat64RoundAway; |
| 269 case kRoundTowards: |
| 270 DCHECK(HasFloat64RoundTiesTowards()); |
| 271 return &impl_.kFloat64RoundTowards; |
| 272 } |
| 273 UNREACHABLE(); |
| 274 return NULL; |
| 275 } |
| 240 } // namespace compiler | 276 } // namespace compiler |
| 241 } // namespace internal | 277 } // namespace internal |
| 242 } // namespace v8 | 278 } // namespace v8 |
| OLD | NEW |