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

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: 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
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..0306752b05029a622019b3015e22a3dc818de788 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -810,6 +810,33 @@ 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) {
titzer 2014/09/17 12:01:22 Maybe also want to test it being used as tagged, t
Michael Starzinger 2014/09/17 12:43:28 Done (both kRepBit and kRepTagged used as tagged).
+ // 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));
+}
+
+
static Type* test_types[] = {Type::Signed32(), Type::Unsigned32(),
Type::Number(), Type::Any()};
« src/compiler/simplified-operator.cc ('K') | « 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