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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/common-operator-reducer.h" | 6 #include "src/compiler/common-operator-reducer.h" |
7 #include "src/compiler/machine-operator.h" | 7 #include "src/compiler/machine-operator.h" |
8 #include "src/compiler/operator.h" | 8 #include "src/compiler/operator.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/machine-type.h" | 10 #include "src/machine-type.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 354 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
355 Node* etrue = graph()->start(); | 355 Node* etrue = graph()->start(); |
356 Node* vtrue = Parameter(0); | 356 Node* vtrue = Parameter(0); |
357 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 357 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
358 Node* efalse = graph()->start(); | 358 Node* efalse = graph()->start(); |
359 Node* vfalse = Parameter(1); | 359 Node* vfalse = Parameter(1); |
360 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); | 360 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
361 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); | 361 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); |
362 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 362 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
363 vtrue, vfalse, merge); | 363 vtrue, vfalse, merge); |
364 Node* ret = graph()->NewNode(common()->Return(), phi, ephi, merge); | 364 |
| 365 Node* zero = graph()->NewNode(common()->Int32Constant(0)); |
| 366 Node* ret = graph()->NewNode(common()->Return(), zero, phi, ephi, merge); |
365 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); | 367 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); |
366 StrictMock<MockAdvancedReducerEditor> editor; | 368 StrictMock<MockAdvancedReducerEditor> editor; |
367 EXPECT_CALL(editor, Replace(merge, IsDead())); | 369 EXPECT_CALL(editor, Replace(merge, IsDead())); |
368 Reduction const r = Reduce(&editor, ret); | 370 Reduction const r = Reduce(&editor, ret); |
369 ASSERT_TRUE(r.Changed()); | 371 ASSERT_TRUE(r.Changed()); |
370 EXPECT_THAT(r.replacement(), IsDead()); | 372 EXPECT_THAT(r.replacement(), IsDead()); |
371 EXPECT_THAT(graph()->end(), IsEnd(ret, IsReturn(vtrue, etrue, if_true), | 373 EXPECT_THAT(graph()->end(), IsEnd(ret, IsReturn(vtrue, etrue, if_true), |
372 IsReturn(vfalse, efalse, if_false))); | 374 IsReturn(vfalse, efalse, if_false))); |
373 } | 375 } |
374 | 376 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 graph()->NewNode(common()->Select(MachineRepresentation::kFloat64), check, | 460 graph()->NewNode(common()->Select(MachineRepresentation::kFloat64), check, |
459 p0, graph()->NewNode(machine()->Float64Sub(), c0, p0)); | 461 p0, graph()->NewNode(machine()->Float64Sub(), c0, p0)); |
460 Reduction r = Reduce(select); | 462 Reduction r = Reduce(select); |
461 ASSERT_TRUE(r.Changed()); | 463 ASSERT_TRUE(r.Changed()); |
462 EXPECT_THAT(r.replacement(), IsFloat64Abs(p0)); | 464 EXPECT_THAT(r.replacement(), IsFloat64Abs(p0)); |
463 } | 465 } |
464 | 466 |
465 } // namespace compiler | 467 } // namespace compiler |
466 } // namespace internal | 468 } // namespace internal |
467 } // namespace v8 | 469 } // namespace v8 |
OLD | NEW |