v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
free-space.h
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_OBJECTS_FREE_SPACE_H_
6#define V8_OBJECTS_FREE_SPACE_H_
7
9
10// Has to be the last include (doesn't have include guards):
12
13namespace v8 {
14namespace internal {
15
16#include "torque-generated/src/objects/free-space-tq.inc"
17
18// FreeSpace are fixed-size free memory blocks used by the heap and GC.
19// They look like heap objects (are heap object tagged and have a map) so that
20// the heap remains iterable. They have a size and a next pointer.
21// The next pointer is the raw address of the next FreeSpace object (or NULL)
22// in the free list.
23//
24// When external code space is enabled next pointer is stored as Smi values
25// representing a diff from current FreeSpace object address in kObjectAlignment
26// chunks. Terminating FreeSpace value is represented as Smi zero.
27// Such a representation has the following properties:
28// a) it can hold both positive an negative diffs for full pointer compression
29// cage size (HeapObject address has only valuable 30 bits while Smis have
30// 31 bits),
31// b) it's independent of the pointer compression base and pointer compression
32// scheme.
33class FreeSpace : public TorqueGeneratedFreeSpace<FreeSpace, HeapObject> {
34 public:
35 // [size]: size of the free space including the header.
37 static inline void SetSize(const WritableFreeSpace& writable_free_space,
38 int size, RelaxedStoreTag);
39 inline int Size();
40
41 // Accessors for the next field.
42 inline Tagged<FreeSpace> next() const;
43 inline void SetNext(const WritableFreeSpace& writable_free_space,
45
46 // Dispatched behavior.
48
49 class BodyDescriptor;
50
51 private:
52 inline bool IsValid() const;
53
55};
56
57} // namespace internal
58} // namespace v8
59
61
62#endif // V8_OBJECTS_FREE_SPACE_H_
static void SetSize(const WritableFreeSpace &writable_free_space, int size, RelaxedStoreTag)
void SetNext(const WritableFreeSpace &writable_free_space, Tagged< FreeSpace > next)
Tagged< FreeSpace > next() const
#define DECL_PRINTER(Name)
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define DECL_RELAXED_INT_ACCESSORS(name)