From e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4 Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Fri, 16 Aug 2019 11:32:46 +0200 Subject: deps: update V8 to 7.7.299.4 PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- deps/v8/src/zone/OWNERS | 3 +++ deps/v8/src/zone/zone-allocator.h | 36 ++++++++++++++++-------------------- deps/v8/src/zone/zone-splay-tree.h | 38 -------------------------------------- deps/v8/src/zone/zone.cc | 11 +++-------- deps/v8/src/zone/zone.h | 8 ++------ 5 files changed, 24 insertions(+), 72 deletions(-) create mode 100644 deps/v8/src/zone/OWNERS delete mode 100644 deps/v8/src/zone/zone-splay-tree.h (limited to 'deps/v8/src/zone') diff --git a/deps/v8/src/zone/OWNERS b/deps/v8/src/zone/OWNERS new file mode 100644 index 0000000000..01c515ab90 --- /dev/null +++ b/deps/v8/src/zone/OWNERS @@ -0,0 +1,3 @@ +clemensh@chromium.org +sigurds@chromium.org +verwaest@chromium.org diff --git a/deps/v8/src/zone/zone-allocator.h b/deps/v8/src/zone/zone-allocator.h index fe62d4bb4c..69928d5925 100644 --- a/deps/v8/src/zone/zone-allocator.h +++ b/deps/v8/src/zone/zone-allocator.h @@ -26,8 +26,18 @@ class ZoneAllocator { using other = ZoneAllocator; }; -#ifdef V8_CC_MSVC - // MSVS unfortunately requires the default constructor to be defined. +#ifdef V8_OS_WIN + // The exported class ParallelMove derives from ZoneVector, which derives + // from std::vector. On Windows, the semantics of dllexport mean that + // a class's superclasses that are not explicitly exported themselves get + // implicitly exported together with the subclass, and exporting a class + // exports all its functions -- including the std::vector() constructors + // that don't take an explicit allocator argument, which in turn reference + // the vector allocator's default constructor. So this constructor needs + // to exist for linking purposes, even if it's never called. + // Other fixes would be to disallow subclasses of ZoneVector (etc) to be + // exported, or using composition instead of inheritance for either + // ZoneVector and friends or for ParallelMove. ZoneAllocator() : ZoneAllocator(nullptr) { UNREACHABLE(); } #endif explicit ZoneAllocator(Zone* zone) : zone_(zone) {} @@ -37,14 +47,8 @@ class ZoneAllocator { template friend class ZoneAllocator; - T* address(T& x) const { return &x; } - const T* address(const T& x) const { return &x; } - - T* allocate(size_t n, const void* hint = nullptr) { - return static_cast(zone_->NewArray(static_cast(n))); - } - void deallocate(T* p, size_t) { /* noop for Zones */ - } + T* allocate(size_t n) { return zone_->NewArray(n); } + void deallocate(T* p, size_t) {} // noop for zones size_t max_size() const { return std::numeric_limits::max() / sizeof(T); @@ -84,13 +88,6 @@ class RecyclingZoneAllocator : public ZoneAllocator { using other = RecyclingZoneAllocator; }; -#ifdef V8_CC_MSVC - // MSVS unfortunately requires the default constructor to be defined. - RecyclingZoneAllocator() - : ZoneAllocator(nullptr, nullptr), free_list_(nullptr) { - UNREACHABLE(); - } -#endif explicit RecyclingZoneAllocator(Zone* zone) : ZoneAllocator(zone), free_list_(nullptr) {} template @@ -100,16 +97,15 @@ class RecyclingZoneAllocator : public ZoneAllocator { template friend class RecyclingZoneAllocator; - T* allocate(size_t n, const void* hint = nullptr) { + T* allocate(size_t n) { // Only check top block in free list, since this will be equal to or larger // than the other blocks in the free list. if (free_list_ && free_list_->size >= n) { T* return_val = reinterpret_cast(free_list_); free_list_ = free_list_->next; return return_val; - } else { - return ZoneAllocator::allocate(n, hint); } + return ZoneAllocator::allocate(n); } void deallocate(T* p, size_t n) { diff --git a/deps/v8/src/zone/zone-splay-tree.h b/deps/v8/src/zone/zone-splay-tree.h deleted file mode 100644 index c28df38fda..0000000000 --- a/deps/v8/src/zone/zone-splay-tree.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2019 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. - -#ifndef V8_ZONE_ZONE_SPLAY_TREE_H_ -#define V8_ZONE_ZONE_SPLAY_TREE_H_ - -#include "src/utils/splay-tree.h" -#include "src/zone/zone.h" - -namespace v8 { -namespace internal { - -// A zone splay tree. The config type parameter encapsulates the -// different configurations of a concrete splay tree (see splay-tree.h). -// The tree itself and all its elements are allocated in the Zone. -template -class ZoneSplayTree final : public SplayTree { - public: - explicit ZoneSplayTree(Zone* zone) - : SplayTree(ZoneAllocationPolicy(zone)) {} - ~ZoneSplayTree() { - // Reset the root to avoid unneeded iteration over all tree nodes - // in the destructor. For a zone-allocated tree, nodes will be - // freed by the Zone. - SplayTree::ResetRoot(); - } - - void* operator new(size_t size, Zone* zone) { return zone->New(size); } - - void operator delete(void* pointer) { UNREACHABLE(); } - void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } -}; - -} // namespace internal -} // namespace v8 - -#endif // V8_ZONE_ZONE_SPLAY_TREE_H_ diff --git a/deps/v8/src/zone/zone.cc b/deps/v8/src/zone/zone.cc index a6f45fad54..81fc9c7d8b 100644 --- a/deps/v8/src/zone/zone.cc +++ b/deps/v8/src/zone/zone.cc @@ -27,8 +27,7 @@ constexpr size_t kASanRedzoneBytes = 0; } // namespace -Zone::Zone(AccountingAllocator* allocator, const char* name, - SegmentSize segment_size) +Zone::Zone(AccountingAllocator* allocator, const char* name) : allocation_size_(0), segment_bytes_allocated_(0), position_(0), @@ -36,8 +35,7 @@ Zone::Zone(AccountingAllocator* allocator, const char* name, allocator_(allocator), segment_head_(nullptr), name_(name), - sealed_(false), - segment_size_(segment_size) { + sealed_(false) { allocator_->ZoneCreation(this); } @@ -137,12 +135,9 @@ Address Zone::NewExpand(size_t size) { V8::FatalProcessOutOfMemory(nullptr, "Zone"); return kNullAddress; } - if (segment_size_ == SegmentSize::kLarge) { - new_size = kMaximumSegmentSize; - } if (new_size < kMinimumSegmentSize) { new_size = kMinimumSegmentSize; - } else if (new_size > kMaximumSegmentSize) { + } else if (new_size >= kMaximumSegmentSize) { // Limit the size of new segments to avoid growing the segment size // exponentially, thus putting pressure on contiguous virtual address space. // All the while making sure to allocate a segment large enough to hold the diff --git a/deps/v8/src/zone/zone.h b/deps/v8/src/zone/zone.h index b113f49585..e2b66253f5 100644 --- a/deps/v8/src/zone/zone.h +++ b/deps/v8/src/zone/zone.h @@ -37,12 +37,9 @@ namespace internal { // Note: The implementation is inherently not thread safe. Do not use // from multi-threaded code. -enum class SegmentSize { kLarge, kDefault }; - class V8_EXPORT_PRIVATE Zone final { public: - Zone(AccountingAllocator* allocator, const char* name, - SegmentSize segment_size = SegmentSize::kDefault); + Zone(AccountingAllocator* allocator, const char* name); ~Zone(); // Allocate 'size' bytes of memory in the Zone; expands the Zone by @@ -102,7 +99,7 @@ class V8_EXPORT_PRIVATE Zone final { static const size_t kMinimumSegmentSize = 8 * KB; // Never allocate segments larger than this size in bytes. - static const size_t kMaximumSegmentSize = 1 * MB; + static const size_t kMaximumSegmentSize = 32 * KB; // Report zone excess when allocation exceeds this limit. static const size_t kExcessLimit = 256 * MB; @@ -136,7 +133,6 @@ class V8_EXPORT_PRIVATE Zone final { Segment* segment_head_; const char* name_; bool sealed_; - SegmentSize segment_size_; }; // ZoneObject is an abstraction that helps define classes of objects -- cgit v1.2.3