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/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // Propagate "referenceness" throughout phis. | 223 // Propagate "referenceness" throughout phis. |
224 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) { | 224 for (UseIter i = node->uses().begin(); i != node->uses().end(); ++i) { |
225 Node* user = *i; | 225 Node* user = *i; |
226 if (user->opcode() != IrOpcode::kPhi) continue; | 226 if (user->opcode() != IrOpcode::kPhi) continue; |
227 if (IsReference(user)) continue; | 227 if (IsReference(user)) continue; |
228 MarkAsReference(user); | 228 MarkAsReference(user); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 | 232 |
233 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep, | 233 void InstructionSelector::MarkAsRepresentation(MachineType rep, Node* node) { |
234 Node* node) { | |
235 DCHECK_NOT_NULL(node); | 234 DCHECK_NOT_NULL(node); |
236 if (rep == kMachineFloat64) MarkAsDouble(node); | 235 if (rep == kMachineFloat64) MarkAsDouble(node); |
237 if (rep == kMachineTagged) MarkAsReference(node); | 236 if (rep == kMachineTagged) MarkAsReference(node); |
238 } | 237 } |
239 | 238 |
240 | 239 |
241 // TODO(bmeurer): Get rid of the CallBuffer business and make | 240 // TODO(bmeurer): Get rid of the CallBuffer business and make |
242 // InstructionSelector::VisitCall platform independent instead. | 241 // InstructionSelector::VisitCall platform independent instead. |
243 CallBuffer::CallBuffer(Zone* zone, CallDescriptor* d) | 242 CallBuffer::CallBuffer(Zone* zone, CallDescriptor* d) |
244 : output_count(0), | 243 : output_count(0), |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 case IrOpcode::kIfTrue: | 459 case IrOpcode::kIfTrue: |
461 case IrOpcode::kIfFalse: | 460 case IrOpcode::kIfFalse: |
462 case IrOpcode::kEffectPhi: | 461 case IrOpcode::kEffectPhi: |
463 case IrOpcode::kMerge: | 462 case IrOpcode::kMerge: |
464 case IrOpcode::kLazyDeoptimization: | 463 case IrOpcode::kLazyDeoptimization: |
465 case IrOpcode::kContinuation: | 464 case IrOpcode::kContinuation: |
466 // No code needed for these graph artifacts. | 465 // No code needed for these graph artifacts. |
467 return; | 466 return; |
468 case IrOpcode::kParameter: { | 467 case IrOpcode::kParameter: { |
469 int index = OpParameter<int>(node); | 468 int index = OpParameter<int>(node); |
470 MachineRepresentation rep = linkage() | 469 MachineType rep = linkage() |
471 ->GetIncomingDescriptor() | 470 ->GetIncomingDescriptor() |
472 ->GetInputLocation(index) | 471 ->GetInputLocation(index) |
473 .representation(); | 472 .representation(); |
474 MarkAsRepresentation(rep, node); | 473 MarkAsRepresentation(rep, node); |
475 return VisitParameter(node); | 474 return VisitParameter(node); |
476 } | 475 } |
477 case IrOpcode::kPhi: | 476 case IrOpcode::kPhi: |
478 return VisitPhi(node); | 477 return VisitPhi(node); |
479 case IrOpcode::kProjection: | 478 case IrOpcode::kProjection: |
480 return VisitProjection(node); | 479 return VisitProjection(node); |
481 case IrOpcode::kInt32Constant: | 480 case IrOpcode::kInt32Constant: |
482 case IrOpcode::kInt64Constant: | 481 case IrOpcode::kInt64Constant: |
483 case IrOpcode::kExternalConstant: | 482 case IrOpcode::kExternalConstant: |
484 return VisitConstant(node); | 483 return VisitConstant(node); |
485 case IrOpcode::kFloat64Constant: | 484 case IrOpcode::kFloat64Constant: |
486 return MarkAsDouble(node), VisitConstant(node); | 485 return MarkAsDouble(node), VisitConstant(node); |
487 case IrOpcode::kHeapConstant: | 486 case IrOpcode::kHeapConstant: |
488 case IrOpcode::kNumberConstant: | 487 case IrOpcode::kNumberConstant: |
489 // TODO(turbofan): only mark non-smis as references. | 488 // TODO(turbofan): only mark non-smis as references. |
490 return MarkAsReference(node), VisitConstant(node); | 489 return MarkAsReference(node), VisitConstant(node); |
491 case IrOpcode::kCall: | 490 case IrOpcode::kCall: |
492 return VisitCall(node, NULL, NULL); | 491 return VisitCall(node, NULL, NULL); |
493 case IrOpcode::kFrameState: | 492 case IrOpcode::kFrameState: |
494 case IrOpcode::kStateValues: | 493 case IrOpcode::kStateValues: |
495 return; | 494 return; |
496 case IrOpcode::kLoad: { | 495 case IrOpcode::kLoad: { |
497 MachineRepresentation load_rep = OpParameter<MachineRepresentation>(node); | 496 MachineType load_rep = OpParameter<MachineType>(node); |
498 MarkAsRepresentation(load_rep, node); | 497 MarkAsRepresentation(load_rep, node); |
499 return VisitLoad(node); | 498 return VisitLoad(node); |
500 } | 499 } |
501 case IrOpcode::kStore: | 500 case IrOpcode::kStore: |
502 return VisitStore(node); | 501 return VisitStore(node); |
503 case IrOpcode::kWord32And: | 502 case IrOpcode::kWord32And: |
504 return VisitWord32And(node); | 503 return VisitWord32And(node); |
505 case IrOpcode::kWord32Or: | 504 case IrOpcode::kWord32Or: |
506 return VisitWord32Or(node); | 505 return VisitWord32Or(node); |
507 case IrOpcode::kWord32Xor: | 506 case IrOpcode::kWord32Xor: |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 | 1044 |
1046 | 1045 |
1047 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, | 1046 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, |
1048 BasicBlock* deoptimization) {} | 1047 BasicBlock* deoptimization) {} |
1049 | 1048 |
1050 #endif // !V8_TURBOFAN_BACKEND | 1049 #endif // !V8_TURBOFAN_BACKEND |
1051 | 1050 |
1052 } // namespace compiler | 1051 } // namespace compiler |
1053 } // namespace internal | 1052 } // namespace internal |
1054 } // namespace v8 | 1053 } // namespace v8 |
OLD | NEW |