Commit de5dcb79 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[base] Apply empty base class optimization to base::TemplateHashMapImpl

... this reduces the size of VariableMap object by one word which in
turn reduces zone memory pressure. The Scope class which contains
VariableMap as a field is usually in top 5 of all allocated objects
in zone memory.

Bug: v8:9923
Change-Id: I79c6bd9ae97db72f24b831fd5e3733d8d7e4c0fd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2300486
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68896}
parent 86a19a69
......@@ -21,6 +21,7 @@
#include "src/parsing/parser.h"
#include "src/parsing/preparse-data.h"
#include "src/zone/zone-list-inl.h"
#include "src/zone/zone.h"
namespace v8 {
namespace internal {
......@@ -34,6 +35,10 @@ namespace internal {
// use. Because a Variable holding a handle with the same location exists
// this is ensured.
static_assert(sizeof(VariableMap) == (sizeof(void*) + 2 * sizeof(uint32_t) +
sizeof(ZoneAllocationPolicy)),
"Empty base optimization didn't kick in for VariableMap");
VariableMap::VariableMap(Zone* zone)
: ZoneHashMap(8, ZoneAllocationPolicy(zone)) {}
......
This diff is collapsed.
......@@ -192,7 +192,7 @@ class ZoneObject {
// The ZoneAllocationPolicy is used to specialize generic data
// structures to allocate themselves and their elements in the Zone.
class ZoneAllocationPolicy final {
class ZoneAllocationPolicy {
public:
// Creates unusable allocation policy.
ZoneAllocationPolicy() : zone_(nullptr) {}
......
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