OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "test/compiler-unittests/graph-unittest.h" | 10 #include "test/compiler-unittests/graph-unittest.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 Node* val = Parameter(0); | 257 Node* val = Parameter(0); |
258 Node* node = graph()->NewNode(simplified()->ChangeTaggedToInt32(), val); | 258 Node* node = graph()->NewNode(simplified()->ChangeTaggedToInt32(), val); |
259 Reduction reduction = Reduce(node); | 259 Reduction reduction = Reduce(node); |
260 ASSERT_TRUE(reduction.Changed()); | 260 ASSERT_TRUE(reduction.Changed()); |
261 | 261 |
262 Node* phi = reduction.replacement(); | 262 Node* phi = reduction.replacement(); |
263 Capture<Node*> branch, if_true; | 263 Capture<Node*> branch, if_true; |
264 EXPECT_THAT( | 264 EXPECT_THAT( |
265 phi, | 265 phi, |
266 IsPhi(IsChangeFloat64ToInt32(IsLoad( | 266 IsPhi(IsTruncateFloat64ToInt32(IsLoad( |
267 kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()), | 267 kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()), |
268 IsControlEffect(CaptureEq(&if_true)))), | 268 IsControlEffect(CaptureEq(&if_true)))), |
269 IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())), | 269 IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())), |
270 IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))), | 270 IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))), |
271 IsIfFalse(AllOf( | 271 IsIfFalse(AllOf( |
272 CaptureEq(&branch), | 272 CaptureEq(&branch), |
273 IsBranch(IsWord32And(val, IsInt32Constant(kSmiTagMask)), | 273 IsBranch(IsWord32And(val, IsInt32Constant(kSmiTagMask)), |
274 graph()->start())))))); | 274 graph()->start())))))); |
275 } | 275 } |
276 | 276 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 Node* val = Parameter(0); | 335 Node* val = Parameter(0); |
336 Node* node = graph()->NewNode(simplified()->ChangeTaggedToInt32(), val); | 336 Node* node = graph()->NewNode(simplified()->ChangeTaggedToInt32(), val); |
337 Reduction reduction = Reduce(node); | 337 Reduction reduction = Reduce(node); |
338 ASSERT_TRUE(reduction.Changed()); | 338 ASSERT_TRUE(reduction.Changed()); |
339 | 339 |
340 Node* phi = reduction.replacement(); | 340 Node* phi = reduction.replacement(); |
341 Capture<Node*> branch, if_true; | 341 Capture<Node*> branch, if_true; |
342 EXPECT_THAT( | 342 EXPECT_THAT( |
343 phi, | 343 phi, |
344 IsPhi(IsChangeFloat64ToInt32(IsLoad( | 344 IsPhi(IsTruncateFloat64ToInt32(IsLoad( |
345 kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()), | 345 kMachFloat64, val, IsInt32Constant(HeapNumberValueOffset()), |
346 IsControlEffect(CaptureEq(&if_true)))), | 346 IsControlEffect(CaptureEq(&if_true)))), |
347 IsTruncateInt64ToInt32( | 347 IsTruncateInt64ToInt32( |
348 IsWord64Sar(val, IsInt32Constant(SmiShiftAmount()))), | 348 IsWord64Sar(val, IsInt32Constant(SmiShiftAmount()))), |
349 IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))), | 349 IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))), |
350 IsIfFalse(AllOf( | 350 IsIfFalse(AllOf( |
351 CaptureEq(&branch), | 351 CaptureEq(&branch), |
352 IsBranch(IsWord64And(val, IsInt32Constant(kSmiTagMask)), | 352 IsBranch(IsWord64And(val, IsInt32Constant(kSmiTagMask)), |
353 graph()->start())))))); | 353 graph()->start())))))); |
354 } | 354 } |
355 | 355 |
356 } // namespace compiler | 356 } // namespace compiler |
357 } // namespace internal | 357 } // namespace internal |
358 } // namespace v8 | 358 } // namespace v8 |
OLD | NEW |