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 8#include "src/objects/heap-object.h" 9 10// Has to be the last include (doesn't have include guards): 11#include "src/objects/object-macros.h" 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. 23class FreeSpace : public TorqueGeneratedFreeSpace<FreeSpace, HeapObject> { 24 public: 25 // [size]: size of the free space including the header. 26 DECL_RELAXED_SMI_ACCESSORS(size) 27 28 inline int Size(); 29 30 // Accessors for the next field. 31 inline FreeSpace next(); 32 inline void set_next(FreeSpace next); 33 34 inline static FreeSpace cast(HeapObject obj); 35 inline static FreeSpace unchecked_cast(const Object obj); 36 37 // Dispatched behavior. 38 DECL_PRINTER(FreeSpace) 39 40 class BodyDescriptor; 41 42 private: 43 inline bool IsValid(); 44 45 TQ_OBJECT_CONSTRUCTORS(FreeSpace) 46}; 47 48} // namespace internal 49} // namespace v8 50 51#include "src/objects/object-macros-undef.h" 52 53#endif // V8_OBJECTS_FREE_SPACE_H_ 54