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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2829093002: [turbofan] Avoid creating singleton state-values for the accumulator. (Closed)
Patch Set: Improve comment Created 3 years, 8 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/js-graph.cc ('k') | src/compiler/verifier.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 (*types)[i] = 1066 (*types)[i] =
1067 DeoptMachineTypeOf(GetInfo(input)->representation(), TypeOf(input)); 1067 DeoptMachineTypeOf(GetInfo(input)->representation(), TypeOf(input));
1068 } 1068 }
1069 SparseInputMask mask = SparseInputMaskOf(node->op()); 1069 SparseInputMask mask = SparseInputMaskOf(node->op());
1070 NodeProperties::ChangeOp( 1070 NodeProperties::ChangeOp(
1071 node, jsgraph_->common()->TypedStateValues(types, mask)); 1071 node, jsgraph_->common()->TypedStateValues(types, mask));
1072 } 1072 }
1073 SetOutput(node, MachineRepresentation::kTagged); 1073 SetOutput(node, MachineRepresentation::kTagged);
1074 } 1074 }
1075 1075
1076 void VisitFrameState(Node* node) {
1077 DCHECK_EQ(5, node->op()->ValueInputCount());
1078 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
1079
1080 ProcessInput(node, 0, UseInfo::AnyTagged()); // Parameters.
1081 ProcessInput(node, 1, UseInfo::AnyTagged()); // Registers.
1082
1083 // Expression stack/accumulator.
1084 if (node->InputAt(2)->opcode() == IrOpcode::kStateValues ||
1085 node->InputAt(2)->opcode() == IrOpcode::kTypedStateValues) {
1086 // TODO(turbofan): This should only be produced by AST graph builder.
1087 // Remove once we switch to bytecode graph builder exclusively.
1088 ProcessInput(node, 2, UseInfo::AnyTagged());
1089 } else {
1090 // Accumulator is a special flower - we need to remember its type in
1091 // a singleton typed-state-values node (as if it was a singleton
1092 // state-values node).
1093 if (propagate()) {
1094 EnqueueInput(node, 2, UseInfo::Any());
1095 } else if (lower()) {
1096 Zone* zone = jsgraph_->zone();
1097 Node* accumulator = node->InputAt(2);
1098 if (accumulator == jsgraph_->OptimizedOutConstant()) {
1099 node->ReplaceInput(2, jsgraph_->SingleDeadTypedStateValues());
1100 } else {
1101 ZoneVector<MachineType>* types =
1102 new (zone->New(sizeof(ZoneVector<MachineType>)))
1103 ZoneVector<MachineType>(1, zone);
1104 (*types)[0] = DeoptMachineTypeOf(
1105 GetInfo(accumulator)->representation(), TypeOf(accumulator));
1106
1107 node->ReplaceInput(2, jsgraph_->graph()->NewNode(
1108 jsgraph_->common()->TypedStateValues(
1109 types, SparseInputMask::Dense()),
1110 accumulator));
1111 }
1112 }
1113 }
1114
1115 ProcessInput(node, 3, UseInfo::AnyTagged()); // Context.
1116 ProcessInput(node, 4, UseInfo::AnyTagged()); // Closure.
1117 ProcessInput(node, 5, UseInfo::AnyTagged()); // Outer frame state.
1118 return SetOutput(node, MachineRepresentation::kTagged);
1119 }
1120
1076 void VisitObjectState(Node* node) { 1121 void VisitObjectState(Node* node) {
1077 if (propagate()) { 1122 if (propagate()) {
1078 for (int i = 0; i < node->InputCount(); i++) { 1123 for (int i = 0; i < node->InputCount(); i++) {
1079 Node* input = node->InputAt(i); 1124 Node* input = node->InputAt(i);
1080 Type* input_type = TypeOf(input); 1125 Type* input_type = TypeOf(input);
1081 // TODO(turbofan): Special treatment for ExternalPointer here, 1126 // TODO(turbofan): Special treatment for ExternalPointer here,
1082 // to avoid incompatible truncations. We really need a story 1127 // to avoid incompatible truncations. We really need a story
1083 // for the JSFunction::entry field. 1128 // for the JSFunction::entry field.
1084 UseInfo use_info = UseInfo::None(); 1129 UseInfo use_info = UseInfo::None();
1085 if (input_type->IsInhabited()) { 1130 if (input_type->IsInhabited()) {
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 ProcessRemainingInputs(node, 4); 2809 ProcessRemainingInputs(node, 4);
2765 SetOutput(node, MachineRepresentation::kTaggedPointer); 2810 SetOutput(node, MachineRepresentation::kTaggedPointer);
2766 return; 2811 return;
2767 } 2812 }
2768 2813
2769 case IrOpcode::kNumberSilenceNaN: 2814 case IrOpcode::kNumberSilenceNaN:
2770 VisitUnop(node, UseInfo::TruncatingFloat64(), 2815 VisitUnop(node, UseInfo::TruncatingFloat64(),
2771 MachineRepresentation::kFloat64); 2816 MachineRepresentation::kFloat64);
2772 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 2817 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
2773 return; 2818 return;
2819 case IrOpcode::kFrameState:
2820 return VisitFrameState(node);
2774 case IrOpcode::kStateValues: 2821 case IrOpcode::kStateValues:
2775 return VisitStateValues(node); 2822 return VisitStateValues(node);
2776 case IrOpcode::kObjectState: 2823 case IrOpcode::kObjectState:
2777 return VisitObjectState(node); 2824 return VisitObjectState(node);
2778 case IrOpcode::kTypeGuard: { 2825 case IrOpcode::kTypeGuard: {
2779 // We just get rid of the sigma here. In principle, it should be 2826 // We just get rid of the sigma here. In principle, it should be
2780 // possible to refine the truncation and representation based on 2827 // possible to refine the truncation and representation based on
2781 // the sigma's type. 2828 // the sigma's type.
2782 MachineRepresentation output = 2829 MachineRepresentation output =
2783 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); 2830 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation);
(...skipping 18 matching lines...) Expand all
2802 // Operators with all inputs tagged and no or tagged output have uniform 2849 // Operators with all inputs tagged and no or tagged output have uniform
2803 // handling. 2850 // handling.
2804 case IrOpcode::kEnd: 2851 case IrOpcode::kEnd:
2805 case IrOpcode::kIfSuccess: 2852 case IrOpcode::kIfSuccess:
2806 case IrOpcode::kIfException: 2853 case IrOpcode::kIfException:
2807 case IrOpcode::kIfTrue: 2854 case IrOpcode::kIfTrue:
2808 case IrOpcode::kIfFalse: 2855 case IrOpcode::kIfFalse:
2809 case IrOpcode::kDeoptimize: 2856 case IrOpcode::kDeoptimize:
2810 case IrOpcode::kEffectPhi: 2857 case IrOpcode::kEffectPhi:
2811 case IrOpcode::kTerminate: 2858 case IrOpcode::kTerminate:
2812 case IrOpcode::kFrameState:
2813 case IrOpcode::kCheckpoint: 2859 case IrOpcode::kCheckpoint:
2814 case IrOpcode::kLoop: 2860 case IrOpcode::kLoop:
2815 case IrOpcode::kMerge: 2861 case IrOpcode::kMerge:
2816 case IrOpcode::kThrow: 2862 case IrOpcode::kThrow:
2817 case IrOpcode::kBeginRegion: 2863 case IrOpcode::kBeginRegion:
2818 case IrOpcode::kProjection: 2864 case IrOpcode::kProjection:
2819 case IrOpcode::kOsrValue: 2865 case IrOpcode::kOsrValue:
2820 case IrOpcode::kArgumentsElementsState: 2866 case IrOpcode::kArgumentsElementsState:
2821 case IrOpcode::kArgumentsLengthState: 2867 case IrOpcode::kArgumentsLengthState:
2822 // All JavaScript operators except JSToNumber have uniform handling. 2868 // All JavaScript operators except JSToNumber have uniform handling.
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3721 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3676 Operator::kNoProperties); 3722 Operator::kNoProperties);
3677 to_number_operator_.set(common()->Call(desc)); 3723 to_number_operator_.set(common()->Call(desc));
3678 } 3724 }
3679 return to_number_operator_.get(); 3725 return to_number_operator_.get();
3680 } 3726 }
3681 3727
3682 } // namespace compiler 3728 } // namespace compiler
3683 } // namespace internal 3729 } // namespace internal
3684 } // namespace v8 3730 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-graph.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698