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/js-graph.h" | 5 #include "src/compiler/js-graph.h" |
6 #include "src/compiler/js-typed-lowering.h" | 6 #include "src/compiler/js-typed-lowering.h" |
7 #include "src/compiler/machine-operator.h" | 7 #include "src/compiler/machine-operator.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 // No reduction of mixed types. | 705 // No reduction of mixed types. |
706 CHECK_EQ(r->op(), less_than); | 706 CHECK_EQ(r->op(), less_than); |
707 } | 707 } |
708 } | 708 } |
709 } | 709 } |
710 } | 710 } |
711 } | 711 } |
712 | 712 |
713 | 713 |
714 TEST_WITH_STRONG(RemoveToNumberEffects) { | 714 TEST_WITH_STRONG(RemoveToNumberEffects) { |
715 FLAG_turbo_deoptimization = true; | |
716 | |
717 JSTypedLoweringTester R; | 715 JSTypedLoweringTester R; |
718 | 716 |
719 Node* effect_use = NULL; | 717 Node* effect_use = NULL; |
720 for (int i = 0; i < 10; i++) { | 718 for (int i = 0; i < 10; i++) { |
721 Node* p0 = R.Parameter(Type::Number()); | 719 Node* p0 = R.Parameter(Type::Number()); |
722 Node* ton = R.Unop(R.javascript.ToNumber(), p0); | 720 Node* ton = R.Unop(R.javascript.ToNumber(), p0); |
723 Node* frame_state = R.EmptyFrameState(R.context()); | 721 Node* frame_state = R.EmptyFrameState(R.context()); |
724 effect_use = NULL; | 722 effect_use = NULL; |
725 | 723 |
726 switch (i) { | 724 switch (i) { |
727 case 0: | 725 case 0: |
728 if (FLAG_turbo_deoptimization) { | 726 DCHECK(OperatorProperties::GetFrameStateInputCount( |
729 DCHECK(OperatorProperties::GetFrameStateInputCount( | 727 R.javascript.ToNumber()) == 1); |
730 R.javascript.ToNumber()) == 1); | |
731 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), | |
732 frame_state, ton, R.start()); | |
733 } else { | |
734 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), | 728 effect_use = R.graph.NewNode(R.javascript.ToNumber(), p0, R.context(), |
735 ton, R.start()); | 729 frame_state, ton, R.start()); |
736 } | |
737 break; | 730 break; |
738 case 1: | 731 case 1: |
739 if (FLAG_turbo_deoptimization) { | 732 DCHECK(OperatorProperties::GetFrameStateInputCount( |
740 DCHECK(OperatorProperties::GetFrameStateInputCount( | 733 R.javascript.ToNumber()) == 1); |
741 R.javascript.ToNumber()) == 1); | 734 effect_use = R.graph.NewNode(R.javascript.ToNumber(), ton, R.context(), |
742 effect_use = | 735 frame_state, ton, R.start()); |
743 R.graph.NewNode(R.javascript.ToNumber(), ton, R.context(), | |
744 frame_state, ton, R.start()); | |
745 } else { | |
746 effect_use = R.graph.NewNode(R.javascript.ToNumber(), ton, | |
747 R.context(), ton, R.start()); | |
748 } | |
749 break; | 736 break; |
750 case 2: | 737 case 2: |
751 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); | 738 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); |
752 case 3: | 739 case 3: |
753 effect_use = R.graph.NewNode(R.javascript.Add(language_mode), ton, ton, | 740 effect_use = R.graph.NewNode(R.javascript.Add(language_mode), ton, ton, |
754 R.context(), frame_state, frame_state, ton, | 741 R.context(), frame_state, frame_state, ton, |
755 R.start()); | 742 R.start()); |
756 break; | 743 break; |
757 case 4: | 744 case 4: |
758 effect_use = R.graph.NewNode(R.javascript.Add(language_mode), p0, p0, | 745 effect_use = R.graph.NewNode(R.javascript.Add(language_mode), p0, p0, |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 CHECK_EQ(p1, r->InputAt(0)); | 1261 CHECK_EQ(p1, r->InputAt(0)); |
1275 CHECK_EQ(p0, r->InputAt(1)); | 1262 CHECK_EQ(p0, r->InputAt(1)); |
1276 } else { | 1263 } else { |
1277 CHECK_EQ(p0, r->InputAt(0)); | 1264 CHECK_EQ(p0, r->InputAt(0)); |
1278 CHECK_EQ(p1, r->InputAt(1)); | 1265 CHECK_EQ(p1, r->InputAt(1)); |
1279 } | 1266 } |
1280 } | 1267 } |
1281 } | 1268 } |
1282 } | 1269 } |
1283 } | 1270 } |
OLD | NEW |