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(Type::Any()); | 231 Node* const input = Parameter(0); |
232 Node* const context = Parameter(Type::Any()); | 232 Node* const context = Parameter(1); |
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 IsUint32LessThanOrEqual( | 246 IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(), |
247 IsInt32Constant(FIRST_FUNCTION_TYPE), | 247 IsLoadField(AccessBuilder::ForMap(), input, |
248 IsLoadField(AccessBuilder::ForMapInstanceType(), | 248 effect, CaptureEq(&if_false)), |
249 IsLoadField(AccessBuilder::ForMap(), input, effect, | 249 effect, _), |
250 CaptureEq(&if_false)), | 250 IsInt32Constant(JS_FUNCTION_TYPE)), |
251 effect, _)), | |
252 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | 251 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
253 IsBranch(IsObjectIsSmi(input), control))), | 252 IsBranch(IsObjectIsSmi(input), control))), |
254 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 253 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
255 } | 254 } |
256 | 255 |
257 | 256 |
258 // ----------------------------------------------------------------------------- | 257 // ----------------------------------------------------------------------------- |
259 // %_IsRegExp | 258 // %_IsRegExp |
260 | 259 |
261 | 260 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 CaptureEq(&if_false0)))))), | 452 CaptureEq(&if_false0)))))), |
454 IsMerge( | 453 IsMerge( |
455 IsIfTrue(AllOf(CaptureEq(&branch0), | 454 IsIfTrue(AllOf(CaptureEq(&branch0), |
456 IsBranch(IsObjectIsSmi(input), control))), | 455 IsBranch(IsObjectIsSmi(input), control))), |
457 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 456 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
458 } | 457 } |
459 | 458 |
460 } // namespace compiler | 459 } // namespace compiler |
461 } // namespace internal | 460 } // namespace internal |
462 } // namespace v8 | 461 } // namespace v8 |
OLD | NEW |