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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 605 } |
606 } | 606 } |
607 } | 607 } |
608 } | 608 } |
609 } | 609 } |
610 | 610 |
611 | 611 |
612 static void CheckIsConvertedToNumber(Node* val, Node* converted) { | 612 static void CheckIsConvertedToNumber(Node* val, Node* converted) { |
613 if (NodeProperties::GetType(val)->Is(Type::Number())) { | 613 if (NodeProperties::GetType(val)->Is(Type::Number())) { |
614 CHECK_EQ(val, converted); | 614 CHECK_EQ(val, converted); |
615 } else if (NodeProperties::GetType(val)->Is(Type::Boolean())) { | |
616 CHECK_EQ(IrOpcode::kBooleanToNumber, converted->opcode()); | |
617 CHECK_EQ(val, converted->InputAt(0)); | |
618 } else { | 615 } else { |
619 if (converted->opcode() == IrOpcode::kNumberConstant) return; | 616 if (converted->opcode() == IrOpcode::kNumberConstant) return; |
620 CHECK_EQ(IrOpcode::kJSToNumber, converted->opcode()); | 617 CHECK_EQ(IrOpcode::kJSToNumber, converted->opcode()); |
621 CHECK_EQ(val, converted->InputAt(0)); | 618 CHECK_EQ(val, converted->InputAt(0)); |
622 } | 619 } |
623 } | 620 } |
624 | 621 |
625 TEST(NumberComparison) { | 622 TEST(NumberComparison) { |
626 JSTypedLoweringTester R; | 623 JSTypedLoweringTester R; |
627 | 624 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 R.javascript.GreaterThan(R.compare_hints), R.simplified.NumberLessThan(), | 991 R.javascript.GreaterThan(R.compare_hints), R.simplified.NumberLessThan(), |
995 R.javascript.GreaterThanOrEqual(R.compare_hints), | 992 R.javascript.GreaterThanOrEqual(R.compare_hints), |
996 R.simplified.NumberLessThanOrEqual(), | 993 R.simplified.NumberLessThanOrEqual(), |
997 }; | 994 }; |
998 | 995 |
999 for (size_t j = 0; j < arraysize(ops); j += 2) { | 996 for (size_t j = 0; j < arraysize(ops); j += 2) { |
1000 BinopEffectsTester B(ops[j], Type::Symbol(), Type::String(), | 997 BinopEffectsTester B(ops[j], Type::Symbol(), Type::String(), |
1001 JSTypedLowering::kNoFlags); | 998 JSTypedLowering::kNoFlags); |
1002 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); | 999 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); |
1003 | 1000 |
1004 Node* i0 = B.CheckConvertedInput(IrOpcode::kStringToNumber, 0, false); | 1001 Node* i0 = |
| 1002 B.CheckConvertedInput(IrOpcode::kPlainPrimitiveToNumber, 0, false); |
1005 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 1003 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
1006 | 1004 |
1007 // Inputs should be commuted. | 1005 // Inputs should be commuted. |
1008 CHECK_EQ(B.p1, i0->InputAt(0)); | 1006 CHECK_EQ(B.p1, i0->InputAt(0)); |
1009 CHECK_EQ(B.p0, i1->InputAt(0)); | 1007 CHECK_EQ(B.p0, i1->InputAt(0)); |
1010 | 1008 |
1011 // But effects should be ordered start -> i1 -> effect_use | 1009 // But effects should be ordered start -> i1 -> effect_use |
1012 B.CheckEffectOrdering(i1); | 1010 B.CheckEffectOrdering(i1); |
1013 } | 1011 } |
1014 | 1012 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 CHECK_EQ(p1, r->InputAt(1)); | 1231 CHECK_EQ(p1, r->InputAt(1)); |
1234 } | 1232 } |
1235 } | 1233 } |
1236 } | 1234 } |
1237 } | 1235 } |
1238 } | 1236 } |
1239 | 1237 |
1240 } // namespace compiler | 1238 } // namespace compiler |
1241 } // namespace internal | 1239 } // namespace internal |
1242 } // namespace v8 | 1240 } // namespace v8 |
OLD | NEW |