chromium/v8/src/zone/zone-compression.h

// Copyright 2020 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_COMPRESSION_H_
#define V8_ZONE_ZONE_COMPRESSION_H_

#include "src/base/bits.h"
#include "src/common/globals.h"

namespace v8 {
namespace internal {

// This struct provides untyped implementation of zone compression scheme.
//
// The compression scheme relies on the following assumptions:
// 1) all zones containing compressed pointers are allocated in the same "zone
//    cage" of kReservationSize size and kReservationAlignment-aligned.
//    Attempt to compress pointer to an object stored outside of the "cage"
//    will silently succeed but it will later produce wrong result after
//    decompression.
// 2) compression is just a masking away bits above kReservationAlignment.
// 3) nullptr is compressed to 0, thus there must be no valid objects allocated
//    at the beginning of the "zone cage". Ideally, the first page of the cage
//    should be unmapped in order to catch attempts to use decompressed nullptr
//    value earlier.
// 4) decompression requires "zone cage" address value, which is computed on
//    the fly from an arbitrary address pointing somewhere to the "zone cage".
// 5) decompression requires special casing for nullptr.
struct ZoneCompression {};

}  // namespace internal
}  // namespace v8

#endif  // V8_ZONE_ZONE_COMPRESSION_H_