Index: test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
index 1b8a87e8b2c83055a5a1bab9d97f42f0b637b73e..96331b509af2e98f77bbd88377e19e8e3f2d7096 100644 |
--- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
+++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
@@ -27,8 +27,9 @@ class JSIntrinsicLoweringTest : public GraphTest { |
~JSIntrinsicLoweringTest() OVERRIDE {} |
protected: |
- Reduction Reduce(Node* node) { |
- MachineOperatorBuilder machine(zone()); |
+ Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = |
+ MachineOperatorBuilder::kNoFlags) { |
+ MachineOperatorBuilder machine(zone(), kMachPtr, flags); |
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine); |
JSIntrinsicLowering reducer(&jsgraph); |
return reducer.Reduce(node); |
@@ -224,6 +225,77 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) { |
// ----------------------------------------------------------------------------- |
+// %_JSValueGetValue |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineJSValueGetValue) { |
+ Node* const input = Parameter(0); |
+ Node* const context = Parameter(1); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce(graph()->NewNode( |
+ javascript()->CallRuntime(Runtime::kInlineJSValueGetValue, 1), input, |
+ context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), |
+ IsLoadField(AccessBuilder::ForValue(), input, effect, control)); |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
+// %_MathFloor |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineMathFloor) { |
+ Node* const input = Parameter(0); |
+ Node* const context = Parameter(1); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce( |
+ graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1), |
+ input, context, effect, control), |
+ MachineOperatorBuilder::kFloat64RoundDown); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsFloat64RoundDown(input)); |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
+// %_MathSqrt |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineMathSqrt) { |
+ Node* const input = Parameter(0); |
+ Node* const context = Parameter(1); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce( |
+ graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), |
+ input, context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input)); |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
+// %_StringGetLength |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineStringGetLength) { |
+ Node* const input = Parameter(0); |
+ Node* const context = Parameter(1); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce(graph()->NewNode( |
+ javascript()->CallRuntime(Runtime::kInlineStringGetLength, 1), input, |
+ context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(), |
+ input, effect, control)); |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
// %_ValueOf |