OLD | NEW |
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/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return graph.NewNode(op, left, right, context(), start(), control()); | 116 return graph.NewNode(op, left, right, context(), start(), control()); |
117 } | 117 } |
118 | 118 |
119 Node* Unop(const Operator* op, Node* input) { | 119 Node* Unop(const Operator* op, Node* input) { |
120 // JS unops also require context, effect, and control | 120 // JS unops also require context, effect, and control |
121 return graph.NewNode(op, input, context(), start(), control()); | 121 return graph.NewNode(op, input, context(), start(), control()); |
122 } | 122 } |
123 | 123 |
124 Node* UseForEffect(Node* node) { | 124 Node* UseForEffect(Node* node) { |
125 // TODO(titzer): use EffectPhi after fixing EffectCount | 125 // TODO(titzer): use EffectPhi after fixing EffectCount |
126 return graph.NewNode(javascript.ToNumber(), node, context(), node, | 126 if (OperatorProperties::HasFrameStateInput(javascript.ToNumber())) { |
127 control()); | 127 return graph.NewNode(javascript.ToNumber(), node, context(), |
| 128 EmptyFrameState(context()), node, control()); |
| 129 } else { |
| 130 return graph.NewNode(javascript.ToNumber(), node, context(), node, |
| 131 control()); |
| 132 } |
128 } | 133 } |
129 | 134 |
130 void CheckEffectInput(Node* effect, Node* use) { | 135 void CheckEffectInput(Node* effect, Node* use) { |
131 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); | 136 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); |
132 } | 137 } |
133 | 138 |
134 void CheckInt32Constant(int32_t expected, Node* result) { | 139 void CheckInt32Constant(int32_t expected, Node* result) { |
135 CHECK_EQ(IrOpcode::kInt32Constant, result->opcode()); | 140 CHECK_EQ(IrOpcode::kInt32Constant, result->opcode()); |
136 CHECK_EQ(expected, OpParameter<int32_t>(result)); | 141 CHECK_EQ(expected, OpParameter<int32_t>(result)); |
137 } | 142 } |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 735 |
731 Node* effect_use = NULL; | 736 Node* effect_use = NULL; |
732 for (int i = 0; i < 10; i++) { | 737 for (int i = 0; i < 10; i++) { |
733 Node* p0 = R.Parameter(Type::Number()); | 738 Node* p0 = R.Parameter(Type::Number()); |
734 Node* ton = R.Unop(R.javascript.ToNumber(), p0); | 739 Node* ton = R.Unop(R.javascript.ToNumber(), p0); |
735 Node* frame_state = R.EmptyFrameState(R.context()); | 740 Node* frame_state = R.EmptyFrameState(R.context()); |
736 effect_use = NULL; | 741 effect_use = NULL; |
737 | 742 |
738 switch (i) { | 743 switch (i) { |
739 case 0: | 744 case 0: |
| 745 // TODO(jarin) Replace with a query of FLAG_turbo_deoptimization. |
| 746 if (OperatorProperties::HasFrameStateInput(R.javascript.ToNumber())) { |
| 747 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), |
| 748 frame_state, ton, R.start()); |
| 749 } else { |
740 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), | 750 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), |
741 ton, R.start()); | 751 ton, R.start()); |
| 752 } |
742 break; | 753 break; |
743 case 1: | 754 case 1: |
744 effect_use = R.graph.NewNode(R.javascript.ToNumber(), ton, R.context(), | 755 // TODO(jarin) Replace with a query of FLAG_turbo_deoptimization. |
745 ton, R.start()); | 756 if (OperatorProperties::HasFrameStateInput(R.javascript.ToNumber())) { |
| 757 effect_use = |
| 758 R.graph.NewNode(R.javascript.ToNumber(), ton, R.context(), |
| 759 frame_state, ton, R.start()); |
| 760 } else { |
| 761 effect_use = R.graph.NewNode(R.javascript.ToNumber(), ton, |
| 762 R.context(), ton, R.start()); |
| 763 } |
746 break; | 764 break; |
747 case 2: | 765 case 2: |
748 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); | 766 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); |
749 case 3: | 767 case 3: |
750 effect_use = R.graph.NewNode(R.javascript.Add(), ton, ton, R.context(), | 768 effect_use = R.graph.NewNode(R.javascript.Add(), ton, ton, R.context(), |
751 frame_state, ton, R.start()); | 769 frame_state, ton, R.start()); |
752 break; | 770 break; |
753 case 4: | 771 case 4: |
754 effect_use = R.graph.NewNode(R.javascript.Add(), p0, p0, R.context(), | 772 effect_use = R.graph.NewNode(R.javascript.Add(), p0, p0, R.context(), |
755 frame_state, ton, R.start()); | 773 frame_state, ton, R.start()); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 CHECK_EQ(p1, r->InputAt(0)); | 1275 CHECK_EQ(p1, r->InputAt(0)); |
1258 CHECK_EQ(p0, r->InputAt(1)); | 1276 CHECK_EQ(p0, r->InputAt(1)); |
1259 } else { | 1277 } else { |
1260 CHECK_EQ(p0, r->InputAt(0)); | 1278 CHECK_EQ(p0, r->InputAt(0)); |
1261 CHECK_EQ(p1, r->InputAt(1)); | 1279 CHECK_EQ(p1, r->InputAt(1)); |
1262 } | 1280 } |
1263 } | 1281 } |
1264 } | 1282 } |
1265 } | 1283 } |
1266 } | 1284 } |
OLD | NEW |