| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 effect, CaptureEq(&if_false)), | 167 effect, CaptureEq(&if_false)), |
| 168 effect, _), | 168 effect, _), |
| 169 IsInt32Constant(JS_ARRAY_TYPE)), | 169 IsInt32Constant(JS_ARRAY_TYPE)), |
| 170 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | 170 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
| 171 IsBranch(IsObjectIsSmi(input), control))), | 171 IsBranch(IsObjectIsSmi(input), control))), |
| 172 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 172 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
| 173 } | 173 } |
| 174 | 174 |
| 175 | 175 |
| 176 // ----------------------------------------------------------------------------- | 176 // ----------------------------------------------------------------------------- |
| 177 // %_IsDate |
| 178 |
| 179 |
| 180 TEST_F(JSIntrinsicLoweringTest, InlineIsDate) { |
| 181 Node* const input = Parameter(0); |
| 182 Node* const context = Parameter(1); |
| 183 Node* const effect = graph()->start(); |
| 184 Node* const control = graph()->start(); |
| 185 Reduction const r = Reduce( |
| 186 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsDate, 1), |
| 187 input, context, effect, control)); |
| 188 ASSERT_TRUE(r.Changed()); |
| 189 |
| 190 Node* phi = r.replacement(); |
| 191 Capture<Node*> branch, if_false; |
| 192 EXPECT_THAT( |
| 193 phi, |
| 194 IsPhi( |
| 195 static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(), |
| 196 IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(), |
| 197 IsLoadField(AccessBuilder::ForMap(), input, |
| 198 effect, CaptureEq(&if_false)), |
| 199 effect, _), |
| 200 IsInt32Constant(JS_DATE_TYPE)), |
| 201 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
| 202 IsBranch(IsObjectIsSmi(input), control))), |
| 203 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
| 204 } |
| 205 |
| 206 |
| 207 // ----------------------------------------------------------------------------- |
| 177 // %_IsTypedArray | 208 // %_IsTypedArray |
| 178 | 209 |
| 179 | 210 |
| 180 TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) { | 211 TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) { |
| 181 Node* const input = Parameter(0); | 212 Node* const input = Parameter(0); |
| 182 Node* const context = Parameter(1); | 213 Node* const context = Parameter(1); |
| 183 Node* const effect = graph()->start(); | 214 Node* const effect = graph()->start(); |
| 184 Node* const control = graph()->start(); | 215 Node* const control = graph()->start(); |
| 185 Reduction const r = Reduce(graph()->NewNode( | 216 Reduction const r = Reduce(graph()->NewNode( |
| 186 javascript()->CallRuntime(Runtime::kInlineIsTypedArray, 1), input, | 217 javascript()->CallRuntime(Runtime::kInlineIsTypedArray, 1), input, |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 CaptureEq(&if_false0)))))), | 472 CaptureEq(&if_false0)))))), |
| 442 IsMerge( | 473 IsMerge( |
| 443 IsIfTrue(AllOf(CaptureEq(&branch0), | 474 IsIfTrue(AllOf(CaptureEq(&branch0), |
| 444 IsBranch(IsObjectIsSmi(input), control))), | 475 IsBranch(IsObjectIsSmi(input), control))), |
| 445 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 476 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
| 446 } | 477 } |
| 447 | 478 |
| 448 } // namespace compiler | 479 } // namespace compiler |
| 449 } // namespace internal | 480 } // namespace internal |
| 450 } // namespace v8 | 481 } // namespace v8 |
| OLD | NEW |