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 9e25f1eb92d5ef05321202b756ebc088c3998905..d40954ab5ec79ce888bde39352ce7e89906476d0 100644 |
--- a/test/unittests/compiler/js-builtin-reducer-unittest.cc |
+++ b/test/unittests/compiler/js-builtin-reducer-unittest.cc |
@@ -126,6 +126,162 @@ TEST_F(JSBuiltinReducerTest, MathAbsWithPlainPrimitive) { |
} |
// ----------------------------------------------------------------------------- |
+// Math.acos |
+ |
+TEST_F(JSBuiltinReducerTest, MathAcosWithNumber) { |
+ Node* function = MathFunction("acos"); |
+ |
+ 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(), IsNumberAcos(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathAcosWithPlainPrimitive) { |
+ Node* function = MathFunction("acos"); |
+ |
+ 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(), IsNumberAcos(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
+// Math.acosh |
+ |
+TEST_F(JSBuiltinReducerTest, MathAcoshWithNumber) { |
+ Node* function = MathFunction("acosh"); |
+ |
+ 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(), IsNumberAcosh(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathAcoshWithPlainPrimitive) { |
+ Node* function = MathFunction("acosh"); |
+ |
+ 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(), IsNumberAcosh(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
+// Math.asin |
+ |
+TEST_F(JSBuiltinReducerTest, MathAsinWithNumber) { |
+ Node* function = MathFunction("asin"); |
+ |
+ 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(), IsNumberAsin(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathAsinWithPlainPrimitive) { |
+ Node* function = MathFunction("asin"); |
+ |
+ 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(), IsNumberAsin(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
+// Math.asinh |
+ |
+TEST_F(JSBuiltinReducerTest, MathAsinhWithNumber) { |
+ Node* function = MathFunction("asinh"); |
+ |
+ 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(), IsNumberAsinh(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathAsinhWithPlainPrimitive) { |
+ Node* function = MathFunction("asinh"); |
+ |
+ 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(), IsNumberAsinh(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
// Math.atan |
TEST_F(JSBuiltinReducerTest, MathAtanWithNumber) { |
@@ -165,6 +321,45 @@ TEST_F(JSBuiltinReducerTest, MathAtanWithPlainPrimitive) { |
} |
// ----------------------------------------------------------------------------- |
+// Math.atanh |
+ |
+TEST_F(JSBuiltinReducerTest, MathAtanhWithNumber) { |
+ Node* function = MathFunction("atanh"); |
+ |
+ 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(), IsNumberAtanh(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathAtanhWithPlainPrimitive) { |
+ Node* function = MathFunction("atanh"); |
+ |
+ 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(), IsNumberAtanh(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
// Math.atan2 |
TEST_F(JSBuiltinReducerTest, MathAtan2WithNumber) { |
@@ -875,6 +1070,45 @@ TEST_F(JSBuiltinReducerTest, MathPowWithPlainPrimitive) { |
} |
// ----------------------------------------------------------------------------- |
+// Math.sign |
+ |
+TEST_F(JSBuiltinReducerTest, MathSignWithNumber) { |
+ Node* function = MathFunction("sign"); |
+ |
+ 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(), IsNumberSign(p0)); |
+ } |
+} |
+ |
+TEST_F(JSBuiltinReducerTest, MathSignWithPlainPrimitive) { |
+ Node* function = MathFunction("sign"); |
+ |
+ 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(), IsNumberSign(IsPlainPrimitiveToNumber(p0))); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
// Math.sin |
TEST_F(JSBuiltinReducerTest, MathSinWithNumber) { |