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/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph-inl.h" | 10 #include "src/compiler/graph-inl.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 | 343 |
344 const Operator* Uint32Op(Node* node) { | 344 const Operator* Uint32Op(Node* node) { |
345 return changer_->Uint32OperatorFor(node->opcode()); | 345 return changer_->Uint32OperatorFor(node->opcode()); |
346 } | 346 } |
347 | 347 |
348 const Operator* Float64Op(Node* node) { | 348 const Operator* Float64Op(Node* node) { |
349 return changer_->Float64OperatorFor(node->opcode()); | 349 return changer_->Float64OperatorFor(node->opcode()); |
350 } | 350 } |
351 | 351 |
| 352 static MachineType AssumeImplicitFloat32Change(MachineType type) { |
| 353 // TODO(titzer): Assume loads of float32 change representation to float64. |
| 354 // Fix this with full support for float32 representations. |
| 355 if (type & kRepFloat32) { |
| 356 return static_cast<MachineType>((type & ~kRepFloat32) | kRepFloat64); |
| 357 } |
| 358 return type; |
| 359 } |
| 360 |
352 // Dispatching routine for visiting the node {node} with the usage {use}. | 361 // Dispatching routine for visiting the node {node} with the usage {use}. |
353 // Depending on the operator, propagate new usage info to the inputs. | 362 // Depending on the operator, propagate new usage info to the inputs. |
354 void VisitNode(Node* node, MachineTypeUnion use, | 363 void VisitNode(Node* node, MachineTypeUnion use, |
355 SimplifiedLowering* lowering) { | 364 SimplifiedLowering* lowering) { |
356 switch (node->opcode()) { | 365 switch (node->opcode()) { |
357 //------------------------------------------------------------------ | 366 //------------------------------------------------------------------ |
358 // Common operators. | 367 // Common operators. |
359 //------------------------------------------------------------------ | 368 //------------------------------------------------------------------ |
360 case IrOpcode::kStart: | 369 case IrOpcode::kStart: |
361 case IrOpcode::kDead: | 370 case IrOpcode::kDead: |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 572 } |
564 case IrOpcode::kStringAdd: { | 573 case IrOpcode::kStringAdd: { |
565 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); | 574 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); |
566 if (lower()) lowering->DoStringAdd(node); | 575 if (lower()) lowering->DoStringAdd(node); |
567 break; | 576 break; |
568 } | 577 } |
569 case IrOpcode::kLoadField: { | 578 case IrOpcode::kLoadField: { |
570 FieldAccess access = FieldAccessOf(node->op()); | 579 FieldAccess access = FieldAccessOf(node->op()); |
571 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 580 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
572 ProcessRemainingInputs(node, 1); | 581 ProcessRemainingInputs(node, 1); |
573 SetOutput(node, access.machine_type); | 582 SetOutput(node, AssumeImplicitFloat32Change(access.machine_type)); |
574 if (lower()) lowering->DoLoadField(node); | 583 if (lower()) lowering->DoLoadField(node); |
575 break; | 584 break; |
576 } | 585 } |
577 case IrOpcode::kStoreField: { | 586 case IrOpcode::kStoreField: { |
578 FieldAccess access = FieldAccessOf(node->op()); | 587 FieldAccess access = FieldAccessOf(node->op()); |
579 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 588 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
580 ProcessInput(node, 1, access.machine_type); | 589 ProcessInput(node, 1, AssumeImplicitFloat32Change(access.machine_type)); |
581 ProcessRemainingInputs(node, 2); | 590 ProcessRemainingInputs(node, 2); |
582 SetOutput(node, 0); | 591 SetOutput(node, 0); |
583 if (lower()) lowering->DoStoreField(node); | 592 if (lower()) lowering->DoStoreField(node); |
584 break; | 593 break; |
585 } | 594 } |
586 case IrOpcode::kLoadElement: { | 595 case IrOpcode::kLoadElement: { |
587 ElementAccess access = ElementAccessOf(node->op()); | 596 ElementAccess access = ElementAccessOf(node->op()); |
588 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 597 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
589 ProcessInput(node, 1, kMachInt32); // element index | 598 ProcessInput(node, 1, kMachInt32); // element index |
590 ProcessRemainingInputs(node, 2); | 599 ProcessRemainingInputs(node, 2); |
591 SetOutput(node, access.machine_type); | 600 SetOutput(node, AssumeImplicitFloat32Change(access.machine_type)); |
592 if (lower()) lowering->DoLoadElement(node); | 601 if (lower()) lowering->DoLoadElement(node); |
593 break; | 602 break; |
594 } | 603 } |
595 case IrOpcode::kStoreElement: { | 604 case IrOpcode::kStoreElement: { |
596 ElementAccess access = ElementAccessOf(node->op()); | 605 ElementAccess access = ElementAccessOf(node->op()); |
597 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 606 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
598 ProcessInput(node, 1, kMachInt32); // element index | 607 ProcessInput(node, 1, kMachInt32); // element index |
599 ProcessInput(node, 2, access.machine_type); | 608 ProcessInput(node, 2, AssumeImplicitFloat32Change(access.machine_type)); |
600 ProcessRemainingInputs(node, 3); | 609 ProcessRemainingInputs(node, 3); |
601 SetOutput(node, 0); | 610 SetOutput(node, 0); |
602 if (lower()) lowering->DoStoreElement(node); | 611 if (lower()) lowering->DoStoreElement(node); |
603 break; | 612 break; |
604 } | 613 } |
605 | 614 |
606 //------------------------------------------------------------------ | 615 //------------------------------------------------------------------ |
607 // Machine-level operators. | 616 // Machine-level operators. |
608 //------------------------------------------------------------------ | 617 //------------------------------------------------------------------ |
609 case IrOpcode::kLoad: { | 618 case IrOpcode::kLoad: { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 930 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
922 node->set_op(machine()->IntLessThanOrEqual()); | 931 node->set_op(machine()->IntLessThanOrEqual()); |
923 node->ReplaceInput(0, StringComparison(node, true)); | 932 node->ReplaceInput(0, StringComparison(node, true)); |
924 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 933 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
925 } | 934 } |
926 | 935 |
927 | 936 |
928 } // namespace compiler | 937 } // namespace compiler |
929 } // namespace internal | 938 } // namespace internal |
930 } // namespace v8 | 939 } // namespace v8 |
OLD | NEW |