| 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/compiler/js-graph.h" | 5 #include "src/compiler/js-graph.h" |
| 6 #include "src/compiler/js-typed-lowering.h" | 6 #include "src/compiler/js-typed-lowering.h" |
| 7 #include "src/compiler/machine-operator.h" | 7 #include "src/compiler/machine-operator.h" |
| 8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
| 9 #include "src/compiler/opcodes.h" | 9 #include "src/compiler/opcodes.h" |
| 10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 | 828 |
| 829 | 829 |
| 830 // Helper function for strict and non-strict equality reductions. | 830 // Helper function for strict and non-strict equality reductions. |
| 831 void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l, | 831 void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l, |
| 832 Node* r, IrOpcode::Value expected) { | 832 Node* r, IrOpcode::Value expected) { |
| 833 for (int j = 0; j < 2; j++) { | 833 for (int j = 0; j < 2; j++) { |
| 834 Node* p0 = j == 0 ? l : r; | 834 Node* p0 = j == 0 ? l : r; |
| 835 Node* p1 = j == 1 ? l : r; | 835 Node* p1 = j == 1 ? l : r; |
| 836 | 836 |
| 837 { | 837 { |
| 838 Node* eq = strict | 838 const Operator* op = |
| 839 ? R->graph.NewNode(R->javascript.StrictEqual(), p0, p1, | 839 strict ? R->javascript.StrictEqual() : R->javascript.Equal(); |
| 840 R->context()) | 840 Node* eq = R->Binop(op, p0, p1); |
| 841 : R->Binop(R->javascript.Equal(), p0, p1); | |
| 842 Node* r = R->reduce(eq); | 841 Node* r = R->reduce(eq); |
| 843 R->CheckPureBinop(expected, r); | 842 R->CheckPureBinop(expected, r); |
| 844 } | 843 } |
| 845 | 844 |
| 846 { | 845 { |
| 847 Node* ne = strict | 846 const Operator* op = |
| 848 ? R->graph.NewNode(R->javascript.StrictNotEqual(), p0, p1, | 847 strict ? R->javascript.StrictNotEqual() : R->javascript.NotEqual(); |
| 849 R->context()) | 848 Node* ne = R->Binop(op, p0, p1); |
| 850 : R->Binop(R->javascript.NotEqual(), p0, p1); | |
| 851 Node* n = R->reduce(ne); | 849 Node* n = R->reduce(ne); |
| 852 CHECK_EQ(IrOpcode::kBooleanNot, n->opcode()); | 850 CHECK_EQ(IrOpcode::kBooleanNot, n->opcode()); |
| 853 Node* r = n->InputAt(0); | 851 Node* r = n->InputAt(0); |
| 854 R->CheckPureBinop(expected, r); | 852 R->CheckPureBinop(expected, r); |
| 855 } | 853 } |
| 856 } | 854 } |
| 857 } | 855 } |
| 858 | 856 |
| 859 | 857 |
| 860 TEST(EqualityForNumbers) { | 858 TEST(EqualityForNumbers) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 CHECK_EQ(p1, r->InputAt(0)); | 1256 CHECK_EQ(p1, r->InputAt(0)); |
| 1259 CHECK_EQ(p0, r->InputAt(1)); | 1257 CHECK_EQ(p0, r->InputAt(1)); |
| 1260 } else { | 1258 } else { |
| 1261 CHECK_EQ(p0, r->InputAt(0)); | 1259 CHECK_EQ(p0, r->InputAt(0)); |
| 1262 CHECK_EQ(p1, r->InputAt(1)); | 1260 CHECK_EQ(p1, r->InputAt(1)); |
| 1263 } | 1261 } |
| 1264 } | 1262 } |
| 1265 } | 1263 } |
| 1266 } | 1264 } |
| 1267 } | 1265 } |
| OLD | NEW |