Commit a0486202 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[zone] Use 32kb instead of 1MB as high zone page size

It seems that allocating smaller pages is actually quite a bit faster than
larger pages, probably because they can be cached by malloc. Let's see what the
bots say.

In a follow-up I'll check whether the segment-pool is actually beneficial or
whether we should just remove it.

This also drops SegmentSize::kLarge as a way to make compilation deterministic.
Turns out that by now we need >8mb anyway, and the previous 1mb wasn't enough.
At the same time the compiler was fixed to not rely on virtual addresses of
zone objects anymore, and there's a bot checking whether the snapshot is
determistic.

Change-Id: I38cbb0d209d68b3671fd38763b42714811f4223e
Reviewed-on: https://chromium-review.googlesource.com/c/1346370Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57683}
parent 57e1e72a
...@@ -140,10 +140,7 @@ Code BuildWithCodeStubAssemblerJS(Isolate* isolate, int32_t builtin_index, ...@@ -140,10 +140,7 @@ Code BuildWithCodeStubAssemblerJS(Isolate* isolate, int32_t builtin_index,
// to code targets without dereferencing their handles. // to code targets without dereferencing their handles.
CanonicalHandleScope canonical(isolate); CanonicalHandleScope canonical(isolate);
SegmentSize segment_size = isolate->serializer_enabled() Zone zone(isolate->allocator(), ZONE_NAME);
? SegmentSize::kLarge
: SegmentSize::kDefault;
Zone zone(isolate->allocator(), ZONE_NAME, segment_size);
const int argc_with_recv = const int argc_with_recv =
(argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1; (argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
compiler::CodeAssemblerState state( compiler::CodeAssemblerState state(
...@@ -165,10 +162,7 @@ Code BuildWithCodeStubAssemblerCS(Isolate* isolate, int32_t builtin_index, ...@@ -165,10 +162,7 @@ Code BuildWithCodeStubAssemblerCS(Isolate* isolate, int32_t builtin_index,
// Canonicalize handles, so that we can share constant pool entries pointing // Canonicalize handles, so that we can share constant pool entries pointing
// to code targets without dereferencing their handles. // to code targets without dereferencing their handles.
CanonicalHandleScope canonical(isolate); CanonicalHandleScope canonical(isolate);
SegmentSize segment_size = isolate->serializer_enabled() Zone zone(isolate->allocator(), ZONE_NAME);
? SegmentSize::kLarge
: SegmentSize::kDefault;
Zone zone(isolate->allocator(), ZONE_NAME, segment_size);
// The interface descriptor with given key must be initialized at this point // The interface descriptor with given key must be initialized at this point
// and this construction just queries the details from the descriptors table. // and this construction just queries the details from the descriptors table.
CallInterfaceDescriptor descriptor(interface_descriptor); CallInterfaceDescriptor descriptor(interface_descriptor);
......
...@@ -27,8 +27,7 @@ constexpr size_t kASanRedzoneBytes = 0; ...@@ -27,8 +27,7 @@ constexpr size_t kASanRedzoneBytes = 0;
} // namespace } // namespace
Zone::Zone(AccountingAllocator* allocator, const char* name, Zone::Zone(AccountingAllocator* allocator, const char* name)
SegmentSize segment_size)
: allocation_size_(0), : allocation_size_(0),
segment_bytes_allocated_(0), segment_bytes_allocated_(0),
position_(0), position_(0),
...@@ -36,8 +35,7 @@ Zone::Zone(AccountingAllocator* allocator, const char* name, ...@@ -36,8 +35,7 @@ Zone::Zone(AccountingAllocator* allocator, const char* name,
allocator_(allocator), allocator_(allocator),
segment_head_(nullptr), segment_head_(nullptr),
name_(name), name_(name),
sealed_(false), sealed_(false) {
segment_size_(segment_size) {
allocator_->ZoneCreation(this); allocator_->ZoneCreation(this);
} }
...@@ -138,12 +136,9 @@ Address Zone::NewExpand(size_t size) { ...@@ -138,12 +136,9 @@ Address Zone::NewExpand(size_t size) {
V8::FatalProcessOutOfMemory(nullptr, "Zone"); V8::FatalProcessOutOfMemory(nullptr, "Zone");
return kNullAddress; return kNullAddress;
} }
if (segment_size_ == SegmentSize::kLarge) {
new_size = kMaximumSegmentSize;
}
if (new_size < kMinimumSegmentSize) { if (new_size < kMinimumSegmentSize) {
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 // Limit the size of new segments to avoid growing the segment size
// exponentially, thus putting pressure on contiguous virtual address space. // exponentially, thus putting pressure on contiguous virtual address space.
// All the while making sure to allocate a segment large enough to hold the // All the while making sure to allocate a segment large enough to hold the
......
...@@ -37,12 +37,9 @@ namespace internal { ...@@ -37,12 +37,9 @@ namespace internal {
// Note: The implementation is inherently not thread safe. Do not use // Note: The implementation is inherently not thread safe. Do not use
// from multi-threaded code. // from multi-threaded code.
enum class SegmentSize { kLarge, kDefault };
class V8_EXPORT_PRIVATE Zone final { class V8_EXPORT_PRIVATE Zone final {
public: public:
Zone(AccountingAllocator* allocator, const char* name, Zone(AccountingAllocator* allocator, const char* name);
SegmentSize segment_size = SegmentSize::kDefault);
~Zone(); ~Zone();
// Allocate 'size' bytes of memory in the Zone; expands the Zone by // Allocate 'size' bytes of memory in the Zone; expands the Zone by
...@@ -102,7 +99,7 @@ class V8_EXPORT_PRIVATE Zone final { ...@@ -102,7 +99,7 @@ class V8_EXPORT_PRIVATE Zone final {
static const size_t kMinimumSegmentSize = 8 * KB; static const size_t kMinimumSegmentSize = 8 * KB;
// Never allocate segments larger than this size in bytes. // 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. // Report zone excess when allocation exceeds this limit.
static const size_t kExcessLimit = 256 * MB; static const size_t kExcessLimit = 256 * MB;
...@@ -136,7 +133,6 @@ class V8_EXPORT_PRIVATE Zone final { ...@@ -136,7 +133,6 @@ class V8_EXPORT_PRIVATE Zone final {
Segment* segment_head_; Segment* segment_head_;
const char* name_; const char* name_;
bool sealed_; bool sealed_;
SegmentSize segment_size_;
}; };
// ZoneObject is an abstraction that helps define classes of objects // ZoneObject is an abstraction that helps define classes of objects
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment