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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 681 |
682 Type* types[] = {Type::Number(), Type::String(), | 682 Type* types[] = {Type::Number(), Type::String(), |
683 Type::Union(Type::Number(), Type::String(), R.main_zone())}; | 683 Type::Union(Type::Number(), Type::String(), R.main_zone())}; |
684 | 684 |
685 for (size_t i = 0; i < arraysize(types); i++) { | 685 for (size_t i = 0; i < arraysize(types); i++) { |
686 Node* p0 = R.Parameter(types[i], 0); | 686 Node* p0 = R.Parameter(types[i], 0); |
687 | 687 |
688 for (size_t j = 0; j < arraysize(types); j++) { | 688 for (size_t j = 0; j < arraysize(types); j++) { |
689 Node* p1 = R.Parameter(types[j], 1); | 689 Node* p1 = R.Parameter(types[j], 1); |
690 { | 690 { |
691 Node* cmp = R.Binop(R.javascript.LessThan(language_mode), p0, p1); | 691 const Operator* less_than = R.javascript.LessThan(language_mode); |
| 692 Node* cmp = R.Binop(less_than, p0, p1); |
692 Node* r = R.reduce(cmp); | 693 Node* r = R.reduce(cmp); |
693 | 694 if (types[i]->Is(Type::String()) && types[j]->Is(Type::String())) { |
694 if (!types[i]->Maybe(Type::String()) || | 695 R.CheckPureBinop(R.simplified.StringLessThan(), r); |
695 !types[j]->Maybe(Type::String())) { | 696 } else if ((types[i]->Is(Type::Number()) && |
696 if (types[i]->Is(Type::String()) && types[j]->Is(Type::String())) { | 697 types[j]->Is(Type::Number())) || |
697 R.CheckPureBinop(R.simplified.StringLessThan(), r); | 698 (!is_strong(language_mode) && |
698 } else { | 699 (!types[i]->Maybe(Type::String()) || |
699 R.CheckPureBinop(R.simplified.NumberLessThan(), r); | 700 !types[j]->Maybe(Type::String())))) { |
700 } | 701 R.CheckPureBinop(R.simplified.NumberLessThan(), r); |
701 } else { | 702 } else { |
702 CHECK_EQ(cmp, r); // No reduction of mixed types. | 703 // No reduction of mixed types. |
| 704 CHECK_EQ(r->op(), less_than); |
703 } | 705 } |
704 } | 706 } |
705 } | 707 } |
706 } | 708 } |
707 } | 709 } |
708 | 710 |
709 | 711 |
710 TEST_WITH_STRONG(RemoveToNumberEffects) { | 712 TEST_WITH_STRONG(RemoveToNumberEffects) { |
711 FLAG_turbo_deoptimization = true; | 713 FLAG_turbo_deoptimization = true; |
712 | 714 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 CHECK_EQ(p1, r->InputAt(0)); | 1272 CHECK_EQ(p1, r->InputAt(0)); |
1271 CHECK_EQ(p0, r->InputAt(1)); | 1273 CHECK_EQ(p0, r->InputAt(1)); |
1272 } else { | 1274 } else { |
1273 CHECK_EQ(p0, r->InputAt(0)); | 1275 CHECK_EQ(p0, r->InputAt(0)); |
1274 CHECK_EQ(p1, r->InputAt(1)); | 1276 CHECK_EQ(p1, r->InputAt(1)); |
1275 } | 1277 } |
1276 } | 1278 } |
1277 } | 1279 } |
1278 } | 1280 } |
1279 } | 1281 } |
OLD | NEW |