| 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 } | 922 } |
| 923 } | 923 } |
| 924 | 924 |
| 925 | 925 |
| 926 TEST(OrderNumberBinopEffects1) { | 926 TEST(OrderNumberBinopEffects1) { |
| 927 JSTypedLoweringTester R; | 927 JSTypedLoweringTester R; |
| 928 | 928 |
| 929 const Operator* ops[] = { | 929 const Operator* ops[] = { |
| 930 R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), | 930 R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), |
| 931 R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), | 931 R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), |
| 932 R.javascript.Divide(R.binop_hints), R.simplified.NumberDivide(), | |
| 933 }; | 932 }; |
| 934 | 933 |
| 935 for (size_t j = 0; j < arraysize(ops); j += 2) { | 934 for (size_t j = 0; j < arraysize(ops); j += 2) { |
| 936 BinopEffectsTester B(ops[j], Type::Symbol(), Type::Symbol(), | 935 BinopEffectsTester B(ops[j], Type::Symbol(), Type::Symbol(), |
| 937 JSTypedLowering::kNoFlags); | 936 JSTypedLowering::kNoFlags); |
| 938 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); | 937 CHECK_EQ(ops[j + 1]->opcode(), B.result->op()->opcode()); |
| 939 | 938 |
| 940 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); | 939 Node* i0 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 0, true); |
| 941 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 940 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
| 942 | 941 |
| 943 CHECK_EQ(B.p0, i0->InputAt(0)); | 942 CHECK_EQ(B.p0, i0->InputAt(0)); |
| 944 CHECK_EQ(B.p1, i1->InputAt(0)); | 943 CHECK_EQ(B.p1, i1->InputAt(0)); |
| 945 | 944 |
| 946 // Effects should be ordered start -> i0 -> i1 -> effect_use | 945 // Effects should be ordered start -> i0 -> i1 -> effect_use |
| 947 B.CheckEffectOrdering(i0, i1); | 946 B.CheckEffectOrdering(i0, i1); |
| 948 } | 947 } |
| 949 } | 948 } |
| 950 | 949 |
| 951 | 950 |
| 952 TEST(OrderNumberBinopEffects2) { | 951 TEST(OrderNumberBinopEffects2) { |
| 953 JSTypedLoweringTester R; | 952 JSTypedLoweringTester R; |
| 954 | 953 |
| 955 const Operator* ops[] = { | 954 const Operator* ops[] = { |
| 956 R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), | 955 R.javascript.Add(R.binop_hints), R.simplified.NumberAdd(), |
| 957 R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), | 956 R.javascript.Subtract(R.binop_hints), R.simplified.NumberSubtract(), |
| 958 R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), | 957 R.javascript.Multiply(R.binop_hints), R.simplified.NumberMultiply(), |
| 959 R.javascript.Divide(R.binop_hints), R.simplified.NumberDivide(), | |
| 960 }; | 958 }; |
| 961 | 959 |
| 962 for (size_t j = 0; j < arraysize(ops); j += 2) { | 960 for (size_t j = 0; j < arraysize(ops); j += 2) { |
| 963 BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol(), | 961 BinopEffectsTester B(ops[j], Type::Number(), Type::Symbol(), |
| 964 JSTypedLowering::kNoFlags); | 962 JSTypedLowering::kNoFlags); |
| 965 | 963 |
| 966 Node* i0 = B.CheckNoOp(0); | 964 Node* i0 = B.CheckNoOp(0); |
| 967 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); | 965 Node* i1 = B.CheckConvertedInput(IrOpcode::kJSToNumber, 1, true); |
| 968 | 966 |
| 969 CHECK_EQ(B.p0, i0); | 967 CHECK_EQ(B.p0, i0); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 CHECK_EQ(p1, r->InputAt(1)); | 1230 CHECK_EQ(p1, r->InputAt(1)); |
| 1233 } | 1231 } |
| 1234 } | 1232 } |
| 1235 } | 1233 } |
| 1236 } | 1234 } |
| 1237 } | 1235 } |
| 1238 | 1236 |
| 1239 } // namespace compiler | 1237 } // namespace compiler |
| 1240 } // namespace internal | 1238 } // namespace internal |
| 1241 } // namespace v8 | 1239 } // namespace v8 |
| OLD | NEW |