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 "test/cctest/cctest.h" | 5 #include "test/cctest/cctest.h" |
6 #include "test/cctest/compiler/codegen-tester.h" | 6 #include "test/cctest/compiler/codegen-tester.h" |
7 #include "test/cctest/compiler/value-helper.h" | 7 #include "test/cctest/compiler/value-helper.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 : eq_constant) | 450 : eq_constant) |
451 : (cmp.Float64Compare(input_a, input_b) ? eq_constant | 451 : (cmp.Float64Compare(input_a, input_b) ? eq_constant |
452 : ne_constant); | 452 : ne_constant); |
453 CHECK_EQ(expected, m.Call()); | 453 CHECK_EQ(expected, m.Call()); |
454 } | 454 } |
455 } | 455 } |
456 } | 456 } |
457 } | 457 } |
458 } | 458 } |
459 | 459 |
| 460 TEST(BranchCombineEffectLevel) { |
| 461 // Test that the load doesn't get folded into the branch, as there's a store |
| 462 // between them. See http://crbug.com/611976. |
| 463 int32_t input = 0; |
| 464 |
| 465 RawMachineAssemblerTester<int32_t> m; |
| 466 Node* a = m.LoadFromPointer(&input, MachineType::Int32()); |
| 467 Node* compare = m.Word32And(a, m.Int32Constant(1)); |
| 468 Node* equal = m.Word32Equal(compare, m.Int32Constant(0)); |
| 469 m.StoreToPointer(&input, MachineRepresentation::kWord32, m.Int32Constant(1)); |
| 470 |
| 471 RawMachineLabel blocka, blockb; |
| 472 m.Branch(equal, &blocka, &blockb); |
| 473 m.Bind(&blocka); |
| 474 m.Return(m.Int32Constant(42)); |
| 475 m.Bind(&blockb); |
| 476 m.Return(m.Int32Constant(0)); |
| 477 |
| 478 CHECK_EQ(42, m.Call()); |
| 479 } |
| 480 |
460 } // namespace compiler | 481 } // namespace compiler |
461 } // namespace internal | 482 } // namespace internal |
462 } // namespace v8 | 483 } // namespace v8 |
OLD | NEW |