| 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 16 matching lines...) Expand all Loading... |
| 27 TruncationMode TruncationModeOf(Operator const* op) { | 27 TruncationMode TruncationModeOf(Operator const* op) { |
| 28 DCHECK_EQ(IrOpcode::kTruncateFloat64ToInt32, op->opcode()); | 28 DCHECK_EQ(IrOpcode::kTruncateFloat64ToInt32, op->opcode()); |
| 29 return OpParameter<TruncationMode>(op); | 29 return OpParameter<TruncationMode>(op); |
| 30 } | 30 } |
| 31 | 31 |
| 32 | 32 |
| 33 std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) { | 33 std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) { |
| 34 switch (kind) { | 34 switch (kind) { |
| 35 case kNoWriteBarrier: | 35 case kNoWriteBarrier: |
| 36 return os << "NoWriteBarrier"; | 36 return os << "NoWriteBarrier"; |
| 37 case kMapWriteBarrier: |
| 38 return os << "MapWriteBarrier"; |
| 39 case kPointerWriteBarrier: |
| 40 return os << "PointerWriteBarrier"; |
| 37 case kFullWriteBarrier: | 41 case kFullWriteBarrier: |
| 38 return os << "FullWriteBarrier"; | 42 return os << "FullWriteBarrier"; |
| 39 } | 43 } |
| 40 UNREACHABLE(); | 44 UNREACHABLE(); |
| 41 return os; | 45 return os; |
| 42 } | 46 } |
| 43 | 47 |
| 44 | 48 |
| 45 bool operator==(StoreRepresentation lhs, StoreRepresentation rhs) { | 49 bool operator==(StoreRepresentation lhs, StoreRepresentation rhs) { |
| 46 return lhs.machine_type() == rhs.machine_type() && | 50 return lhs.machine_type() == rhs.machine_type() && |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 : Operator1<StoreRepresentation>( \ | 251 : Operator1<StoreRepresentation>( \ |
| 248 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ | 252 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ |
| 249 "Store", 3, 1, 1, 0, 1, 0, \ | 253 "Store", 3, 1, 1, 0, 1, 0, \ |
| 250 StoreRepresentation(k##Type, write_barrier_kind)) {} \ | 254 StoreRepresentation(k##Type, write_barrier_kind)) {} \ |
| 251 }; \ | 255 }; \ |
| 252 struct Store##Type##NoWriteBarrier##Operator final \ | 256 struct Store##Type##NoWriteBarrier##Operator final \ |
| 253 : public Store##Type##Operator { \ | 257 : public Store##Type##Operator { \ |
| 254 Store##Type##NoWriteBarrier##Operator() \ | 258 Store##Type##NoWriteBarrier##Operator() \ |
| 255 : Store##Type##Operator(kNoWriteBarrier) {} \ | 259 : Store##Type##Operator(kNoWriteBarrier) {} \ |
| 256 }; \ | 260 }; \ |
| 261 struct Store##Type##MapWriteBarrier##Operator final \ |
| 262 : public Store##Type##Operator { \ |
| 263 Store##Type##MapWriteBarrier##Operator() \ |
| 264 : Store##Type##Operator(kMapWriteBarrier) {} \ |
| 265 }; \ |
| 266 struct Store##Type##PointerWriteBarrier##Operator final \ |
| 267 : public Store##Type##Operator { \ |
| 268 Store##Type##PointerWriteBarrier##Operator() \ |
| 269 : Store##Type##Operator(kPointerWriteBarrier) {} \ |
| 270 }; \ |
| 257 struct Store##Type##FullWriteBarrier##Operator final \ | 271 struct Store##Type##FullWriteBarrier##Operator final \ |
| 258 : public Store##Type##Operator { \ | 272 : public Store##Type##Operator { \ |
| 259 Store##Type##FullWriteBarrier##Operator() \ | 273 Store##Type##FullWriteBarrier##Operator() \ |
| 260 : Store##Type##Operator(kFullWriteBarrier) {} \ | 274 : Store##Type##Operator(kFullWriteBarrier) {} \ |
| 261 }; \ | 275 }; \ |
| 262 struct CheckedStore##Type##Operator final \ | 276 struct CheckedStore##Type##Operator final \ |
| 263 : public Operator1<CheckedStoreRepresentation> { \ | 277 : public Operator1<CheckedStoreRepresentation> { \ |
| 264 CheckedStore##Type##Operator() \ | 278 CheckedStore##Type##Operator() \ |
| 265 : Operator1<CheckedStoreRepresentation>( \ | 279 : Operator1<CheckedStoreRepresentation>( \ |
| 266 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \ | 280 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \ |
| 267 "CheckedStore", 4, 1, 1, 0, 1, 0, k##Type) {} \ | 281 "CheckedStore", 4, 1, 1, 0, 1, 0, k##Type) {} \ |
| 268 }; \ | 282 }; \ |
| 269 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ | 283 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ |
| 284 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ |
| 285 Store##Type##PointerWriteBarrier##Operator \ |
| 286 kStore##Type##PointerWriteBarrier; \ |
| 270 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ | 287 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ |
| 271 CheckedStore##Type##Operator kCheckedStore##Type; | 288 CheckedStore##Type##Operator kCheckedStore##Type; |
| 272 MACHINE_TYPE_LIST(STORE) | 289 MACHINE_TYPE_LIST(STORE) |
| 273 #undef STORE | 290 #undef STORE |
| 274 }; | 291 }; |
| 275 | 292 |
| 276 | 293 |
| 277 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = | 294 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = |
| 278 LAZY_INSTANCE_INITIALIZER; | 295 LAZY_INSTANCE_INITIALIZER; |
| 279 | 296 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 default: | 340 default: |
| 324 break; | 341 break; |
| 325 } | 342 } |
| 326 UNREACHABLE(); | 343 UNREACHABLE(); |
| 327 return nullptr; | 344 return nullptr; |
| 328 } | 345 } |
| 329 | 346 |
| 330 | 347 |
| 331 const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) { | 348 const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) { |
| 332 switch (rep.machine_type()) { | 349 switch (rep.machine_type()) { |
| 333 #define STORE(Type) \ | 350 #define STORE(Type) \ |
| 334 case k##Type: \ | 351 case k##Type: \ |
| 335 switch (rep.write_barrier_kind()) { \ | 352 switch (rep.write_barrier_kind()) { \ |
| 336 case kNoWriteBarrier: \ | 353 case kNoWriteBarrier: \ |
| 337 return &cache_.k##Store##Type##NoWriteBarrier; \ | 354 return &cache_.k##Store##Type##NoWriteBarrier; \ |
| 338 case kFullWriteBarrier: \ | 355 case kMapWriteBarrier: \ |
| 339 return &cache_.k##Store##Type##FullWriteBarrier; \ | 356 return &cache_.k##Store##Type##MapWriteBarrier; \ |
| 340 } \ | 357 case kPointerWriteBarrier: \ |
| 358 return &cache_.k##Store##Type##PointerWriteBarrier; \ |
| 359 case kFullWriteBarrier: \ |
| 360 return &cache_.k##Store##Type##FullWriteBarrier; \ |
| 361 } \ |
| 341 break; | 362 break; |
| 342 MACHINE_TYPE_LIST(STORE) | 363 MACHINE_TYPE_LIST(STORE) |
| 343 #undef STORE | 364 #undef STORE |
| 344 | 365 |
| 345 default: | 366 default: |
| 346 break; | 367 break; |
| 347 } | 368 } |
| 348 UNREACHABLE(); | 369 UNREACHABLE(); |
| 349 return nullptr; | 370 return nullptr; |
| 350 } | 371 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 377 default: | 398 default: |
| 378 break; | 399 break; |
| 379 } | 400 } |
| 380 UNREACHABLE(); | 401 UNREACHABLE(); |
| 381 return nullptr; | 402 return nullptr; |
| 382 } | 403 } |
| 383 | 404 |
| 384 } // namespace compiler | 405 } // namespace compiler |
| 385 } // namespace internal | 406 } // namespace internal |
| 386 } // namespace v8 | 407 } // namespace v8 |
| OLD | NEW |