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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 effect, CaptureEq(&if_false)), | 154 effect, CaptureEq(&if_false)), |
155 effect, _), | 155 effect, _), |
156 IsInt32Constant(JS_ARRAY_TYPE)), | 156 IsInt32Constant(JS_ARRAY_TYPE)), |
157 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | 157 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
158 IsBranch(IsObjectIsSmi(input), control))), | 158 IsBranch(IsObjectIsSmi(input), control))), |
159 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 159 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 // ----------------------------------------------------------------------------- | 163 // ----------------------------------------------------------------------------- |
164 // %_IsDate | |
165 | |
166 | |
167 TEST_F(JSIntrinsicLoweringTest, InlineIsDate) { | |
168 Node* const input = Parameter(0); | |
169 Node* const context = Parameter(1); | |
170 Node* const effect = graph()->start(); | |
171 Node* const control = graph()->start(); | |
172 Reduction const r = Reduce( | |
173 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsDate, 1), | |
174 input, context, effect, control)); | |
175 ASSERT_TRUE(r.Changed()); | |
176 | |
177 Node* phi = r.replacement(); | |
178 Capture<Node*> branch, if_false; | |
179 EXPECT_THAT( | |
180 phi, | |
181 IsPhi( | |
182 MachineRepresentation::kTagged, IsFalseConstant(), | |
183 IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(), | |
184 IsLoadField(AccessBuilder::ForMap(), input, | |
185 effect, CaptureEq(&if_false)), | |
186 effect, _), | |
187 IsInt32Constant(JS_DATE_TYPE)), | |
188 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | |
189 IsBranch(IsObjectIsSmi(input), control))), | |
190 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | |
191 } | |
192 | |
193 | |
194 // ----------------------------------------------------------------------------- | |
195 // %_IsTypedArray | 164 // %_IsTypedArray |
196 | 165 |
197 | 166 |
198 TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) { | 167 TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) { |
199 Node* const input = Parameter(0); | 168 Node* const input = Parameter(0); |
200 Node* const context = Parameter(1); | 169 Node* const context = Parameter(1); |
201 Node* const effect = graph()->start(); | 170 Node* const effect = graph()->start(); |
202 Node* const control = graph()->start(); | 171 Node* const control = graph()->start(); |
203 Reduction const r = Reduce(graph()->NewNode( | 172 Reduction const r = Reduce(graph()->NewNode( |
204 javascript()->CallRuntime(Runtime::kInlineIsTypedArray, 1), input, | 173 javascript()->CallRuntime(Runtime::kInlineIsTypedArray, 1), input, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 CaptureEq(&if_false0)))))), | 330 CaptureEq(&if_false0)))))), |
362 IsMerge( | 331 IsMerge( |
363 IsIfTrue(AllOf(CaptureEq(&branch0), | 332 IsIfTrue(AllOf(CaptureEq(&branch0), |
364 IsBranch(IsObjectIsSmi(input), control))), | 333 IsBranch(IsObjectIsSmi(input), control))), |
365 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 334 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
366 } | 335 } |
367 | 336 |
368 } // namespace compiler | 337 } // namespace compiler |
369 } // namespace internal | 338 } // namespace internal |
370 } // namespace v8 | 339 } // namespace v8 |
OLD | NEW |