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

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

Issue 2109623002: [turbofan] Introduce proper CheckNumber operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add to RedundancyElimination Created 4 years, 5 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
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 break; 427 break;
428 case IrOpcode::kChangeTaggedToFloat64: 428 case IrOpcode::kChangeTaggedToFloat64:
429 state = LowerChangeTaggedToFloat64(node, *effect, *control); 429 state = LowerChangeTaggedToFloat64(node, *effect, *control);
430 break; 430 break;
431 case IrOpcode::kTruncateTaggedToFloat64: 431 case IrOpcode::kTruncateTaggedToFloat64:
432 state = LowerTruncateTaggedToFloat64(node, *effect, *control); 432 state = LowerTruncateTaggedToFloat64(node, *effect, *control);
433 break; 433 break;
434 case IrOpcode::kCheckBounds: 434 case IrOpcode::kCheckBounds:
435 state = LowerCheckBounds(node, frame_state, *effect, *control); 435 state = LowerCheckBounds(node, frame_state, *effect, *control);
436 break; 436 break;
437 case IrOpcode::kCheckNumber:
438 state = LowerCheckNumber(node, frame_state, *effect, *control);
439 break;
437 case IrOpcode::kCheckTaggedPointer: 440 case IrOpcode::kCheckTaggedPointer:
438 state = LowerCheckTaggedPointer(node, frame_state, *effect, *control); 441 state = LowerCheckTaggedPointer(node, frame_state, *effect, *control);
439 break; 442 break;
440 case IrOpcode::kCheckTaggedSigned: 443 case IrOpcode::kCheckTaggedSigned:
441 state = LowerCheckTaggedSigned(node, frame_state, *effect, *control); 444 state = LowerCheckTaggedSigned(node, frame_state, *effect, *control);
442 break; 445 break;
443 case IrOpcode::kCheckedInt32Add: 446 case IrOpcode::kCheckedInt32Add:
444 state = LowerCheckedInt32Add(node, frame_state, *effect, *control); 447 state = LowerCheckedInt32Add(node, frame_state, *effect, *control);
445 break; 448 break;
446 case IrOpcode::kCheckedInt32Sub: 449 case IrOpcode::kCheckedInt32Sub:
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, 806 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
804 frame_state, effect, control); 807 frame_state, effect, control);
805 808
806 // Make sure the lowered node does not appear in any use lists. 809 // Make sure the lowered node does not appear in any use lists.
807 node->TrimInputCount(0); 810 node->TrimInputCount(0);
808 811
809 return ValueEffectControl(index, effect, control); 812 return ValueEffectControl(index, effect, control);
810 } 813 }
811 814
812 EffectControlLinearizer::ValueEffectControl 815 EffectControlLinearizer::ValueEffectControl
816 EffectControlLinearizer::LowerCheckNumber(Node* node, Node* frame_state,
817 Node* effect, Node* control) {
818 Node* value = node->InputAt(0);
819
820 Node* check0 = ObjectIsSmi(value);
821 Node* branch0 =
822 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control);
823
824 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
825 Node* etrue0 = effect;
826
827 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
828 Node* efalse0 = effect;
829 {
830 Node* value_map = efalse0 =
831 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
832 value, efalse0, if_false0);
833 Node* check1 = graph()->NewNode(machine()->WordEqual(), value_map,
834 jsgraph()->HeapNumberMapConstant());
835 if_false0 = efalse0 = graph()->NewNode(common()->DeoptimizeUnless(), check1,
836 frame_state, efalse0, if_false0);
837 }
838
839 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
840 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control);
841
842 // Make sure the lowered node does not appear in any use lists.
843 node->TrimInputCount(0);
844
845 return ValueEffectControl(value, effect, control);
846 }
847
848 EffectControlLinearizer::ValueEffectControl
813 EffectControlLinearizer::LowerCheckTaggedPointer(Node* node, Node* frame_state, 849 EffectControlLinearizer::LowerCheckTaggedPointer(Node* node, Node* frame_state,
814 Node* effect, Node* control) { 850 Node* effect, Node* control) {
815 Node* value = node->InputAt(0); 851 Node* value = node->InputAt(0);
816 852
817 Node* check = ObjectIsSmi(value); 853 Node* check = ObjectIsSmi(value);
818 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, 854 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
819 frame_state, effect, control); 855 frame_state, effect, control);
820 856
821 // Make sure the lowered node does not appear in any use lists. 857 // Make sure the lowered node does not appear in any use lists.
822 node->TrimInputCount(0); 858 node->TrimInputCount(0);
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 1697 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
1662 Operator::kNoThrow); 1698 Operator::kNoThrow);
1663 to_number_operator_.set(common()->Call(desc)); 1699 to_number_operator_.set(common()->Call(desc));
1664 } 1700 }
1665 return to_number_operator_.get(); 1701 return to_number_operator_.get();
1666 } 1702 }
1667 1703
1668 } // namespace compiler 1704 } // namespace compiler
1669 } // namespace internal 1705 } // namespace internal
1670 } // namespace v8 1706 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698