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/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 | 1017 |
1018 const Operator* ops[] = { | 1018 const Operator* ops[] = { |
1019 R.javascript.Add(), R.simplified.NumberAdd(), | 1019 R.javascript.Add(), R.simplified.NumberAdd(), |
1020 R.javascript.Subtract(), R.simplified.NumberSubtract(), | 1020 R.javascript.Subtract(), R.simplified.NumberSubtract(), |
1021 R.javascript.Multiply(), R.simplified.NumberMultiply(), | 1021 R.javascript.Multiply(), R.simplified.NumberMultiply(), |
1022 R.javascript.Divide(), R.simplified.NumberDivide(), | 1022 R.javascript.Divide(), R.simplified.NumberDivide(), |
1023 R.javascript.Modulus(), R.simplified.NumberModulus(), | 1023 R.javascript.Modulus(), R.simplified.NumberModulus(), |
1024 }; | 1024 }; |
1025 | 1025 |
1026 for (size_t j = 0; j < arraysize(ops); j += 2) { | 1026 for (size_t j = 0; j < arraysize(ops); j += 2) { |
1027 BinopEffectsTester B(ops[j], Type::Number(), Type::Object()); | 1027 BinopEffectsTester B(ops[j], Type::Number(), Type::Boolean()); |
1028 | 1028 |
1029 Node* i0 = B.CheckNoOp(0); | 1029 Node* i0 = B.CheckNoOp(0); |
1030 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 1030 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
1031 | 1031 |
1032 CHECK_EQ(B.p0, i0); | 1032 CHECK_EQ(B.p0, i0); |
1033 CHECK_EQ(B.p1, i1->InputAt(0)); | 1033 CHECK_EQ(B.p1, i1->InputAt(0)); |
1034 | 1034 |
1035 // Effects should be ordered start -> i1 -> effect_use | 1035 // Effects should be ordered start -> i1 -> effect_use |
1036 B.CheckEffectOrdering(i1); | 1036 B.CheckEffectOrdering(i1); |
1037 } | 1037 } |
1038 | 1038 |
1039 for (size_t j = 0; j < arraysize(ops); j += 2) { | 1039 for (size_t j = 0; j < arraysize(ops); j += 2) { |
1040 BinopEffectsTester B(ops[j], Type::Object(), Type::Number()); | 1040 BinopEffectsTester B(ops[j], Type::Boolean(), Type::Number()); |
1041 | 1041 |
1042 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); | 1042 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); |
1043 Node* i1 = B.CheckNoOp(1); | 1043 Node* i1 = B.CheckNoOp(1); |
1044 | 1044 |
1045 CHECK_EQ(B.p0, i0->InputAt(0)); | 1045 CHECK_EQ(B.p0, i0->InputAt(0)); |
1046 CHECK_EQ(B.p1, i1); | 1046 CHECK_EQ(B.p1, i1); |
1047 | 1047 |
1048 // Effects should be ordered start -> i0 -> effect_use | 1048 // Effects should be ordered start -> i0 -> effect_use |
1049 B.CheckEffectOrdering(i0); | 1049 B.CheckEffectOrdering(i0); |
1050 } | 1050 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 CHECK_EQ(p1, r->InputAt(0)); | 1343 CHECK_EQ(p1, r->InputAt(0)); |
1344 CHECK_EQ(p0, r->InputAt(1)); | 1344 CHECK_EQ(p0, r->InputAt(1)); |
1345 } else { | 1345 } else { |
1346 CHECK_EQ(p0, r->InputAt(0)); | 1346 CHECK_EQ(p0, r->InputAt(0)); |
1347 CHECK_EQ(p1, r->InputAt(1)); | 1347 CHECK_EQ(p1, r->InputAt(1)); |
1348 } | 1348 } |
1349 } | 1349 } |
1350 } | 1350 } |
1351 } | 1351 } |
1352 } | 1352 } |
OLD | NEW |