| 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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/load-elimination.h" | 6 #include "src/compiler/load-elimination.h" |
| 7 #include "src/compiler/simplified-operator.h" | 7 #include "src/compiler/simplified-operator.h" |
| 8 #include "test/unittests/compiler/graph-unittest.h" | 8 #include "test/unittests/compiler/graph-unittest.h" |
| 9 #include "test/unittests/compiler/node-test-utils.h" | 9 #include "test/unittests/compiler/node-test-utils.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 namespace compiler { | 13 namespace compiler { |
| 14 | 14 |
| 15 class LoadEliminationTest : public GraphTest { | 15 class LoadEliminationTest : public GraphTest { |
| 16 public: | 16 public: |
| 17 LoadEliminationTest() : GraphTest(3), simplified_(zone()) {} | 17 LoadEliminationTest() : GraphTest(3), simplified_(zone()) {} |
| 18 ~LoadEliminationTest() OVERRIDE {} | 18 ~LoadEliminationTest() override {} |
| 19 | 19 |
| 20 protected: | 20 protected: |
| 21 Reduction Reduce(Node* node) { | 21 Reduction Reduce(Node* node) { |
| 22 LoadElimination reducer; | 22 LoadElimination reducer; |
| 23 return reducer.Reduce(node); | 23 return reducer.Reduce(node); |
| 24 } | 24 } |
| 25 | 25 |
| 26 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 26 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
| 27 | 27 |
| 28 private: | 28 private: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 Reduction r4 = Reduce(graph()->NewNode(simplified()->LoadField(access1), | 64 Reduction r4 = Reduce(graph()->NewNode(simplified()->LoadField(access1), |
| 65 object1, store3, control)); | 65 object1, store3, control)); |
| 66 ASSERT_TRUE(r4.Changed()); | 66 ASSERT_TRUE(r4.Changed()); |
| 67 EXPECT_EQ(value, r4.replacement()); | 67 EXPECT_EQ(value, r4.replacement()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace compiler | 70 } // namespace compiler |
| 71 } // namespace internal | 71 } // namespace internal |
| 72 } // namespace v8 | 72 } // namespace v8 |
| OLD | NEW |