Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

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

Issue 1369313004: [turbofan] Make string comparisons effectful. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 <limits> 5 #include <limits>
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/change-lowering.h" 8 #include "src/compiler/change-lowering.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/graph-reducer.h" 10 #include "src/compiler/graph-reducer.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 NodeProperties::SetType(p1, p1_type); 691 NodeProperties::SetType(p1, p1_type);
692 NodeProperties::SetType(p2, p2_type); 692 NodeProperties::SetType(p2, p2_type);
693 } 693 }
694 694
695 void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) { 695 void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) {
696 Node* node = Return(graph()->NewNode(op, p0, p1)); 696 Node* node = Return(graph()->NewNode(op, p0, p1));
697 Lower(); 697 Lower();
698 CHECK_EQ(expected, node->opcode()); 698 CHECK_EQ(expected, node->opcode());
699 } 699 }
700 700
701 void CheckLoweringStringBinop(IrOpcode::Value expected, const Operator* op) {
702 Node* node = Return(
703 graph()->NewNode(op, p0, p1, graph()->start(), graph()->start()));
704 Lower();
705 CHECK_EQ(expected, node->opcode());
706 }
707
701 void CheckLoweringTruncatedBinop(IrOpcode::Value expected, const Operator* op, 708 void CheckLoweringTruncatedBinop(IrOpcode::Value expected, const Operator* op,
702 const Operator* trunc) { 709 const Operator* trunc) {
703 Node* node = graph()->NewNode(op, p0, p1); 710 Node* node = graph()->NewNode(op, p0, p1);
704 Return(graph()->NewNode(trunc, node)); 711 Return(graph()->NewNode(trunc, node));
705 Lower(); 712 Lower();
706 CHECK_EQ(expected, node->opcode()); 713 CHECK_EQ(expected, node->opcode());
707 } 714 }
708 715
709 void Lower() { 716 void Lower() {
710 SourcePositionTable table(jsgraph.graph()); 717 SourcePositionTable table(jsgraph.graph());
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1173
1167 TEST(LowerStringOps_to_call_and_compare) { 1174 TEST(LowerStringOps_to_call_and_compare) {
1168 // These tests need linkage for the calls. 1175 // These tests need linkage for the calls.
1169 TestingGraph t(Type::String(), Type::String()); 1176 TestingGraph t(Type::String(), Type::String());
1170 IrOpcode::Value compare_eq = 1177 IrOpcode::Value compare_eq =
1171 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); 1178 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode());
1172 IrOpcode::Value compare_lt = 1179 IrOpcode::Value compare_lt =
1173 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode()); 1180 static_cast<IrOpcode::Value>(t.machine()->IntLessThan()->opcode());
1174 IrOpcode::Value compare_le = static_cast<IrOpcode::Value>( 1181 IrOpcode::Value compare_le = static_cast<IrOpcode::Value>(
1175 t.machine()->IntLessThanOrEqual()->opcode()); 1182 t.machine()->IntLessThanOrEqual()->opcode());
1176 t.CheckLoweringBinop(compare_eq, t.simplified()->StringEqual()); 1183 t.CheckLoweringStringBinop(compare_eq, t.simplified()->StringEqual());
1177 t.CheckLoweringBinop(compare_lt, t.simplified()->StringLessThan()); 1184 t.CheckLoweringStringBinop(compare_lt, t.simplified()->StringLessThan());
1178 t.CheckLoweringBinop(compare_le, t.simplified()->StringLessThanOrEqual()); 1185 t.CheckLoweringStringBinop(compare_le,
1186 t.simplified()->StringLessThanOrEqual());
1179 } 1187 }
1180 1188
1181 1189
1182 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, 1190 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from,
1183 MachineType to) { 1191 MachineType to) {
1184 TestingGraph t(Type::Any()); 1192 TestingGraph t(Type::Any());
1185 Node* in = t.ExampleWithOutput(from); 1193 Node* in = t.ExampleWithOutput(from);
1186 Node* use = t.Use(in, to); 1194 Node* use = t.Use(in, to);
1187 t.Return(use); 1195 t.Return(use);
1188 t.Lower(); 1196 t.Lower();
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 Type* phi_type = Type::Union(d.arg1, d.arg2, z); 1995 Type* phi_type = Type::Union(d.arg1, d.arg2, z);
1988 NodeProperties::SetType(phi, phi_type); 1996 NodeProperties::SetType(phi, phi_type);
1989 1997
1990 Node* use = t.Use(phi, d.use); 1998 Node* use = t.Use(phi, d.use);
1991 t.Return(use); 1999 t.Return(use);
1992 t.Lower(); 2000 t.Lower();
1993 2001
1994 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); 2002 CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
1995 } 2003 }
1996 } 2004 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | test/unittests/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698