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 "src/types-inl.h" | 10 #include "src/types-inl.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 IsBranch(IsObjectIsSmi(input), control))), | 221 IsBranch(IsObjectIsSmi(input), control))), |
222 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 222 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
223 } | 223 } |
224 | 224 |
225 | 225 |
226 // ----------------------------------------------------------------------------- | 226 // ----------------------------------------------------------------------------- |
227 // %_IsFunction | 227 // %_IsFunction |
228 | 228 |
229 | 229 |
230 TEST_F(JSIntrinsicLoweringTest, InlineIsFunction) { | 230 TEST_F(JSIntrinsicLoweringTest, InlineIsFunction) { |
231 Node* const input = Parameter(0); | 231 Node* const input = Parameter(Type::Any()); |
232 Node* const context = Parameter(1); | 232 Node* const context = Parameter(Type::Any()); |
233 Node* const effect = graph()->start(); | 233 Node* const effect = graph()->start(); |
234 Node* const control = graph()->start(); | 234 Node* const control = graph()->start(); |
235 Reduction const r = Reduce( | 235 Reduction const r = Reduce( |
236 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsFunction, 1), | 236 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsFunction, 1), |
237 input, context, effect, control)); | 237 input, context, effect, control)); |
238 ASSERT_TRUE(r.Changed()); | 238 ASSERT_TRUE(r.Changed()); |
239 | 239 |
240 Node* phi = r.replacement(); | 240 Node* phi = r.replacement(); |
241 Capture<Node*> branch, if_false; | 241 Capture<Node*> branch, if_false; |
242 EXPECT_THAT( | 242 EXPECT_THAT( |
243 phi, | 243 phi, |
244 IsPhi( | 244 IsPhi( |
245 MachineRepresentation::kTagged, IsFalseConstant(), | 245 MachineRepresentation::kTagged, IsFalseConstant(), |
246 IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(), | 246 IsUint32LessThanOrEqual( |
247 IsLoadField(AccessBuilder::ForMap(), input, | 247 IsInt32Constant(FIRST_FUNCTION_TYPE), |
248 effect, CaptureEq(&if_false)), | 248 IsLoadField(AccessBuilder::ForMapInstanceType(), |
249 effect, _), | 249 IsLoadField(AccessBuilder::ForMap(), input, effect, |
250 IsInt32Constant(JS_FUNCTION_TYPE)), | 250 CaptureEq(&if_false)), |
| 251 effect, _)), |
251 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | 252 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
252 IsBranch(IsObjectIsSmi(input), control))), | 253 IsBranch(IsObjectIsSmi(input), control))), |
253 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 254 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
254 } | 255 } |
255 | 256 |
256 | 257 |
257 // ----------------------------------------------------------------------------- | 258 // ----------------------------------------------------------------------------- |
258 // %_IsRegExp | 259 // %_IsRegExp |
259 | 260 |
260 | 261 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 CaptureEq(&if_false0)))))), | 453 CaptureEq(&if_false0)))))), |
453 IsMerge( | 454 IsMerge( |
454 IsIfTrue(AllOf(CaptureEq(&branch0), | 455 IsIfTrue(AllOf(CaptureEq(&branch0), |
455 IsBranch(IsObjectIsSmi(input), control))), | 456 IsBranch(IsObjectIsSmi(input), control))), |
456 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 457 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
457 } | 458 } |
458 | 459 |
459 } // namespace compiler | 460 } // namespace compiler |
460 } // namespace internal | 461 } // namespace internal |
461 } // namespace v8 | 462 } // namespace v8 |
OLD | NEW |