Chromium Code Reviews| 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 = | |
| 2621 Operator::kCommutative | Operator::kEliminatable; | |
|
Jarin
2016/09/26 12:21:23
Nit: less-than is not commutative (actually, I do
Benedikt Meurer
2016/09/26 12:22:16
Done.
| |
| 2622 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; | |
| 2623 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | |
| 2624 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); | |
| 2625 node->InsertInput(graph()->zone(), 0, | |
| 2626 jsgraph()->HeapConstant(callable.code())); | |
| 2627 node->AppendInput(graph()->zone(), jsgraph()->NoContextConstant()); | |
| 2628 node->AppendInput(graph()->zone(), effect); | |
| 2629 NodeProperties::ChangeOp(node, common()->Call(desc)); | |
| 2630 return ValueEffectControl(node, node, control); | |
| 2631 } | |
| 2632 | |
| 2633 EffectControlLinearizer::ValueEffectControl | |
| 2634 EffectControlLinearizer::LowerStringEqual(Node* node, Node* effect, | |
| 2635 Node* control) { | |
| 2636 return LowerStringComparison(CodeFactory::StringEqual(isolate()), node, | |
| 2637 effect, control); | |
| 2638 } | |
| 2639 | |
| 2640 EffectControlLinearizer::ValueEffectControl | |
| 2641 EffectControlLinearizer::LowerStringLessThan(Node* node, Node* effect, | |
| 2642 Node* control) { | |
| 2643 return LowerStringComparison(CodeFactory::StringLessThan(isolate()), node, | |
| 2644 effect, control); | |
| 2645 } | |
| 2646 | |
| 2647 EffectControlLinearizer::ValueEffectControl | |
| 2648 EffectControlLinearizer::LowerStringLessThanOrEqual(Node* node, Node* effect, | |
| 2649 Node* control) { | |
| 2650 return LowerStringComparison(CodeFactory::StringLessThanOrEqual(isolate()), | |
| 2651 node, effect, control); | |
| 2652 } | |
| 2653 | |
| 2654 EffectControlLinearizer::ValueEffectControl | |
| 2608 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state, | 2655 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state, |
| 2609 Node* effect, Node* control) { | 2656 Node* effect, Node* control) { |
| 2610 // If we reach this point w/o eliminating the {node} that's marked | 2657 // 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 | 2658 // with allow-return-hole, we cannot do anything, so just deoptimize |
| 2612 // in case of the hole NaN (similar to Crankshaft). | 2659 // in case of the hole NaN (similar to Crankshaft). |
| 2613 Node* value = node->InputAt(0); | 2660 Node* value = node->InputAt(0); |
| 2614 Node* check = graph()->NewNode( | 2661 Node* check = graph()->NewNode( |
| 2615 machine()->Word32Equal(), | 2662 machine()->Word32Equal(), |
| 2616 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), | 2663 graph()->NewNode(machine()->Float64ExtractHighWord32(), value), |
| 2617 jsgraph()->Int32Constant(kHoleNanUpper32)); | 2664 jsgraph()->Int32Constant(kHoleNanUpper32)); |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3509 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3556 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3510 Operator::kEliminatable); | 3557 Operator::kEliminatable); |
| 3511 to_number_operator_.set(common()->Call(desc)); | 3558 to_number_operator_.set(common()->Call(desc)); |
| 3512 } | 3559 } |
| 3513 return to_number_operator_.get(); | 3560 return to_number_operator_.get(); |
| 3514 } | 3561 } |
| 3515 | 3562 |
| 3516 } // namespace compiler | 3563 } // namespace compiler |
| 3517 } // namespace internal | 3564 } // namespace internal |
| 3518 } // namespace v8 | 3565 } // namespace v8 |
| OLD | NEW |