OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 break; | 715 break; |
716 case IrOpcode::kArrayBufferWasNeutered: | 716 case IrOpcode::kArrayBufferWasNeutered: |
717 state = LowerArrayBufferWasNeutered(node, *effect, *control); | 717 state = LowerArrayBufferWasNeutered(node, *effect, *control); |
718 break; | 718 break; |
719 case IrOpcode::kStringFromCharCode: | 719 case IrOpcode::kStringFromCharCode: |
720 state = LowerStringFromCharCode(node, *effect, *control); | 720 state = LowerStringFromCharCode(node, *effect, *control); |
721 break; | 721 break; |
722 case IrOpcode::kStringCharCodeAt: | 722 case IrOpcode::kStringCharCodeAt: |
723 state = LowerStringCharCodeAt(node, *effect, *control); | 723 state = LowerStringCharCodeAt(node, *effect, *control); |
724 break; | 724 break; |
| 725 case IrOpcode::kStringEqual: |
| 726 state = LowerStringEqual(node, *effect, *control); |
| 727 break; |
| 728 case IrOpcode::kStringLessThan: |
| 729 state = LowerStringLessThan(node, *effect, *control); |
| 730 break; |
| 731 case IrOpcode::kStringLessThanOrEqual: |
| 732 state = LowerStringLessThanOrEqual(node, *effect, *control); |
| 733 break; |
725 case IrOpcode::kCheckFloat64Hole: | 734 case IrOpcode::kCheckFloat64Hole: |
726 state = LowerCheckFloat64Hole(node, frame_state, *effect, *control); | 735 state = LowerCheckFloat64Hole(node, frame_state, *effect, *control); |
727 break; | 736 break; |
728 case IrOpcode::kCheckTaggedHole: | 737 case IrOpcode::kCheckTaggedHole: |
729 state = LowerCheckTaggedHole(node, frame_state, *effect, *control); | 738 state = LowerCheckTaggedHole(node, frame_state, *effect, *control); |
730 break; | 739 break; |
731 case IrOpcode::kConvertTaggedHoleToUndefined: | 740 case IrOpcode::kConvertTaggedHoleToUndefined: |
732 state = LowerConvertTaggedHoleToUndefined(node, *effect, *control); | 741 state = LowerConvertTaggedHoleToUndefined(node, *effect, *control); |
733 break; | 742 break; |
734 case IrOpcode::kPlainPrimitiveToNumber: | 743 case IrOpcode::kPlainPrimitiveToNumber: |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 | 2607 |
2599 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 2608 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
2600 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 2609 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
2601 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 2610 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
2602 vtrue0, vfalse0, control); | 2611 vtrue0, vfalse0, control); |
2603 | 2612 |
2604 return ValueEffectControl(value, effect, control); | 2613 return ValueEffectControl(value, effect, control); |
2605 } | 2614 } |
2606 | 2615 |
2607 EffectControlLinearizer::ValueEffectControl | 2616 EffectControlLinearizer::ValueEffectControl |
| 2617 EffectControlLinearizer::LowerStringComparison(Callable const& callable, |
| 2618 Node* node, Node* effect, |
| 2619 Node* control) { |
| 2620 Operator::Properties properties = Operator::kEliminatable; |
| 2621 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
| 2622 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 2623 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); |
| 2624 node->InsertInput(graph()->zone(), 0, |
| 2625 jsgraph()->HeapConstant(callable.code())); |
| 2626 node->AppendInput(graph()->zone(), jsgraph()->NoContextConstant()); |
| 2627 node->AppendInput(graph()->zone(), effect); |
| 2628 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 2629 return ValueEffectControl(node, node, control); |
| 2630 } |
| 2631 |
| 2632 EffectControlLinearizer::ValueEffectControl |
| 2633 EffectControlLinearizer::LowerStringEqual(Node* node, Node* effect, |
| 2634 Node* control) { |
| 2635 return LowerStringComparison(CodeFactory::StringEqual(isolate()), node, |
| 2636 effect, control); |
| 2637 } |
| 2638 |
| 2639 EffectControlLinearizer::ValueEffectControl |
| 2640 EffectControlLinearizer::LowerStringLessThan(Node* node, Node* effect, |
| 2641 Node* control) { |
| 2642 return LowerStringComparison(CodeFactory::StringLessThan(isolate()), node, |
| 2643 effect, control); |
| 2644 } |
| 2645 |
| 2646 EffectControlLinearizer::ValueEffectControl |
| 2647 EffectControlLinearizer::LowerStringLessThanOrEqual(Node* node, Node* effect, |
| 2648 Node* control) { |
| 2649 return LowerStringComparison(CodeFactory::StringLessThanOrEqual(isolate()), |
| 2650 node, effect, control); |
| 2651 } |
| 2652 |
| 2653 EffectControlLinearizer::ValueEffectControl |
2608 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state, | 2654 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state, |
2609 Node* effect, Node* control) { | 2655 Node* effect, Node* control) { |
2610 // If we reach this point w/o eliminating the {node} that's marked | 2656 // If we reach this point w/o eliminating the {node} that's marked |
2611 // with allow-return-hole, we cannot do anything, so just deoptimize | 2657 // with allow-return-hole, we cannot do anything, so just deoptimize |
2612 // in case of the hole NaN (similar to Crankshaft). | 2658 // in case of the hole NaN (similar to Crankshaft). |
2613 Node* value = node->InputAt(0); | 2659 Node* value = node->InputAt(0); |
2614 Node* check = graph()->NewNode( | 2660 Node* check = graph()->NewNode( |
2615 machine()->Word32Equal(), | 2661 machine()->Word32Equal(), |
2616 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), | 2662 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), |
2617 jsgraph()->Int32Constant(kHoleNanUpper32)); | 2663 jsgraph()->Int32Constant(kHoleNanUpper32)); |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3509 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3555 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3510 Operator::kEliminatable); | 3556 Operator::kEliminatable); |
3511 to_number_operator_.set(common()->Call(desc)); | 3557 to_number_operator_.set(common()->Call(desc)); |
3512 } | 3558 } |
3513 return to_number_operator_.get(); | 3559 return to_number_operator_.get(); |
3514 } | 3560 } |
3515 | 3561 |
3516 } // namespace compiler | 3562 } // namespace compiler |
3517 } // namespace internal | 3563 } // namespace internal |
3518 } // namespace v8 | 3564 } // namespace v8 |
OLD | NEW |