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

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

Issue 2191503002: [turbofan] Add the CheckedTruncateTaggedToWord32 opcode. (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/opcodes.h » ('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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 break; 666 break;
667 case IrOpcode::kCheckedTaggedToInt32: 667 case IrOpcode::kCheckedTaggedToInt32:
668 state = LowerCheckedTaggedToInt32(node, frame_state, *effect, *control); 668 state = LowerCheckedTaggedToInt32(node, frame_state, *effect, *control);
669 break; 669 break;
670 case IrOpcode::kCheckedTaggedToFloat64: 670 case IrOpcode::kCheckedTaggedToFloat64:
671 state = LowerCheckedTaggedToFloat64(node, frame_state, *effect, *control); 671 state = LowerCheckedTaggedToFloat64(node, frame_state, *effect, *control);
672 break; 672 break;
673 case IrOpcode::kTruncateTaggedToWord32: 673 case IrOpcode::kTruncateTaggedToWord32:
674 state = LowerTruncateTaggedToWord32(node, *effect, *control); 674 state = LowerTruncateTaggedToWord32(node, *effect, *control);
675 break; 675 break;
676 case IrOpcode::kCheckedTruncateTaggedToWord32:
677 state = LowerCheckedTruncateTaggedToWord32(node, frame_state, *effect,
678 *control);
679 break;
676 case IrOpcode::kObjectIsCallable: 680 case IrOpcode::kObjectIsCallable:
677 state = LowerObjectIsCallable(node, *effect, *control); 681 state = LowerObjectIsCallable(node, *effect, *control);
678 break; 682 break;
679 case IrOpcode::kObjectIsNumber: 683 case IrOpcode::kObjectIsNumber:
680 state = LowerObjectIsNumber(node, *effect, *control); 684 state = LowerObjectIsNumber(node, *effect, *control);
681 break; 685 break;
682 case IrOpcode::kObjectIsReceiver: 686 case IrOpcode::kObjectIsReceiver:
683 state = LowerObjectIsReceiver(node, *effect, *control); 687 state = LowerObjectIsReceiver(node, *effect, *control);
684 break; 688 break;
685 case IrOpcode::kObjectIsSmi: 689 case IrOpcode::kObjectIsSmi:
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 1617
1614 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 1618 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
1615 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 1619 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
1616 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 1620 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
1617 vtrue, vfalse, control); 1621 vtrue, vfalse, control);
1618 1622
1619 return ValueEffectControl(value, effect, control); 1623 return ValueEffectControl(value, effect, control);
1620 } 1624 }
1621 1625
1622 EffectControlLinearizer::ValueEffectControl 1626 EffectControlLinearizer::ValueEffectControl
1627 EffectControlLinearizer::LowerCheckedTruncateTaggedToWord32(Node* node,
1628 Node* frame_state,
1629 Node* effect,
1630 Node* control) {
1631 Node* value = node->InputAt(0);
1632
1633 Node* check = ObjectIsSmi(value);
1634 Node* branch =
1635 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
1636
1637 // In the Smi case, just convert to int32.
1638 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
1639 Node* etrue = effect;
1640 Node* vtrue = ChangeSmiToInt32(value);
1641
1642 // Otherwise, check that it's a heap number or oddball and truncate the value
1643 // to int32.
1644 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
1645 ValueEffectControl false_state = BuildCheckedHeapNumberOrOddballToFloat64(
1646 value, frame_state, effect, if_false);
1647 false_state.value =
1648 graph()->NewNode(machine()->TruncateFloat64ToWord32(), false_state.value);
1649
1650 Node* merge =
1651 graph()->NewNode(common()->Merge(2), if_true, false_state.control);
1652 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue,
1653 false_state.effect, merge);
1654 Node* result =
1655 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue,
1656 false_state.value, merge);
1657
1658 return ValueEffectControl(result, effect_phi, merge);
1659 }
1660
1661 EffectControlLinearizer::ValueEffectControl
1623 EffectControlLinearizer::LowerObjectIsCallable(Node* node, Node* effect, 1662 EffectControlLinearizer::LowerObjectIsCallable(Node* node, Node* effect,
1624 Node* control) { 1663 Node* control) {
1625 Node* value = node->InputAt(0); 1664 Node* value = node->InputAt(0);
1626 1665
1627 Node* check = ObjectIsSmi(value); 1666 Node* check = ObjectIsSmi(value);
1628 Node* branch = 1667 Node* branch =
1629 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 1668 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
1630 1669
1631 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 1670 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
1632 Node* etrue = effect; 1671 Node* etrue = effect;
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 2267 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
2229 Operator::kNoThrow); 2268 Operator::kNoThrow);
2230 to_number_operator_.set(common()->Call(desc)); 2269 to_number_operator_.set(common()->Call(desc));
2231 } 2270 }
2232 return to_number_operator_.get(); 2271 return to_number_operator_.get();
2233 } 2272 }
2234 2273
2235 } // namespace compiler 2274 } // namespace compiler
2236 } // namespace internal 2275 } // namespace internal
2237 } // namespace v8 2276 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698