OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-intrinsic-lowering.h" | 8 #include "src/compiler/js-intrinsic-lowering.h" |
9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Node* const effect = graph()->start(); | 118 Node* const effect = graph()->start(); |
119 Node* const control = graph()->start(); | 119 Node* const control = graph()->start(); |
120 Reduction const r = Reduce( | 120 Reduction const r = Reduce( |
121 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), | 121 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsSmi, 1), |
122 input, context, effect, control)); | 122 input, context, effect, control)); |
123 ASSERT_TRUE(r.Changed()); | 123 ASSERT_TRUE(r.Changed()); |
124 EXPECT_THAT(r.replacement(), IsObjectIsSmi(input)); | 124 EXPECT_THAT(r.replacement(), IsObjectIsSmi(input)); |
125 } | 125 } |
126 | 126 |
127 | 127 |
| 128 // ----------------------------------------------------------------------------- |
| 129 // %_IsNonNegativeSmi |
| 130 |
| 131 |
| 132 TEST_F(JSIntrinsicLoweringTest, InlineIsNonNegativeSmi) { |
| 133 Node* const input = Parameter(0); |
| 134 Node* const context = Parameter(1); |
| 135 Node* const effect = graph()->start(); |
| 136 Node* const control = graph()->start(); |
| 137 Reduction const r = Reduce(graph()->NewNode( |
| 138 javascript()->CallRuntime(Runtime::kInlineIsNonNegativeSmi, 1), input, |
| 139 context, effect, control)); |
| 140 ASSERT_TRUE(r.Changed()); |
| 141 EXPECT_THAT(r.replacement(), IsObjectIsNonNegativeSmi(input)); |
| 142 } |
| 143 |
| 144 |
128 // ----------------------------------------------------------------------------- | 145 // ----------------------------------------------------------------------------- |
129 // %_IsArray | 146 // %_IsArray |
130 | 147 |
131 | 148 |
132 TEST_F(JSIntrinsicLoweringTest, InlineIsArray) { | 149 TEST_F(JSIntrinsicLoweringTest, InlineIsArray) { |
133 Node* const input = Parameter(0); | 150 Node* const input = Parameter(0); |
134 Node* const context = Parameter(1); | 151 Node* const context = Parameter(1); |
135 Node* const effect = graph()->start(); | 152 Node* const effect = graph()->start(); |
136 Node* const control = graph()->start(); | 153 Node* const control = graph()->start(); |
137 Reduction const r = Reduce( | 154 Reduction const r = Reduce( |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 CaptureEq(&if_false0)))))), | 472 CaptureEq(&if_false0)))))), |
456 IsMerge( | 473 IsMerge( |
457 IsIfTrue(AllOf(CaptureEq(&branch0), | 474 IsIfTrue(AllOf(CaptureEq(&branch0), |
458 IsBranch(IsObjectIsSmi(input), control))), | 475 IsBranch(IsObjectIsSmi(input), control))), |
459 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 476 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
460 } | 477 } |
461 | 478 |
462 } // namespace compiler | 479 } // namespace compiler |
463 } // namespace internal | 480 } // namespace internal |
464 } // namespace v8 | 481 } // namespace v8 |
OLD | NEW |