Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: test/unittests/compiler/load-elimination-unittest.cc

Issue 2120253002: [turbofan] Initial version of the new LoadElimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_StackCheck_NoWrite
Patch Set: Fix DCHECK. Check types on substitution. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/load-elimination-unittest.cc
diff --git a/test/unittests/compiler/load-elimination-unittest.cc b/test/unittests/compiler/load-elimination-unittest.cc
deleted file mode 100644
index 721d6dfb1e551c5c6cf8af9b18ec9da46a4cbe4f..0000000000000000000000000000000000000000
--- a/test/unittests/compiler/load-elimination-unittest.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
Jarin 2016/07/04 13:18:07 Actually, this is unit-testable, so we should test
Benedikt Meurer 2016/07/05 11:29:09 Done.
-
-#include "src/compiler/access-builder.h"
-#include "src/compiler/load-elimination.h"
-#include "src/compiler/simplified-operator.h"
-#include "test/unittests/compiler/graph-unittest.h"
-#include "test/unittests/compiler/node-test-utils.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-class LoadEliminationTest : public TypedGraphTest {
- public:
- LoadEliminationTest() : TypedGraphTest(3), simplified_(zone()) {}
- ~LoadEliminationTest() override {}
-
- protected:
- Reduction Reduce(Node* node) {
- // TODO(titzer): mock the GraphReducer here for better unit testing.
- GraphReducer graph_reducer(zone(), graph());
- LoadElimination reducer(&graph_reducer, graph(), simplified());
- return reducer.Reduce(node);
- }
-
- SimplifiedOperatorBuilder* simplified() { return &simplified_; }
-
- private:
- SimplifiedOperatorBuilder simplified_;
-};
-
-
-TEST_F(LoadEliminationTest, LoadFieldWithStoreField) {
- Node* object1 = Parameter(Type::Any(), 0);
- Node* object2 = Parameter(Type::Any(), 1);
- Node* value = Parameter(Type::Any(), 2);
- Node* effect = graph()->start();
- Node* control = graph()->start();
-
- FieldAccess access1 = AccessBuilder::ForContextSlot(42);
- Node* store1 = graph()->NewNode(simplified()->StoreField(access1), object1,
- value, effect, control);
- Reduction r1 = Reduce(graph()->NewNode(simplified()->LoadField(access1),
- object1, store1, control));
- ASSERT_TRUE(r1.Changed());
- EXPECT_EQ(value, r1.replacement());
-
- FieldAccess access2 = AccessBuilder::ForMap();
- Node* store2 = graph()->NewNode(simplified()->StoreField(access2), object1,
- object2, store1, control);
- Reduction r2 = Reduce(graph()->NewNode(simplified()->LoadField(access2),
- object1, store2, control));
- ASSERT_TRUE(r2.Changed());
- EXPECT_EQ(object2, r2.replacement());
-
- Node* store3 = graph()->NewNode(
- simplified()->StoreBuffer(BufferAccess(kExternalInt8Array)), object2,
- value, Int32Constant(10), object1, store2, control);
-
- Reduction r3 = Reduce(graph()->NewNode(simplified()->LoadField(access1),
- object2, store3, control));
- ASSERT_FALSE(r3.Changed());
-
- Reduction r4 = Reduce(graph()->NewNode(simplified()->LoadField(access1),
- object1, store3, control));
- ASSERT_TRUE(r4.Changed());
- EXPECT_EQ(value, r4.replacement());
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
« no previous file with comments | « src/flag-definitions.h ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698