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

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

Issue 2103323003: [turbofan] Don't eagerly introduce machine operators in JSTypedLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_Typing
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 CHECK_EQ(one, other_use->InputAt(1)); 1185 CHECK_EQ(one, other_use->InputAt(1));
1186 } 1186 }
1187 } 1187 }
1188 } 1188 }
1189 1189
1190 TEST(Int32Comparisons) { 1190 TEST(Int32Comparisons) {
1191 JSTypedLoweringTester R; 1191 JSTypedLoweringTester R;
1192 1192
1193 struct Entry { 1193 struct Entry {
1194 const Operator* js_op; 1194 const Operator* js_op;
1195 const Operator* uint_op;
1196 const Operator* int_op;
1197 const Operator* num_op; 1195 const Operator* num_op;
1198 bool commute; 1196 bool commute;
1199 }; 1197 };
1200 1198
1201 Entry ops[] = { 1199 Entry ops[] = {{R.javascript.LessThan(R.compare_hints),
1202 {R.javascript.LessThan(R.compare_hints), R.machine.Uint32LessThan(), 1200 R.simplified.NumberLessThan(), false},
1203 R.machine.Int32LessThan(), R.simplified.NumberLessThan(), false}, 1201 {R.javascript.LessThanOrEqual(R.compare_hints),
1204 {R.javascript.LessThanOrEqual(R.compare_hints), 1202 R.simplified.NumberLessThanOrEqual(), false},
1205 R.machine.Uint32LessThanOrEqual(), R.machine.Int32LessThanOrEqual(), 1203 {R.javascript.GreaterThan(R.compare_hints),
1206 R.simplified.NumberLessThanOrEqual(), false}, 1204 R.simplified.NumberLessThan(), true},
1207 {R.javascript.GreaterThan(R.compare_hints), R.machine.Uint32LessThan(), 1205 {R.javascript.GreaterThanOrEqual(R.compare_hints),
1208 R.machine.Int32LessThan(), R.simplified.NumberLessThan(), true}, 1206 R.simplified.NumberLessThanOrEqual(), true}};
1209 {R.javascript.GreaterThanOrEqual(R.compare_hints),
1210 R.machine.Uint32LessThanOrEqual(), R.machine.Int32LessThanOrEqual(),
1211 R.simplified.NumberLessThanOrEqual(), true}};
1212 1207
1213 for (size_t o = 0; o < arraysize(ops); o++) { 1208 for (size_t o = 0; o < arraysize(ops); o++) {
1214 for (size_t i = 0; i < arraysize(kNumberTypes); i++) { 1209 for (size_t i = 0; i < arraysize(kNumberTypes); i++) {
1215 Type* t0 = kNumberTypes[i]; 1210 Type* t0 = kNumberTypes[i];
1216 Node* p0 = R.Parameter(t0, 0); 1211 Node* p0 = R.Parameter(t0, 0);
1217 1212
1218 for (size_t j = 0; j < arraysize(kNumberTypes); j++) { 1213 for (size_t j = 0; j < arraysize(kNumberTypes); j++) {
1219 Type* t1 = kNumberTypes[j]; 1214 Type* t1 = kNumberTypes[j];
1220 Node* p1 = R.Parameter(t1, 1); 1215 Node* p1 = R.Parameter(t1, 1);
1221 1216
1222 Node* cmp = R.Binop(ops[o].js_op, p0, p1); 1217 Node* cmp = R.Binop(ops[o].js_op, p0, p1);
1223 Node* r = R.reduce(cmp); 1218 Node* r = R.reduce(cmp);
1224 1219
1225 const Operator* expected; 1220 R.CheckBinop(ops[o].num_op, r);
1226 if (t0->Is(Type::Unsigned32()) && t1->Is(Type::Unsigned32())) {
1227 expected = ops[o].uint_op;
1228 } else if (t0->Is(Type::Signed32()) && t1->Is(Type::Signed32())) {
1229 expected = ops[o].int_op;
1230 } else {
1231 expected = ops[o].num_op;
1232 }
1233 R.CheckBinop(expected, r);
1234 if (ops[o].commute) { 1221 if (ops[o].commute) {
1235 CHECK_EQ(p1, r->InputAt(0)); 1222 CHECK_EQ(p1, r->InputAt(0));
1236 CHECK_EQ(p0, r->InputAt(1)); 1223 CHECK_EQ(p0, r->InputAt(1));
1237 } else { 1224 } else {
1238 CHECK_EQ(p0, r->InputAt(0)); 1225 CHECK_EQ(p0, r->InputAt(0));
1239 CHECK_EQ(p1, r->InputAt(1)); 1226 CHECK_EQ(p1, r->InputAt(1));
1240 } 1227 }
1241 } 1228 }
1242 } 1229 }
1243 } 1230 }
1244 } 1231 }
1245 1232
1246 } // namespace compiler 1233 } // namespace compiler
1247 } // namespace internal 1234 } // namespace internal
1248 } // namespace v8 1235 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698