Chromium Code Reviews| 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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
| 9 #include "src/compiler/graph-inl.h" | 9 #include "src/compiler/graph-inl.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 PrintInfo(output); | 181 PrintInfo(output); |
| 182 TRACE((" to ")); | 182 TRACE((" to ")); |
| 183 PrintInfo(use); | 183 PrintInfo(use); |
| 184 TRACE(("\n")); | 184 TRACE(("\n")); |
| 185 Node* n = changer_->GetRepresentationFor(input, output, use); | 185 Node* n = changer_->GetRepresentationFor(input, output, use); |
| 186 node->ReplaceInput(index, n); | 186 node->ReplaceInput(index, n); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ProcessEffect(Node* node) { | |
|
titzer
2014/09/03 09:03:57
Can we make this ProcessRemainingInputs(Node*, int
Michael Starzinger
2014/09/03 10:49:58
Done.
| |
| 192 DCHECK_EQ(1, OperatorProperties::GetEffectInputCount(node->op())); | |
| 193 Enqueue(NodeProperties::GetEffectInput(node)); // Effect input: just visit | |
| 194 } | |
| 195 | |
| 191 // The default, most general visitation case. For {node}, process all value, | 196 // The default, most general visitation case. For {node}, process all value, |
| 192 // context, effect, and control inputs, assuming that value inputs should have | 197 // context, effect, and control inputs, assuming that value inputs should have |
| 193 // {kRepTagged} representation and can observe all output values {kTypeAny}. | 198 // {kRepTagged} representation and can observe all output values {kTypeAny}. |
| 194 void VisitInputs(Node* node) { | 199 void VisitInputs(Node* node) { |
| 195 InputIter i = node->inputs().begin(); | 200 InputIter i = node->inputs().begin(); |
| 196 for (int j = OperatorProperties::GetValueInputCount(node->op()); j > 0; | 201 for (int j = OperatorProperties::GetValueInputCount(node->op()); j > 0; |
| 197 ++i, j--) { | 202 ++i, j--) { |
| 198 ProcessInput(node, i.index(), kMachAnyTagged); // Value inputs | 203 ProcessInput(node, i.index(), kMachAnyTagged); // Value inputs |
| 199 } | 204 } |
| 200 for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0; | 205 for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 break; | 527 break; |
| 523 } | 528 } |
| 524 case IrOpcode::kStringAdd: { | 529 case IrOpcode::kStringAdd: { |
| 525 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); | 530 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); |
| 526 if (lower()) lowering->DoStringAdd(node); | 531 if (lower()) lowering->DoStringAdd(node); |
| 527 break; | 532 break; |
| 528 } | 533 } |
| 529 case IrOpcode::kLoadField: { | 534 case IrOpcode::kLoadField: { |
| 530 FieldAccess access = FieldAccessOf(node->op()); | 535 FieldAccess access = FieldAccessOf(node->op()); |
| 531 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 536 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
| 537 ProcessEffect(node); | |
| 532 SetOutput(node, access.machine_type); | 538 SetOutput(node, access.machine_type); |
| 533 if (lower()) lowering->DoLoadField(node); | 539 if (lower()) lowering->DoLoadField(node); |
| 534 break; | 540 break; |
| 535 } | 541 } |
| 536 case IrOpcode::kStoreField: { | 542 case IrOpcode::kStoreField: { |
| 537 FieldAccess access = FieldAccessOf(node->op()); | 543 FieldAccess access = FieldAccessOf(node->op()); |
| 538 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 544 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
| 539 ProcessInput(node, 1, access.machine_type); | 545 ProcessInput(node, 1, access.machine_type); |
| 546 ProcessEffect(node); | |
| 540 SetOutput(node, 0); | 547 SetOutput(node, 0); |
| 541 if (lower()) lowering->DoStoreField(node); | 548 if (lower()) lowering->DoStoreField(node); |
| 542 break; | 549 break; |
| 543 } | 550 } |
| 544 case IrOpcode::kLoadElement: { | 551 case IrOpcode::kLoadElement: { |
| 545 ElementAccess access = ElementAccessOf(node->op()); | 552 ElementAccess access = ElementAccessOf(node->op()); |
| 546 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 553 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
| 547 ProcessInput(node, 1, kMachInt32); // element index | 554 ProcessInput(node, 1, kMachInt32); // element index |
| 555 ProcessEffect(node); | |
| 548 SetOutput(node, access.machine_type); | 556 SetOutput(node, access.machine_type); |
| 549 if (lower()) lowering->DoLoadElement(node); | 557 if (lower()) lowering->DoLoadElement(node); |
| 550 break; | 558 break; |
| 551 } | 559 } |
| 552 case IrOpcode::kStoreElement: { | 560 case IrOpcode::kStoreElement: { |
| 553 ElementAccess access = ElementAccessOf(node->op()); | 561 ElementAccess access = ElementAccessOf(node->op()); |
| 554 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 562 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
| 555 ProcessInput(node, 1, kMachInt32); // element index | 563 ProcessInput(node, 1, kMachInt32); // element index |
| 556 ProcessInput(node, 2, access.machine_type); | 564 ProcessInput(node, 2, access.machine_type); |
| 565 ProcessEffect(node); | |
| 557 SetOutput(node, 0); | 566 SetOutput(node, 0); |
| 558 if (lower()) lowering->DoStoreElement(node); | 567 if (lower()) lowering->DoStoreElement(node); |
| 559 break; | 568 break; |
| 560 } | 569 } |
| 561 | 570 |
| 562 //------------------------------------------------------------------ | 571 //------------------------------------------------------------------ |
| 563 // Machine-level operators. | 572 // Machine-level operators. |
| 564 //------------------------------------------------------------------ | 573 //------------------------------------------------------------------ |
| 565 case IrOpcode::kLoad: { | 574 case IrOpcode::kLoad: { |
| 566 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 575 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
| 567 MachineType tBase = kRepTagged; | 576 MachineType tBase = kRepTagged; |
| 568 MachineType machine_type = OpParameter<MachineType>(node); | 577 MachineType machine_type = OpParameter<MachineType>(node); |
| 569 ProcessInput(node, 0, tBase); // pointer or object | 578 ProcessInput(node, 0, tBase); // pointer or object |
| 570 ProcessInput(node, 1, kMachInt32); // index | 579 ProcessInput(node, 1, kMachInt32); // index |
| 580 ProcessEffect(node); | |
| 571 SetOutput(node, machine_type); | 581 SetOutput(node, machine_type); |
| 572 break; | 582 break; |
| 573 } | 583 } |
| 574 case IrOpcode::kStore: { | 584 case IrOpcode::kStore: { |
| 575 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 585 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
| 576 MachineType tBase = kRepTagged; | 586 MachineType tBase = kRepTagged; |
| 577 StoreRepresentation rep = OpParameter<StoreRepresentation>(node); | 587 StoreRepresentation rep = OpParameter<StoreRepresentation>(node); |
| 578 ProcessInput(node, 0, tBase); // pointer or object | 588 ProcessInput(node, 0, tBase); // pointer or object |
| 579 ProcessInput(node, 1, kMachInt32); // index | 589 ProcessInput(node, 1, kMachInt32); // index |
| 580 ProcessInput(node, 2, rep.machine_type); | 590 ProcessInput(node, 2, rep.machine_type); |
| 591 ProcessEffect(node); | |
| 581 SetOutput(node, 0); | 592 SetOutput(node, 0); |
| 582 break; | 593 break; |
| 583 } | 594 } |
| 584 case IrOpcode::kWord32Shr: | 595 case IrOpcode::kWord32Shr: |
| 585 // We output unsigned int32 for shift right because JavaScript. | 596 // We output unsigned int32 for shift right because JavaScript. |
| 586 return VisitBinop(node, kRepWord32, kRepWord32 | kTypeUint32); | 597 return VisitBinop(node, kRepWord32, kRepWord32 | kTypeUint32); |
| 587 case IrOpcode::kWord32And: | 598 case IrOpcode::kWord32And: |
| 588 case IrOpcode::kWord32Or: | 599 case IrOpcode::kWord32Or: |
| 589 case IrOpcode::kWord32Xor: | 600 case IrOpcode::kWord32Xor: |
| 590 case IrOpcode::kWord32Shl: | 601 case IrOpcode::kWord32Shl: |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 jsgraph()->UndefinedConstant()); | 864 jsgraph()->UndefinedConstant()); |
| 854 node->set_op(machine()->WordEqual()); | 865 node->set_op(machine()->WordEqual()); |
| 855 node->ReplaceInput(0, call); | 866 node->ReplaceInput(0, call); |
| 856 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 867 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 857 } | 868 } |
| 858 | 869 |
| 859 | 870 |
| 860 } // namespace compiler | 871 } // namespace compiler |
| 861 } // namespace internal | 872 } // namespace internal |
| 862 } // namespace v8 | 873 } // namespace v8 |
| OLD | NEW |