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

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

Issue 523633002: Fix typed lowering of JSUnaryNot to work with graph reducer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and comments fixed. Created 6 years, 3 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 | Annotate | Revision Log
« 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/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 R.CheckEffectInput(i0, i1); 748 R.CheckEffectInput(i0, i1);
749 R.CheckEffectInput(i1, effect_use); 749 R.CheckEffectInput(i1, effect_use);
750 } 750 }
751 751
752 752
753 TEST(UnaryNot) { 753 TEST(UnaryNot) {
754 JSTypedLoweringTester R; 754 JSTypedLoweringTester R;
755 Operator* opnot = R.javascript.UnaryNot(); 755 Operator* opnot = R.javascript.UnaryNot();
756 756
757 for (size_t i = 0; i < arraysize(kJSTypes); i++) { 757 for (size_t i = 0; i < arraysize(kJSTypes); i++) {
758 Node* r = R.ReduceUnop(opnot, kJSTypes[i]); 758 Node* orig = R.Unop(opnot, R.Parameter(kJSTypes[i]));
759 Node* use = R.graph.NewNode(R.common.Return(), orig);
760 Node* r = R.reduce(orig);
759 // TODO(titzer): test will break if/when js-typed-lowering constant folds. 761 // TODO(titzer): test will break if/when js-typed-lowering constant folds.
760 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode()); 762 CHECK_EQ(IrOpcode::kBooleanNot, use->InputAt(0)->opcode());
763
764 if (r == orig && orig->opcode() == IrOpcode::kJSToBoolean) {
765 // The original node was turned into a ToBoolean.
766 CHECK_EQ(IrOpcode::kJSToBoolean, r->opcode());
767 } else {
768 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode());
769 }
761 } 770 }
762 } 771 }
763 772
764 773
765 TEST(RemoveToNumberEffects) { 774 TEST(RemoveToNumberEffects) {
766 JSTypedLoweringTester R; 775 JSTypedLoweringTester R;
767 776
768 Node* effect_use = NULL; 777 Node* effect_use = NULL;
769 for (int i = 0; i < 10; i++) { 778 for (int i = 0; i < 10; i++) {
770 Node* p0 = R.Parameter(Type::Number()); 779 Node* p0 = R.Parameter(Type::Number());
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 JSTypedLoweringTester R; 1186 JSTypedLoweringTester R;
1178 Operator* opnot = R.javascript.UnaryNot(); 1187 Operator* opnot = R.javascript.UnaryNot();
1179 1188
1180 for (size_t i = 0; i < arraysize(kJSTypes); i++) { 1189 for (size_t i = 0; i < arraysize(kJSTypes); i++) {
1181 Node* p0 = R.Parameter(kJSTypes[i], 0); 1190 Node* p0 = R.Parameter(kJSTypes[i], 0);
1182 Node* orig = R.Unop(opnot, p0); 1191 Node* orig = R.Unop(opnot, p0);
1183 Node* effect_use = R.UseForEffect(orig); 1192 Node* effect_use = R.UseForEffect(orig);
1184 Node* value_use = R.graph.NewNode(R.common.Return(), orig); 1193 Node* value_use = R.graph.NewNode(R.common.Return(), orig);
1185 Node* r = R.reduce(orig); 1194 Node* r = R.reduce(orig);
1186 // TODO(titzer): test will break if/when js-typed-lowering constant folds. 1195 // TODO(titzer): test will break if/when js-typed-lowering constant folds.
1187 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode()); 1196 CHECK_EQ(IrOpcode::kBooleanNot, value_use->InputAt(0)->opcode());
1188 1197
1189 CHECK_EQ(r, value_use->InputAt(0)); 1198 if (r == orig && orig->opcode() == IrOpcode::kJSToBoolean) {
1190
1191 if (r->InputAt(0) == orig && orig->opcode() == IrOpcode::kJSToBoolean) {
1192 // The original node was turned into a ToBoolean, which has an effect. 1199 // The original node was turned into a ToBoolean, which has an effect.
1200 CHECK_EQ(IrOpcode::kJSToBoolean, r->opcode());
1193 R.CheckEffectInput(R.start(), orig); 1201 R.CheckEffectInput(R.start(), orig);
1194 R.CheckEffectInput(orig, effect_use); 1202 R.CheckEffectInput(orig, effect_use);
1195 } else { 1203 } else {
1196 // effect should have been removed from this node. 1204 // effect should have been removed from this node.
1205 CHECK_EQ(IrOpcode::kBooleanNot, r->opcode());
1197 R.CheckEffectInput(R.start(), effect_use); 1206 R.CheckEffectInput(R.start(), effect_use);
1198 } 1207 }
1199 } 1208 }
1200 } 1209 }
1201 1210
1202 1211
1203 TEST(Int32AddNarrowing) { 1212 TEST(Int32AddNarrowing) {
1204 { 1213 {
1205 JSBitwiseTypedLoweringTester R; 1214 JSBitwiseTypedLoweringTester R;
1206 1215
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 CHECK_EQ(p1, r->InputAt(0)); 1340 CHECK_EQ(p1, r->InputAt(0));
1332 CHECK_EQ(p0, r->InputAt(1)); 1341 CHECK_EQ(p0, r->InputAt(1));
1333 } else { 1342 } else {
1334 CHECK_EQ(p0, r->InputAt(0)); 1343 CHECK_EQ(p0, r->InputAt(0));
1335 CHECK_EQ(p1, r->InputAt(1)); 1344 CHECK_EQ(p1, r->InputAt(1));
1336 } 1345 }
1337 } 1346 }
1338 } 1347 }
1339 } 1348 }
1340 } 1349 }
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