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

Unified Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 579723004: Introduce simplified BooleanToNumber operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-simplified-lowering.cc
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc
index da75cc4cc7a4bd039ae1b36d21e2211523dd0931..163fdc8fb731feb488ed490f817d31ddf9d82935 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -810,6 +810,63 @@ TEST(LowerBooleanNot_tagged_tagged) {
}
+TEST(LowerBooleanToNumber_bit_int32) {
+ // BooleanToNumber(x: kRepBit) used as kMachInt32
+ TestingGraph t(Type::Boolean());
+ Node* b = t.ExampleWithOutput(kRepBit);
+ Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
+ Node* use = t.Use(cnv, kMachInt32);
+ t.Return(use);
+ t.Lower();
+ CHECK_EQ(b, use->InputAt(0));
+}
+
+
+TEST(LowerBooleanToNumber_tagged_int32) {
+ // BooleanToNumber(x: kRepTagged) used as kMachInt32
+ TestingGraph t(Type::Boolean());
+ Node* b = t.p0;
+ Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
+ Node* use = t.Use(cnv, kMachInt32);
+ t.Return(use);
+ t.Lower();
+ CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode());
+ CHECK(b == cnv->InputAt(0) || b == cnv->InputAt(1));
+ Node* c = t.jsgraph.TrueConstant();
+ CHECK(c == cnv->InputAt(0) || c == cnv->InputAt(1));
+}
+
+
+TEST(LowerBooleanToNumber_bit_tagged) {
+ // BooleanToNumber(x: kRepBit) used as kMachAnyTagged
+ TestingGraph t(Type::Boolean());
+ Node* b = t.ExampleWithOutput(kRepBit);
+ Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
+ Node* use = t.Use(cnv, kMachAnyTagged);
+ t.Return(use);
+ t.Lower();
+ CHECK_EQ(b, use->InputAt(0)->InputAt(0));
+ CHECK_EQ(IrOpcode::kChangeInt32ToTagged, use->InputAt(0)->opcode());
+}
+
+
+TEST(LowerBooleanToNumber_tagged_tagged) {
+ // BooleanToNumber(x: kRepTagged) used as kMachAnyTagged
+ TestingGraph t(Type::Boolean());
+ Node* b = t.p0;
+ Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
+ Node* use = t.Use(cnv, kMachAnyTagged);
+ t.Return(use);
+ t.Lower();
+ CHECK_EQ(cnv, use->InputAt(0)->InputAt(0));
+ CHECK_EQ(IrOpcode::kChangeInt32ToTagged, use->InputAt(0)->opcode());
+ CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode());
+ CHECK(b == cnv->InputAt(0) || b == cnv->InputAt(1));
+ Node* c = t.jsgraph.TrueConstant();
+ CHECK(c == cnv->InputAt(0) || c == cnv->InputAt(1));
+}
+
+
static Type* test_types[] = {Type::Signed32(), Type::Unsigned32(),
Type::Number(), Type::Any()};
« no previous file with comments | « test/cctest/compiler/test-js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698