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 | 364 Node* ret = graph()->NewNode(common()->Return(), phi, ephi, merge); |
365 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | |
366 Node* ret = graph()->NewNode(common()->Return(), zero, phi, ephi, merge); | |
367 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); | 365 graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); |
368 StrictMock<MockAdvancedReducerEditor> editor; | 366 StrictMock<MockAdvancedReducerEditor> editor; |
369 EXPECT_CALL(editor, Replace(merge, IsDead())); | 367 EXPECT_CALL(editor, Replace(merge, IsDead())); |
370 Reduction const r = Reduce(&editor, ret); | 368 Reduction const r = Reduce(&editor, ret); |
371 ASSERT_TRUE(r.Changed()); | 369 ASSERT_TRUE(r.Changed()); |
372 EXPECT_THAT(r.replacement(), IsDead()); | 370 EXPECT_THAT(r.replacement(), IsDead()); |
373 EXPECT_THAT(graph()->end(), IsEnd(ret, IsReturn(vtrue, etrue, if_true), | 371 EXPECT_THAT(graph()->end(), IsEnd(ret, IsReturn(vtrue, etrue, if_true), |
374 IsReturn(vfalse, efalse, if_false))); | 372 IsReturn(vfalse, efalse, if_false))); |
375 } | 373 } |
376 | 374 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 graph()->NewNode(common()->Select(MachineRepresentation::kFloat64), check, | 458 graph()->NewNode(common()->Select(MachineRepresentation::kFloat64), check, |
461 p0, graph()->NewNode(machine()->Float64Sub(), c0, p0)); | 459 p0, graph()->NewNode(machine()->Float64Sub(), c0, p0)); |
462 Reduction r = Reduce(select); | 460 Reduction r = Reduce(select); |
463 ASSERT_TRUE(r.Changed()); | 461 ASSERT_TRUE(r.Changed()); |
464 EXPECT_THAT(r.replacement(), IsFloat64Abs(p0)); | 462 EXPECT_THAT(r.replacement(), IsFloat64Abs(p0)); |
465 } | 463 } |
466 | 464 |
467 } // namespace compiler | 465 } // namespace compiler |
468 } // namespace internal | 466 } // namespace internal |
469 } // namespace v8 | 467 } // namespace v8 |
OLD | NEW |