Update V8 to version 4.1.0.21
This is a cherry-pick of all commits up to and including the
4.1.0.21 cherry-pick in Chromium.
Original commit message:
Version 4.1.0.21 (cherry-pick)
Merged 206e9136bde0f2b5ae8cb77afbb1e7833e5bd412
Unlink pages from the space page list after evacuation.
BUG=430201
LOG=N
R=jkummerow@chromium.org
Review URL: https://codereview.chromium.org/953813002
Cr-Commit-Position: refs/branch-heads/4.1@{#22}
Cr-Branched-From: 2e08d2a7aa9d65d269d8c57aba82eb38a8cb0a18-refs/heads/candidates@{#25353}
---
FPIIM-449
Change-Id: I8c23c7bbb70772b4858fe8a47b64fa97ee0d1f8c
diff --git a/test/unittests/compiler/load-elimination-unittest.cc b/test/unittests/compiler/load-elimination-unittest.cc
new file mode 100644
index 0000000..f0cd60e
--- /dev/null
+++ b/test/unittests/compiler/load-elimination-unittest.cc
@@ -0,0 +1,72 @@
+// 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.
+
+#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 GraphTest {
+ public:
+ LoadEliminationTest() : GraphTest(3), simplified_(zone()) {}
+ ~LoadEliminationTest() OVERRIDE {}
+
+ protected:
+ Reduction Reduce(Node* node) {
+ LoadElimination reducer;
+ return reducer.Reduce(node);
+ }
+
+ SimplifiedOperatorBuilder* simplified() { return &simplified_; }
+
+ private:
+ SimplifiedOperatorBuilder simplified_;
+};
+
+
+TEST_F(LoadEliminationTest, LoadFieldWithStoreField) {
+ Node* object1 = Parameter(0);
+ Node* object2 = Parameter(1);
+ Node* value = Parameter(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