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/src/compiler/node-cache.h b/src/compiler/node-cache.h
index 35352ea..b123922 100644
--- a/src/compiler/node-cache.h
+++ b/src/compiler/node-cache.h
@@ -5,20 +5,33 @@
#ifndef V8_COMPILER_NODE_CACHE_H_
#define V8_COMPILER_NODE_CACHE_H_
-#include "src/v8.h"
-
-#include "src/compiler/node.h"
+#include "src/base/functional.h"
+#include "src/base/macros.h"
namespace v8 {
namespace internal {
+
+// Forward declarations.
+class Zone;
+template <typename>
+class ZoneVector;
+
+
namespace compiler {
+// Forward declarations.
+class Node;
+
+
// A cache for nodes based on a key. Useful for implementing canonicalization of
// nodes such as constants, parameters, etc.
-template <typename Key>
-class NodeCache {
+template <typename Key, typename Hash = base::hash<Key>,
+ typename Pred = std::equal_to<Key> >
+class NodeCache FINAL {
public:
- explicit NodeCache(int max = 256) : entries_(NULL), size_(0), max_(max) {}
+ explicit NodeCache(unsigned max = 256)
+ : entries_(nullptr), size_(0), max_(max) {}
+ ~NodeCache() {}
// Search for node associated with {key} and return a pointer to a memory
// location in this cache that stores an entry for the key. If the location
@@ -29,25 +42,34 @@
// too full or encounters too many hash collisions.
Node** Find(Zone* zone, Key key);
+ // Appends all nodes from this cache to {nodes}.
+ void GetCachedNodes(ZoneVector<Node*>* nodes);
+
private:
- struct Entry {
- Key key_;
- Node* value_;
- };
+ struct Entry;
Entry* entries_; // lazily-allocated hash entries.
- int32_t size_;
- int32_t max_;
+ size_t size_;
+ size_t max_;
+ Hash hash_;
+ Pred pred_;
bool Resize(Zone* zone);
+
+ DISALLOW_COPY_AND_ASSIGN(NodeCache);
};
// Various default cache types.
-typedef NodeCache<int64_t> Int64NodeCache;
typedef NodeCache<int32_t> Int32NodeCache;
-typedef NodeCache<void*> PtrNodeCache;
-}
-}
-} // namespace v8::internal::compiler
+typedef NodeCache<int64_t> Int64NodeCache;
+#if V8_HOST_ARCH_32_BIT
+typedef Int32NodeCache IntPtrNodeCache;
+#else
+typedef Int64NodeCache IntPtrNodeCache;
+#endif
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
#endif // V8_COMPILER_NODE_CACHE_H_