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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 TEST(OrderCompareEffects) { | 990 TEST(OrderCompareEffects) { |
991 JSTypedLoweringTester R; | 991 JSTypedLoweringTester R; |
992 | 992 |
993 const Operator* ops[] = { | 993 const Operator* ops[] = { |
994 R.javascript.GreaterThan(R.compare_hints), R.simplified.NumberLessThan(), | 994 R.javascript.GreaterThan(R.compare_hints), R.simplified.NumberLessThan(), |
995 R.javascript.GreaterThanOrEqual(R.compare_hints), | 995 R.javascript.GreaterThanOrEqual(R.compare_hints), |
996 R.simplified.NumberLessThanOrEqual(), | 996 R.simplified.NumberLessThanOrEqual(), |
997 }; | 997 }; |
998 | 998 |
999 for (size_t j = 0; j < arraysize(ops); j += 2) { | 999 for (size_t j = 0; j < arraysize(ops); j += 2) { |
1000 BinopEffectsTester B(ops[j], Type::Symbol(), Type::String()); | 1000 BinopEffectsTester B(ops[j], Type::Symbol(), Type::String(), |
| 1001 JSTypedLowering::kNoFlags); |
1001 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); | 1002 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); |
1002 | 1003 |
1003 Node* i0 = B.CheckConvertedInput(IrOpcode::kStringToNumber, 0, false); | 1004 Node* i0 = B.CheckConvertedInput(IrOpcode::kStringToNumber, 0, false); |
1004 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 1005 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
1005 | 1006 |
1006 // Inputs should be commuted. | 1007 // Inputs should be commuted. |
1007 CHECK_EQ(B.p1, i0->InputAt(0)); | 1008 CHECK_EQ(B.p1, i0->InputAt(0)); |
1008 CHECK_EQ(B.p0, i1->InputAt(0)); | 1009 CHECK_EQ(B.p0, i1->InputAt(0)); |
1009 | 1010 |
1010 // But effects should be ordered start -> i1 -> effect_use | 1011 // But effects should be ordered start -> i1 -> effect_use |
1011 B.CheckEffectOrdering(i1); | 1012 B.CheckEffectOrdering(i1); |
1012 } | 1013 } |
1013 | 1014 |
1014 for (size_t j = 0; j < arraysize(ops); j += 2) { | 1015 for (size_t j = 0; j < arraysize(ops); j += 2) { |
1015 BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol()); | 1016 BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol(), |
| 1017 JSTypedLowering::kNoFlags); |
1016 | 1018 |
1017 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); | 1019 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); |
1018 Node* i1 = B.result->InputAt(1); | 1020 Node* i1 = B.result->InputAt(1); |
1019 | 1021 |
1020 CHECK_EQ(B.p1, i0->InputAt(0)); // Should be commuted. | 1022 CHECK_EQ(B.p1, i0->InputAt(0)); // Should be commuted. |
1021 CHECK_EQ(B.p0, i1); | 1023 CHECK_EQ(B.p0, i1); |
1022 | 1024 |
1023 // Effects should be ordered start -> i1 -> effect_use | 1025 // Effects should be ordered start -> i1 -> effect_use |
1024 B.CheckEffectOrdering(i0); | 1026 B.CheckEffectOrdering(i0); |
1025 } | 1027 } |
1026 | 1028 |
1027 for (size_t j = 0; j < arraysize(ops); j += 2) { | 1029 for (size_t j = 0; j < arraysize(ops); j += 2) { |
1028 BinopEffectsTester B(ops[j], Type::Symbol(), Type::Number()); | 1030 BinopEffectsTester B(ops[j], Type::Symbol(), Type::Number(), |
| 1031 JSTypedLowering::kNoFlags); |
1029 | 1032 |
1030 Node* i0 = B.result->InputAt(0); | 1033 Node* i0 = B.result->InputAt(0); |
1031 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 1034 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
1032 | 1035 |
1033 CHECK_EQ(B.p1, i0); // Should be commuted. | 1036 CHECK_EQ(B.p1, i0); // Should be commuted. |
1034 CHECK_EQ(B.p0, i1->InputAt(0)); | 1037 CHECK_EQ(B.p0, i1->InputAt(0)); |
1035 | 1038 |
1036 // Effects should be ordered start -> i0 -> effect_use | 1039 // Effects should be ordered start -> i0 -> effect_use |
1037 B.CheckEffectOrdering(i1); | 1040 B.CheckEffectOrdering(i1); |
1038 } | 1041 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 CHECK_EQ(p1, r->InputAt(1)); | 1233 CHECK_EQ(p1, r->InputAt(1)); |
1231 } | 1234 } |
1232 } | 1235 } |
1233 } | 1236 } |
1234 } | 1237 } |
1235 } | 1238 } |
1236 | 1239 |
1237 } // namespace compiler | 1240 } // namespace compiler |
1238 } // namespace internal | 1241 } // namespace internal |
1239 } // namespace v8 | 1242 } // namespace v8 |
OLD | NEW |