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/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-intrinsic-lowering.h" | 7 #include "src/compiler/js-intrinsic-lowering.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "test/unittests/compiler/graph-unittest.h" | 9 #include "test/unittests/compiler/graph-unittest.h" |
10 #include "test/unittests/compiler/node-test-utils.h" | 10 #include "test/unittests/compiler/node-test-utils.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 effect, CaptureEq(&if_false)), | 217 effect, CaptureEq(&if_false)), |
218 effect, _), | 218 effect, _), |
219 IsInt32Constant(JS_REGEXP_TYPE)), | 219 IsInt32Constant(JS_REGEXP_TYPE)), |
220 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | 220 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), |
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 // %_MathClz32 |
| 228 |
| 229 |
| 230 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
| 231 Node* const input = Parameter(0); |
| 232 Node* const context = Parameter(1); |
| 233 Node* const effect = graph()->start(); |
| 234 Node* const control = graph()->start(); |
| 235 Reduction const r = Reduce( |
| 236 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), |
| 237 input, context, effect, control)); |
| 238 ASSERT_TRUE(r.Changed()); |
| 239 EXPECT_THAT(r.replacement(), IsWord32Clz(input)); |
| 240 } |
| 241 |
| 242 |
| 243 // ----------------------------------------------------------------------------- |
227 // %_ValueOf | 244 // %_ValueOf |
228 | 245 |
229 | 246 |
230 TEST_F(JSIntrinsicLoweringTest, InlineValueOf) { | 247 TEST_F(JSIntrinsicLoweringTest, InlineValueOf) { |
231 Node* const input = Parameter(0); | 248 Node* const input = Parameter(0); |
232 Node* const context = Parameter(1); | 249 Node* const context = Parameter(1); |
233 Node* const effect = graph()->start(); | 250 Node* const effect = graph()->start(); |
234 Node* const control = graph()->start(); | 251 Node* const control = graph()->start(); |
235 Reduction const r = Reduce( | 252 Reduction const r = Reduce( |
236 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineValueOf, 1), | 253 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineValueOf, 1), |
(...skipping 24 matching lines...) Expand all Loading... |
261 CaptureEq(&if_false0)))))), | 278 CaptureEq(&if_false0)))))), |
262 IsMerge( | 279 IsMerge( |
263 IsIfTrue(AllOf(CaptureEq(&branch0), | 280 IsIfTrue(AllOf(CaptureEq(&branch0), |
264 IsBranch(IsObjectIsSmi(input), control))), | 281 IsBranch(IsObjectIsSmi(input), control))), |
265 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 282 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
266 } | 283 } |
267 | 284 |
268 } // namespace compiler | 285 } // namespace compiler |
269 } // namespace internal | 286 } // namespace internal |
270 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |