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/cctest/compiler/test-js-constant-cache.cc b/test/cctest/compiler/test-js-constant-cache.cc
index eb0975e..8588f66 100644
--- a/test/cctest/compiler/test-js-constant-cache.cc
+++ b/test/cctest/compiler/test-js-constant-cache.cc
@@ -4,6 +4,7 @@
#include "src/v8.h"
+#include "src/assembler.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/node-properties-inl.h"
#include "src/compiler/typer.h"
@@ -20,8 +21,8 @@
: main_graph_(zone),
main_common_(zone),
main_javascript_(zone),
- main_typer_(zone),
- main_machine_() {}
+ main_typer_(&main_graph_, MaybeHandle<Context>()),
+ main_machine_(zone) {}
Graph main_graph_;
CommonOperatorBuilder main_common_;
JSOperatorBuilder main_javascript_;
@@ -30,14 +31,19 @@
};
+// TODO(dcarney): JSConstantCacheTester inherits from JSGraph???
class JSConstantCacheTester : public HandleAndZoneScope,
public JSCacheTesterHelper,
public JSGraph {
public:
JSConstantCacheTester()
: JSCacheTesterHelper(main_zone()),
- JSGraph(&main_graph_, &main_common_, &main_javascript_, &main_typer_,
- &main_machine_) {}
+ JSGraph(&main_graph_, &main_common_, &main_javascript_,
+ &main_machine_) {
+ main_graph_.SetStart(main_graph_.NewNode(common()->Start(0)));
+ main_graph_.SetEnd(main_graph_.NewNode(common()->End()));
+ main_typer_.Run();
+ }
Type* upper(Node* node) { return NodeProperties::GetBounds(node).upper; }
@@ -227,7 +233,7 @@
FOR_FLOAT64_INPUTS(i) {
double value = *i;
Node* node = T.Constant(value);
- CHECK(T.upper(node)->Equals(Type::Of(value, T.main_zone())));
+ CHECK(T.upper(node)->Is(Type::Of(value, T.main_zone())));
}
}
@@ -289,3 +295,180 @@
TEST(ExternalReferences) {
// TODO(titzer): test canonicalization of external references.
}
+
+
+static bool Contains(NodeVector* nodes, Node* n) {
+ for (size_t i = 0; i < nodes->size(); i++) {
+ if (nodes->at(i) == n) return true;
+ }
+ return false;
+}
+
+
+static void CheckGetCachedNodesContains(JSConstantCacheTester* T, Node* n) {
+ NodeVector nodes(T->main_zone());
+ T->GetCachedNodes(&nodes);
+ CHECK(Contains(&nodes, n));
+}
+
+
+TEST(JSGraph_GetCachedNodes1) {
+ JSConstantCacheTester T;
+ CheckGetCachedNodesContains(&T, T.TrueConstant());
+ CheckGetCachedNodesContains(&T, T.UndefinedConstant());
+ CheckGetCachedNodesContains(&T, T.TheHoleConstant());
+ CheckGetCachedNodesContains(&T, T.TrueConstant());
+ CheckGetCachedNodesContains(&T, T.FalseConstant());
+ CheckGetCachedNodesContains(&T, T.NullConstant());
+ CheckGetCachedNodesContains(&T, T.ZeroConstant());
+ CheckGetCachedNodesContains(&T, T.OneConstant());
+ CheckGetCachedNodesContains(&T, T.NaNConstant());
+}
+
+
+TEST(JSGraph_GetCachedNodes_int32) {
+ JSConstantCacheTester T;
+
+ int32_t constants[] = {0, 1, 1, 1, 1, 2, 3, 4, 11, 12, 13,
+ 14, 55, -55, -44, -33, -22, -11, 16, 16, 17, 17,
+ 18, 18, 19, 19, 20, 20, 21, 21, 22, 23, 24,
+ 25, 15, 30, 31, 45, 46, 47, 48};
+
+ for (size_t i = 0; i < arraysize(constants); i++) {
+ int count_before = T.graph()->NodeCount();
+ NodeVector nodes_before(T.main_zone());
+ T.GetCachedNodes(&nodes_before);
+ Node* n = T.Int32Constant(constants[i]);
+ if (n->id() < count_before) {
+ // An old ID indicates a cached node. It should have been in the set.
+ CHECK(Contains(&nodes_before, n));
+ }
+ // Old or new, it should be in the cached set afterwards.
+ CheckGetCachedNodesContains(&T, n);
+ }
+}
+
+
+TEST(JSGraph_GetCachedNodes_float64) {
+ JSConstantCacheTester T;
+
+ double constants[] = {0, 11.1, 12.2, 13, 14, 55.5, -55.5, -44.4,
+ -33, -22, -11, 0, 11.1, 11.1, 12.3, 12.3,
+ 11, 11, -33.3, -33.3, -22, -11};
+
+ for (size_t i = 0; i < arraysize(constants); i++) {
+ int count_before = T.graph()->NodeCount();
+ NodeVector nodes_before(T.main_zone());
+ T.GetCachedNodes(&nodes_before);
+ Node* n = T.Float64Constant(constants[i]);
+ if (n->id() < count_before) {
+ // An old ID indicates a cached node. It should have been in the set.
+ CHECK(Contains(&nodes_before, n));
+ }
+ // Old or new, it should be in the cached set afterwards.
+ CheckGetCachedNodesContains(&T, n);
+ }
+}
+
+
+TEST(JSGraph_GetCachedNodes_int64) {
+ JSConstantCacheTester T;
+
+ int32_t constants[] = {0, 11, 12, 13, 14, 55, -55, -44, -33,
+ -22, -11, 16, 16, 17, 17, 18, 18, 19,
+ 19, 20, 20, 21, 21, 22, 23, 24, 25};
+
+ for (size_t i = 0; i < arraysize(constants); i++) {
+ int count_before = T.graph()->NodeCount();
+ NodeVector nodes_before(T.main_zone());
+ T.GetCachedNodes(&nodes_before);
+ Node* n = T.Int64Constant(constants[i]);
+ if (n->id() < count_before) {
+ // An old ID indicates a cached node. It should have been in the set.
+ CHECK(Contains(&nodes_before, n));
+ }
+ // Old or new, it should be in the cached set afterwards.
+ CheckGetCachedNodesContains(&T, n);
+ }
+}
+
+
+TEST(JSGraph_GetCachedNodes_number) {
+ JSConstantCacheTester T;
+
+ double constants[] = {0, 11.1, 12.2, 13, 14, 55.5, -55.5, -44.4,
+ -33, -22, -11, 0, 11.1, 11.1, 12.3, 12.3,
+ 11, 11, -33.3, -33.3, -22, -11};
+
+ for (size_t i = 0; i < arraysize(constants); i++) {
+ int count_before = T.graph()->NodeCount();
+ NodeVector nodes_before(T.main_zone());
+ T.GetCachedNodes(&nodes_before);
+ Node* n = T.Constant(constants[i]);
+ if (n->id() < count_before) {
+ // An old ID indicates a cached node. It should have been in the set.
+ CHECK(Contains(&nodes_before, n));
+ }
+ // Old or new, it should be in the cached set afterwards.
+ CheckGetCachedNodesContains(&T, n);
+ }
+}
+
+
+TEST(JSGraph_GetCachedNodes_external) {
+ JSConstantCacheTester T;
+
+ ExternalReference constants[] = {ExternalReference::address_of_min_int(),
+ ExternalReference::address_of_min_int(),
+ ExternalReference::address_of_min_int(),
+ ExternalReference::address_of_one_half(),
+ ExternalReference::address_of_one_half(),
+ ExternalReference::address_of_min_int(),
+ ExternalReference::address_of_the_hole_nan(),
+ ExternalReference::address_of_one_half()};
+
+ for (size_t i = 0; i < arraysize(constants); i++) {
+ int count_before = T.graph()->NodeCount();
+ NodeVector nodes_before(T.main_zone());
+ T.GetCachedNodes(&nodes_before);
+ Node* n = T.ExternalConstant(constants[i]);
+ if (n->id() < count_before) {
+ // An old ID indicates a cached node. It should have been in the set.
+ CHECK(Contains(&nodes_before, n));
+ }
+ // Old or new, it should be in the cached set afterwards.
+ CheckGetCachedNodesContains(&T, n);
+ }
+}
+
+
+TEST(JSGraph_GetCachedNodes_together) {
+ JSConstantCacheTester T;
+
+ Node* constants[] = {
+ T.TrueConstant(),
+ T.UndefinedConstant(),
+ T.TheHoleConstant(),
+ T.TrueConstant(),
+ T.FalseConstant(),
+ T.NullConstant(),
+ T.ZeroConstant(),
+ T.OneConstant(),
+ T.NaNConstant(),
+ T.Int32Constant(0),
+ T.Int32Constant(1),
+ T.Int64Constant(-2),
+ T.Int64Constant(-4),
+ T.Float64Constant(0.9),
+ T.Float64Constant(V8_INFINITY),
+ T.Constant(0.99),
+ T.Constant(1.11),
+ T.ExternalConstant(ExternalReference::address_of_one_half())};
+
+ NodeVector nodes(T.main_zone());
+ T.GetCachedNodes(&nodes);
+
+ for (size_t i = 0; i < arraysize(constants); i++) {
+ CHECK(Contains(&nodes, constants[i]));
+ }
+}