Index: test/unittests/compiler/js-builtin-reducer-unittest.cc |
diff --git a/test/unittests/compiler/js-builtin-reducer-unittest.cc b/test/unittests/compiler/js-builtin-reducer-unittest.cc |
index f6c3ac48d7441468e4e3f88a8dabb543158bd62b..9e25f1eb92d5ef05321202b756ebc088c3998905 100644 |
--- a/test/unittests/compiler/js-builtin-reducer-unittest.cc |
+++ b/test/unittests/compiler/js-builtin-reducer-unittest.cc |
@@ -342,6 +342,45 @@ TEST_F(JSBuiltinReducerTest, MathCosWithPlainPrimitive) { |
} |
// ----------------------------------------------------------------------------- |
+// Math.cosh |
+ |
+TEST_F(JSBuiltinReducerTest, MathCoshWithNumber) { |
+ Node* function = MathFunction("cosh"); |
+ |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* context = UndefinedConstant(); |
+ Node* frame_state = graph()->start(); |
+ TRACED_FOREACH(Type*, t0, kNumberTypes) { |
+ Node* p0 = Parameter(t0, 0); |
+ Node* call = graph()->NewNode(javascript()->CallFunction(3), function, |
+ UndefinedConstant(), p0, context, frame_state, |
+ effect, control); |
+ Reduction r = Reduce(call); |
+ |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsNumberCosh(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathCoshWithPlainPrimitive) { |
+ Node* function = MathFunction("cosh"); |
+ |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* context = UndefinedConstant(); |
+ Node* frame_state = graph()->start(); |
+ Node* p0 = Parameter(Type::PlainPrimitive(), 0); |
+ Node* call = graph()->NewNode(javascript()->CallFunction(3), function, |
+ UndefinedConstant(), p0, context, frame_state, |
+ effect, control); |
+ Reduction r = Reduce(call); |
+ |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsNumberCosh(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
// Math.exp |
TEST_F(JSBuiltinReducerTest, MathExpWithNumber) { |
@@ -875,6 +914,45 @@ TEST_F(JSBuiltinReducerTest, MathSinWithPlainPrimitive) { |
} |
// ----------------------------------------------------------------------------- |
+// Math.sinh |
+ |
+TEST_F(JSBuiltinReducerTest, MathSinhWithNumber) { |
+ Node* function = MathFunction("sinh"); |
+ |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* context = UndefinedConstant(); |
+ Node* frame_state = graph()->start(); |
+ TRACED_FOREACH(Type*, t0, kNumberTypes) { |
+ Node* p0 = Parameter(t0, 0); |
+ Node* call = graph()->NewNode(javascript()->CallFunction(3), function, |
+ UndefinedConstant(), p0, context, frame_state, |
+ effect, control); |
+ Reduction r = Reduce(call); |
+ |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsNumberSinh(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathSinhWithPlainPrimitive) { |
+ Node* function = MathFunction("sinh"); |
+ |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* context = UndefinedConstant(); |
+ Node* frame_state = graph()->start(); |
+ Node* p0 = Parameter(Type::PlainPrimitive(), 0); |
+ Node* call = graph()->NewNode(javascript()->CallFunction(3), function, |
+ UndefinedConstant(), p0, context, frame_state, |
+ effect, control); |
+ Reduction r = Reduce(call); |
+ |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsNumberSinh(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
// Math.sqrt |
TEST_F(JSBuiltinReducerTest, MathSqrtWithNumber) { |
@@ -953,6 +1031,45 @@ TEST_F(JSBuiltinReducerTest, MathTanWithPlainPrimitive) { |
} |
// ----------------------------------------------------------------------------- |
+// Math.tanh |
+ |
+TEST_F(JSBuiltinReducerTest, MathTanhWithNumber) { |
+ Node* function = MathFunction("tanh"); |
+ |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* context = UndefinedConstant(); |
+ Node* frame_state = graph()->start(); |
+ TRACED_FOREACH(Type*, t0, kNumberTypes) { |
+ Node* p0 = Parameter(t0, 0); |
+ Node* call = graph()->NewNode(javascript()->CallFunction(3), function, |
+ UndefinedConstant(), p0, context, frame_state, |
+ effect, control); |
+ Reduction r = Reduce(call); |
+ |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsNumberTanh(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathTanhWithPlainPrimitive) { |
+ Node* function = MathFunction("tanh"); |
+ |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* context = UndefinedConstant(); |
+ Node* frame_state = graph()->start(); |
+ Node* p0 = Parameter(Type::PlainPrimitive(), 0); |
+ Node* call = graph()->NewNode(javascript()->CallFunction(3), function, |
+ UndefinedConstant(), p0, context, frame_state, |
+ effect, control); |
+ Reduction r = Reduce(call); |
+ |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsNumberTanh(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
// Math.trunc |
TEST_F(JSBuiltinReducerTest, MathTruncWithNumber) { |