Chromium Code Reviews

Side by Side Diff: test/cctest/compiler/test-js-typed-lowering.cc

Issue 1130283002: [strong] Disallow implicit conversions for comparison (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor cleanup Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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 672 matching lines...)
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 Node* cmp = R.Binop(R.javascript.LessThan(language_mode), p0, p1);
692 Node* r = R.reduce(cmp); 692 Node* r = R.reduce(cmp);
693 693 if (types[i]->Is(Type::String()) && types[j]->Is(Type::String())) {
694 if (!types[i]->Maybe(Type::String()) || 694 R.CheckPureBinop(R.simplified.StringLessThan(), r);
695 !types[j]->Maybe(Type::String())) { 695 } else if ((types[i]->Is(Type::Number()) &&
696 if (types[i]->Is(Type::String()) && types[j]->Is(Type::String())) { 696 types[j]->Is(Type::Number())) ||
697 R.CheckPureBinop(R.simplified.StringLessThan(), r); 697 (!is_strong(language_mode) &&
698 } else { 698 (!types[i]->Maybe(Type::String()) ||
699 R.CheckPureBinop(R.simplified.NumberLessThan(), r); 699 !types[j]->Maybe(Type::String())))) {
700 } 700 R.CheckPureBinop(R.simplified.NumberLessThan(), r);
701 } else { 701 } else {
702 CHECK_EQ(cmp, r); // No reduction of mixed types. 702 CHECK_EQ(cmp, r); // No reduction of mixed types.
703 } 703 }
704 } 704 }
705 } 705 }
706 } 706 }
707 } 707 }
708 708
709 709
710 TEST_WITH_STRONG(RemoveToNumberEffects) { 710 TEST_WITH_STRONG(RemoveToNumberEffects) {
(...skipping 559 matching lines...)
1270 CHECK_EQ(p1, r->InputAt(0)); 1270 CHECK_EQ(p1, r->InputAt(0));
1271 CHECK_EQ(p0, r->InputAt(1)); 1271 CHECK_EQ(p0, r->InputAt(1));
1272 } else { 1272 } else {
1273 CHECK_EQ(p0, r->InputAt(0)); 1273 CHECK_EQ(p0, r->InputAt(0));
1274 CHECK_EQ(p1, r->InputAt(1)); 1274 CHECK_EQ(p1, r->InputAt(1));
1275 } 1275 }
1276 } 1276 }
1277 } 1277 }
1278 } 1278 }
1279 } 1279 }
OLDNEW

Powered by Google App Engine