Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2222983002: [turbofan] Also consume number type feedback for abstract equality. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 1660 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
1661 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 1661 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
1662 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 1662 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
1663 vtrue, vfalse, control); 1663 vtrue, vfalse, control);
1664 1664
1665 return ValueEffectControl(value, effect, control); 1665 return ValueEffectControl(value, effect, control);
1666 } 1666 }
1667 1667
1668 EffectControlLinearizer::ValueEffectControl 1668 EffectControlLinearizer::ValueEffectControl
1669 EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64( 1669 EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64(
1670 Node* value, Node* frame_state, Node* effect, Node* control) { 1670 CheckTaggedInputMode mode, Node* value, Node* frame_state, Node* effect,
1671 Node* control) {
1671 Node* value_map = effect = graph()->NewNode( 1672 Node* value_map = effect = graph()->NewNode(
1672 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); 1673 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control);
1674
1673 Node* check_number = graph()->NewNode(machine()->WordEqual(), value_map, 1675 Node* check_number = graph()->NewNode(machine()->WordEqual(), value_map,
1674 jsgraph()->HeapNumberMapConstant()); 1676 jsgraph()->HeapNumberMapConstant());
1675 1677
1676 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), 1678 switch (mode) {
1677 check_number, control); 1679 case CheckTaggedInputMode::kNumber: {
1680 control = effect = graph()->NewNode(
1681 common()->DeoptimizeUnless(DeoptimizeReason::kNotAHeapNumber),
1682 check_number, frame_state, effect, control);
1683 break;
1684 }
1685 case CheckTaggedInputMode::kNumberOrOddball: {
1686 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
1687 check_number, control);
1678 1688
1679 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 1689 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
1680 Node* etrue = effect; 1690 Node* etrue = effect;
1681 1691
1682 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 1692 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
1683 // For oddballs also contain the numeric value, let us just check that 1693 // For oddballs also contain the numeric value, let us just check that
1684 // we have an oddball here. 1694 // we have an oddball here.
1685 Node* efalse = effect; 1695 Node* efalse = effect;
1686 Node* instance_type = efalse = graph()->NewNode( 1696 Node* instance_type = efalse = graph()->NewNode(
1687 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), value_map, 1697 simplified()->LoadField(AccessBuilder::ForMapInstanceType()),
1688 efalse, if_false); 1698 value_map, efalse, if_false);
1689 Node* check_oddball = 1699 Node* check_oddball =
1690 graph()->NewNode(machine()->Word32Equal(), instance_type, 1700 graph()->NewNode(machine()->Word32Equal(), instance_type,
1691 jsgraph()->Int32Constant(ODDBALL_TYPE)); 1701 jsgraph()->Int32Constant(ODDBALL_TYPE));
1692 if_false = efalse = 1702 if_false = efalse = graph()->NewNode(
1693 graph()->NewNode(common()->DeoptimizeUnless( 1703 common()->DeoptimizeUnless(
1694 DeoptimizeReason::kNotAHeapNumberUndefinedBoolean), 1704 DeoptimizeReason::kNotAHeapNumberUndefinedBoolean),
1695 check_oddball, frame_state, efalse, if_false); 1705 check_oddball, frame_state, efalse, if_false);
1696 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); 1706 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
1697 1707
1698 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 1708 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
1699 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 1709 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
1710 break;
1711 }
1712 }
1700 1713
1701 Node* result = effect = graph()->NewNode( 1714 value = effect = graph()->NewNode(
1702 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, 1715 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
1703 effect, control); 1716 effect, control);
1704 return ValueEffectControl(result, effect, control); 1717 return ValueEffectControl(value, effect, control);
1705 } 1718 }
1706 1719
1707 EffectControlLinearizer::ValueEffectControl 1720 EffectControlLinearizer::ValueEffectControl
1708 EffectControlLinearizer::LowerCheckedTaggedToFloat64(Node* node, 1721 EffectControlLinearizer::LowerCheckedTaggedToFloat64(Node* node,
1709 Node* frame_state, 1722 Node* frame_state,
1710 Node* effect, 1723 Node* effect,
1711 Node* control) { 1724 Node* control) {
1725 CheckTaggedInputMode mode = CheckTaggedInputModeOf(node->op());
1712 Node* value = node->InputAt(0); 1726 Node* value = node->InputAt(0);
1713 1727
1714 Node* check = ObjectIsSmi(value); 1728 Node* check = ObjectIsSmi(value);
1715 Node* branch = 1729 Node* branch =
1716 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 1730 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
1717 1731
1718 // In the Smi case, just convert to int32 and then float64. 1732 // In the Smi case, just convert to int32 and then float64.
1719 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 1733 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
1720 Node* etrue = effect; 1734 Node* etrue = effect;
1721 Node* vtrue = ChangeSmiToInt32(value); 1735 Node* vtrue = ChangeSmiToInt32(value);
1722 vtrue = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue); 1736 vtrue = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue);
1723 1737
1724 // Otherwise, check heap numberness and load the number. 1738 // Otherwise, check heap numberness and load the number.
1725 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 1739 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
1726 ValueEffectControl number_state = BuildCheckedHeapNumberOrOddballToFloat64( 1740 ValueEffectControl number_state = BuildCheckedHeapNumberOrOddballToFloat64(
1727 value, frame_state, effect, if_false); 1741 mode, value, frame_state, effect, if_false);
1728 1742
1729 Node* merge = 1743 Node* merge =
1730 graph()->NewNode(common()->Merge(2), if_true, number_state.control); 1744 graph()->NewNode(common()->Merge(2), if_true, number_state.control);
1731 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue, 1745 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue,
1732 number_state.effect, merge); 1746 number_state.effect, merge);
1733 Node* result = 1747 Node* result =
1734 graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), vtrue, 1748 graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), vtrue,
1735 number_state.value, merge); 1749 number_state.value, merge);
1736 1750
1737 return ValueEffectControl(result, effect_phi, merge); 1751 return ValueEffectControl(result, effect_phi, merge);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 1796
1783 // In the Smi case, just convert to int32. 1797 // In the Smi case, just convert to int32.
1784 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 1798 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
1785 Node* etrue = effect; 1799 Node* etrue = effect;
1786 Node* vtrue = ChangeSmiToInt32(value); 1800 Node* vtrue = ChangeSmiToInt32(value);
1787 1801
1788 // Otherwise, check that it's a heap number or oddball and truncate the value 1802 // Otherwise, check that it's a heap number or oddball and truncate the value
1789 // to int32. 1803 // to int32.
1790 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 1804 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
1791 ValueEffectControl false_state = BuildCheckedHeapNumberOrOddballToFloat64( 1805 ValueEffectControl false_state = BuildCheckedHeapNumberOrOddballToFloat64(
1792 value, frame_state, effect, if_false); 1806 CheckTaggedInputMode::kNumberOrOddball, value, frame_state, effect,
1807 if_false);
1793 false_state.value = 1808 false_state.value =
1794 graph()->NewNode(machine()->TruncateFloat64ToWord32(), false_state.value); 1809 graph()->NewNode(machine()->TruncateFloat64ToWord32(), false_state.value);
1795 1810
1796 Node* merge = 1811 Node* merge =
1797 graph()->NewNode(common()->Merge(2), if_true, false_state.control); 1812 graph()->NewNode(common()->Merge(2), if_true, false_state.control);
1798 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue, 1813 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue,
1799 false_state.effect, merge); 1814 false_state.effect, merge);
1800 Node* result = 1815 Node* result =
1801 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue, 1816 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue,
1802 false_state.value, merge); 1817 false_state.value, merge);
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3289 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3275 Operator::kNoThrow); 3290 Operator::kNoThrow);
3276 to_number_operator_.set(common()->Call(desc)); 3291 to_number_operator_.set(common()->Call(desc));
3277 } 3292 }
3278 return to_number_operator_.get(); 3293 return to_number_operator_.get();
3279 } 3294 }
3280 3295
3281 } // namespace compiler 3296 } // namespace compiler
3282 } // namespace internal 3297 } // namespace internal
3283 } // namespace v8 3298 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698