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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 Node* UseForEffect(Node* node) { | 163 Node* UseForEffect(Node* node) { |
164 Node* merge = graph.NewNode(common.Merge(1), start()); | 164 Node* merge = graph.NewNode(common.Merge(1), start()); |
165 return graph.NewNode(common.EffectPhi(1), node, merge); | 165 return graph.NewNode(common.EffectPhi(1), node, merge); |
166 } | 166 } |
167 | 167 |
168 void CheckEffectInput(Node* effect, Node* use) { | 168 void CheckEffectInput(Node* effect, Node* use) { |
169 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); | 169 CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); |
170 } | 170 } |
171 | 171 |
172 void CheckInt32Constant(int32_t expected, Node* result) { | |
173 CHECK_EQ(IrOpcode::kInt32Constant, result->opcode()); | |
174 CHECK_EQ(expected, OpParameter<int32_t>(result)); | |
175 } | |
176 | |
177 void CheckNumberConstant(double expected, Node* result) { | 172 void CheckNumberConstant(double expected, Node* result) { |
178 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); | 173 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); |
179 CHECK_EQ(expected, OpParameter<double>(result)); | 174 CHECK_EQ(expected, OpParameter<double>(result)); |
180 } | 175 } |
181 | 176 |
182 void CheckNaN(Node* result) { | 177 void CheckNaN(Node* result) { |
183 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); | 178 CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); |
184 double value = OpParameter<double>(result); | 179 double value = OpParameter<double>(result); |
185 CHECK(std::isnan(value)); | 180 CHECK(std::isnan(value)); |
186 } | 181 } |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 } | 682 } |
688 } | 683 } |
689 } | 684 } |
690 } | 685 } |
691 } | 686 } |
692 | 687 |
693 TEST(RemoveToNumberEffects) { | 688 TEST(RemoveToNumberEffects) { |
694 JSTypedLoweringTester R; | 689 JSTypedLoweringTester R; |
695 | 690 |
696 Node* effect_use = NULL; | 691 Node* effect_use = NULL; |
697 Node* zero = R.graph.NewNode(R.common.Int32Constant(0)); | 692 Node* zero = R.graph.NewNode(R.common.NumberConstant(0)); |
698 for (int i = 0; i < 10; i++) { | 693 for (int i = 0; i < 10; i++) { |
699 Node* p0 = R.Parameter(Type::Number()); | 694 Node* p0 = R.Parameter(Type::Number()); |
700 Node* ton = R.Unop(R.javascript.ToNumber(), p0); | 695 Node* ton = R.Unop(R.javascript.ToNumber(), p0); |
701 Node* frame_state = R.EmptyFrameState(R.context()); | 696 Node* frame_state = R.EmptyFrameState(R.context()); |
702 effect_use = NULL; | 697 effect_use = NULL; |
703 | 698 |
704 switch (i) { | 699 switch (i) { |
705 case 0: | 700 case 0: |
706 CHECK_EQ(1, OperatorProperties::GetFrameStateInputCount( | 701 CHECK_EQ(1, OperatorProperties::GetFrameStateInputCount( |
707 R.javascript.ToNumber())); | 702 R.javascript.ToNumber())); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 CHECK_EQ(p1, r->InputAt(1)); | 1240 CHECK_EQ(p1, r->InputAt(1)); |
1246 } | 1241 } |
1247 } | 1242 } |
1248 } | 1243 } |
1249 } | 1244 } |
1250 } | 1245 } |
1251 | 1246 |
1252 } // namespace compiler | 1247 } // namespace compiler |
1253 } // namespace internal | 1248 } // namespace internal |
1254 } // namespace v8 | 1249 } // namespace v8 |
OLD | NEW |