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

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

Issue 2064163002: Revert of [turbofan] Introduce a dedicated CheckBounds operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 break; 409 break;
410 case IrOpcode::kChangeTaggedToUint32: 410 case IrOpcode::kChangeTaggedToUint32:
411 state = LowerChangeTaggedToUint32(node, *effect, *control); 411 state = LowerChangeTaggedToUint32(node, *effect, *control);
412 break; 412 break;
413 case IrOpcode::kChangeTaggedToFloat64: 413 case IrOpcode::kChangeTaggedToFloat64:
414 state = LowerChangeTaggedToFloat64(node, *effect, *control); 414 state = LowerChangeTaggedToFloat64(node, *effect, *control);
415 break; 415 break;
416 case IrOpcode::kTruncateTaggedToFloat64: 416 case IrOpcode::kTruncateTaggedToFloat64:
417 state = LowerTruncateTaggedToFloat64(node, *effect, *control); 417 state = LowerTruncateTaggedToFloat64(node, *effect, *control);
418 break; 418 break;
419 case IrOpcode::kCheckBounds:
420 state = LowerCheckBounds(node, frame_state, *effect, *control);
421 break;
422 case IrOpcode::kCheckedUint32ToInt32: 419 case IrOpcode::kCheckedUint32ToInt32:
423 state = LowerCheckedUint32ToInt32(node, frame_state, *effect, *control); 420 state = LowerCheckedUint32ToInt32(node, frame_state, *effect, *control);
424 break; 421 break;
425 case IrOpcode::kCheckedFloat64ToInt32: 422 case IrOpcode::kCheckedFloat64ToInt32:
426 state = LowerCheckedFloat64ToInt32(node, frame_state, *effect, *control); 423 state = LowerCheckedFloat64ToInt32(node, frame_state, *effect, *control);
427 break; 424 break;
428 case IrOpcode::kCheckedTaggedToInt32: 425 case IrOpcode::kCheckedTaggedToInt32:
429 state = LowerCheckedTaggedToInt32(node, frame_state, *effect, *control); 426 state = LowerCheckedTaggedToInt32(node, frame_state, *effect, *control);
430 break; 427 break;
431 case IrOpcode::kCheckedTaggedToFloat64: 428 case IrOpcode::kCheckedTaggedToFloat64:
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 752
756 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 753 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
757 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 754 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
758 value = graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), 755 value = graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2),
759 vtrue, vfalse, control); 756 vtrue, vfalse, control);
760 757
761 return ValueEffectControl(value, effect, control); 758 return ValueEffectControl(value, effect, control);
762 } 759 }
763 760
764 EffectControlLinearizer::ValueEffectControl 761 EffectControlLinearizer::ValueEffectControl
765 EffectControlLinearizer::LowerCheckBounds(Node* node, Node* frame_state,
766 Node* effect, Node* control) {
767 Node* index = node->InputAt(0);
768 Node* limit = node->InputAt(1);
769
770 Node* check = graph()->NewNode(machine()->Uint32LessThan(), index, limit);
771 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
772 frame_state, effect, control);
773
774 // Make sure the lowered node does not appear in any use lists.
775 node->TrimInputCount(0);
776
777 return ValueEffectControl(index, effect, control);
778 }
779
780 EffectControlLinearizer::ValueEffectControl
781 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, 762 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node,
782 Node* frame_state, 763 Node* frame_state,
783 Node* effect, 764 Node* effect,
784 Node* control) { 765 Node* control) {
785 Node* value = node->InputAt(0); 766 Node* value = node->InputAt(0);
786 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max()); 767 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max());
787 Node* is_safe = 768 Node* is_safe =
788 graph()->NewNode(machine()->Uint32LessThanOrEqual(), value, max_int); 769 graph()->NewNode(machine()->Uint32LessThanOrEqual(), value, max_int);
789 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), is_safe, 770 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), is_safe,
790 frame_state, effect, control); 771 frame_state, effect, control);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 Node* branch = 839 Node* branch =
859 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 840 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
860 841
861 // In the Smi case, just convert to int32. 842 // In the Smi case, just convert to int32.
862 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 843 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
863 Node* etrue = effect; 844 Node* etrue = effect;
864 Node* vtrue = ChangeSmiToInt32(value); 845 Node* vtrue = ChangeSmiToInt32(value);
865 846
866 // In the non-Smi case, check the heap numberness, load the number and convert 847 // In the non-Smi case, check the heap numberness, load the number and convert
867 // to int32. 848 // to int32.
849 // TODO(jarin) Propagate/handle possible truncations here.
868 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 850 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
869 Node* efalse = effect; 851 ValueEffectControl number_state = BuildCheckedHeapNumberOrOddballToFloat64(
870 Node* vfalse; 852 value, frame_state, effect, if_false);
871 { 853 number_state =
872 Node* value_map = efalse = 854 BuildCheckedFloat64ToInt32(number_state.value, frame_state,
873 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), 855 number_state.effect, number_state.control);
874 value, efalse, if_false);
875 Node* check = graph()->NewNode(machine()->WordEqual(), value_map,
876 jsgraph()->HeapNumberMapConstant());
877 if_false = efalse = graph()->NewNode(common()->DeoptimizeUnless(), check,
878 frame_state, efalse, if_false);
879 vfalse = efalse = graph()->NewNode(
880 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
881 efalse, if_false);
882 ValueEffectControl state =
883 BuildCheckedFloat64ToInt32(vfalse, frame_state, efalse, if_false);
884 if_false = state.control;
885 efalse = state.effect;
886 vfalse = state.value;
887 }
888 856
889 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 857 Node* merge =
890 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 858 graph()->NewNode(common()->Merge(2), if_true, number_state.control);
891 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 859 Node* effect_phi = graph()->NewNode(common()->EffectPhi(2), etrue,
892 vtrue, vfalse, control); 860 number_state.effect, merge);
861 Node* result =
862 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), vtrue,
863 number_state.value, merge);
893 864
894 // Make sure the lowered node does not appear in any use lists. 865 // Make sure the lowered node does not appear in any use lists.
895 node->TrimInputCount(0); 866 node->TrimInputCount(0);
896 867
897 return ValueEffectControl(value, effect, control); 868 return ValueEffectControl(result, effect_phi, merge);
898 } 869 }
899 870
900 EffectControlLinearizer::ValueEffectControl 871 EffectControlLinearizer::ValueEffectControl
901 EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64( 872 EffectControlLinearizer::BuildCheckedHeapNumberOrOddballToFloat64(
902 Node* value, Node* frame_state, Node* effect, Node* control) { 873 Node* value, Node* frame_state, Node* effect, Node* control) {
903 Node* value_map = effect = graph()->NewNode( 874 Node* value_map = effect = graph()->NewNode(
904 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); 875 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control);
905 Node* check_number = graph()->NewNode(machine()->WordEqual(), value_map, 876 Node* check_number = graph()->NewNode(machine()->WordEqual(), value_map,
906 jsgraph()->HeapNumberMapConstant()); 877 jsgraph()->HeapNumberMapConstant());
907 878
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 1493 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
1523 Operator::kNoThrow); 1494 Operator::kNoThrow);
1524 to_number_operator_.set(common()->Call(desc)); 1495 to_number_operator_.set(common()->Call(desc));
1525 } 1496 }
1526 return to_number_operator_.get(); 1497 return to_number_operator_.get();
1527 } 1498 }
1528 1499
1529 } // namespace compiler 1500 } // namespace compiler
1530 } // namespace internal 1501 } // namespace internal
1531 } // namespace v8 1502 } // 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