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

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

Issue 2618273002: [turbofan] A bug fix of loadElimination (Closed)
Patch Set: add test case Created 3 years, 11 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/compiler/load-elimination.cc ('k') | no next file » | 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
index 22e843aa367c4374e1903ea71eb9d02d23327609..8d34fb9699dd60abb9915e788b3ca83f80782ec4 100644
--- a/test/unittests/compiler/load-elimination-unittest.cc
+++ b/test/unittests/compiler/load-elimination-unittest.cc
@@ -174,6 +174,46 @@ TEST_F(LoadEliminationTest, StoreFieldAndLoadField) {
EXPECT_EQ(value, r.replacement());
}
+TEST_F(LoadEliminationTest, StoreFieldAndKillFields) {
+ Node* object = Parameter(Type::Any(), 0);
+ Node* value = Parameter(Type::Any(), 1);
+ Node* effect = graph()->start();
+ Node* control = graph()->start();
+
+ FieldAccess access1 = {kTaggedBase, kPointerSize,
+ MaybeHandle<Name>(), MaybeHandle<Map>(),
+ Type::Any(), MachineType::AnyTagged(),
+ kNoWriteBarrier};
+
+ // Offset that out of field cache size.
+ FieldAccess access2 = {kTaggedBase, 2048 * kPointerSize,
+ MaybeHandle<Name>(), MaybeHandle<Map>(),
+ Type::Any(), MachineType::AnyTagged(),
+ kNoWriteBarrier};
+
+ StrictMock<MockAdvancedReducerEditor> editor;
+ LoadElimination load_elimination(&editor, jsgraph(), zone());
+
+ load_elimination.Reduce(graph()->start());
+
+ Node* store1 = effect = graph()->NewNode(simplified()->StoreField(access1),
+ object, value, effect, control);
+ load_elimination.Reduce(store1);
+
+ // Invalidate caches of object.
+ Node* store2 = effect = graph()->NewNode(simplified()->StoreField(access2),
+ object, value, effect, control);
+ load_elimination.Reduce(store2);
+
+ Node* store3 = graph()->NewNode(simplified()->StoreField(access1),
+ object, value, effect, control);
+
+ Reduction r = load_elimination.Reduce(store3);
+
+ // store3 shall not be replaced, since caches were invalidated.
+ EXPECT_EQ(store3, r.replacement());
+}
+
TEST_F(LoadEliminationTest, StoreFieldAndStoreElementAndLoadField) {
Node* object = Parameter(Type::Any(), 0);
Node* value = Parameter(Type::Any(), 1);
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698