| 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/compilation-dependencies.h" | 5 #include "src/compilation-dependencies.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.h" | 9 #include "src/compiler/node-properties.h" |
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 } | 691 } |
| 692 | 692 |
| 693 TEST(RemoveToNumberEffects) { | 693 TEST(RemoveToNumberEffects) { |
| 694 JSTypedLoweringTester R; | 694 JSTypedLoweringTester R; |
| 695 | 695 |
| 696 Node* effect_use = NULL; | 696 Node* effect_use = NULL; |
| 697 Node* zero = R.graph.NewNode(R.common.Int32Constant(0)); |
| 697 for (int i = 0; i < 10; i++) { | 698 for (int i = 0; i < 10; i++) { |
| 698 Node* p0 = R.Parameter(Type::Number()); | 699 Node* p0 = R.Parameter(Type::Number()); |
| 699 Node* ton = R.Unop(R.javascript.ToNumber(), p0); | 700 Node* ton = R.Unop(R.javascript.ToNumber(), p0); |
| 700 Node* frame_state = R.EmptyFrameState(R.context()); | 701 Node* frame_state = R.EmptyFrameState(R.context()); |
| 701 effect_use = NULL; | 702 effect_use = NULL; |
| 702 | 703 |
| 703 switch (i) { | 704 switch (i) { |
| 704 case 0: | 705 case 0: |
| 705 CHECK_EQ(1, OperatorProperties::GetFrameStateInputCount( | 706 CHECK_EQ(1, OperatorProperties::GetFrameStateInputCount( |
| 706 R.javascript.ToNumber())); | 707 R.javascript.ToNumber())); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 717 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); | 718 effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start()); |
| 718 case 3: | 719 case 3: |
| 719 effect_use = R.graph.NewNode(R.javascript.Add(R.binop_hints), ton, ton, | 720 effect_use = R.graph.NewNode(R.javascript.Add(R.binop_hints), ton, ton, |
| 720 R.context(), frame_state, ton, R.start()); | 721 R.context(), frame_state, ton, R.start()); |
| 721 break; | 722 break; |
| 722 case 4: | 723 case 4: |
| 723 effect_use = R.graph.NewNode(R.javascript.Add(R.binop_hints), p0, p0, | 724 effect_use = R.graph.NewNode(R.javascript.Add(R.binop_hints), p0, p0, |
| 724 R.context(), frame_state, ton, R.start()); | 725 R.context(), frame_state, ton, R.start()); |
| 725 break; | 726 break; |
| 726 case 5: | 727 case 5: |
| 727 effect_use = R.graph.NewNode(R.common.Return(), p0, ton, R.start()); | 728 effect_use = |
| 729 R.graph.NewNode(R.common.Return(), zero, p0, ton, R.start()); |
| 728 break; | 730 break; |
| 729 case 6: | 731 case 6: |
| 730 effect_use = R.graph.NewNode(R.common.Return(), ton, ton, R.start()); | 732 effect_use = |
| 733 R.graph.NewNode(R.common.Return(), zero, ton, ton, R.start()); |
| 731 } | 734 } |
| 732 | 735 |
| 733 R.CheckEffectInput(R.start(), ton); | 736 R.CheckEffectInput(R.start(), ton); |
| 734 if (effect_use != NULL) R.CheckEffectInput(ton, effect_use); | 737 if (effect_use != NULL) R.CheckEffectInput(ton, effect_use); |
| 735 | 738 |
| 736 Node* r = R.reduce(ton); | 739 Node* r = R.reduce(ton); |
| 737 CHECK_EQ(p0, r); | 740 CHECK_EQ(p0, r); |
| 738 CHECK_NE(R.start(), r); | 741 CHECK_NE(R.start(), r); |
| 739 | 742 |
| 740 if (effect_use != NULL) { | 743 if (effect_use != NULL) { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 CHECK_EQ(p1, r->InputAt(1)); | 1245 CHECK_EQ(p1, r->InputAt(1)); |
| 1243 } | 1246 } |
| 1244 } | 1247 } |
| 1245 } | 1248 } |
| 1246 } | 1249 } |
| 1247 } | 1250 } |
| 1248 | 1251 |
| 1249 } // namespace compiler | 1252 } // namespace compiler |
| 1250 } // namespace internal | 1253 } // namespace internal |
| 1251 } // namespace v8 | 1254 } // namespace v8 |
| OLD | NEW |